LLVM  14.0.0git
MipsTargetMachine.h
Go to the documentation of this file.
1 //===- MipsTargetMachine.h - Define TargetMachine for Mips ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the Mips specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
14 #define LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
15 
17 #include "MipsSubtarget.h"
18 #include "llvm/ADT/Optional.h"
19 #include "llvm/ADT/StringMap.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Support/CodeGen.h"
23 #include <memory>
24 
25 namespace llvm {
26 
28  bool isLittle;
29  std::unique_ptr<TargetLoweringObjectFile> TLOF;
30  // Selected ABI
31  MipsABIInfo ABI;
32  const MipsSubtarget *Subtarget;
33  MipsSubtarget DefaultSubtarget;
34  MipsSubtarget NoMips16Subtarget;
35  MipsSubtarget Mips16Subtarget;
36 
37  mutable StringMap<std::unique_ptr<MipsSubtarget>> SubtargetMap;
38 
39 public:
40  MipsTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
43  CodeGenOpt::Level OL, bool JIT, bool isLittle);
44  ~MipsTargetMachine() override;
45 
47 
49  if (Subtarget)
50  return Subtarget;
51  return &DefaultSubtarget;
52  }
53 
54  const MipsSubtarget *getSubtargetImpl(const Function &F) const override;
55 
56  /// Reset the subtarget for the Mips target.
58 
59  // Pass Pipeline Configuration
61 
63  return TLOF.get();
64  }
65 
66  /// Returns true if a cast between SrcAS and DestAS is a noop.
67  bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {
68  // Mips doesn't have any special address spaces so we just reserve
69  // the first 256 for software use (e.g. OpenCL) and treat casts
70  // between them as noops.
71  return SrcAS < 256 && DestAS < 256;
72  }
73 
74  bool isLittleEndian() const { return isLittle; }
75  const MipsABIInfo &getABI() const { return ABI; }
76 };
77 
78 /// Mips32/64 big endian target machine.
79 ///
81  virtual void anchor();
82 
83 public:
84  MipsebTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
87  CodeGenOpt::Level OL, bool JIT);
88 };
89 
90 /// Mips32/64 little endian target machine.
91 ///
93  virtual void anchor();
94 
95 public:
96  MipselTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
99  CodeGenOpt::Level OL, bool JIT);
100 };
101 
102 } // end namespace llvm
103 
104 #endif // LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
llvm::MipsTargetMachine::MipsTargetMachine
MipsTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT, bool isLittle)
Definition: MipsTargetMachine.cpp:111
llvm::MipsTargetMachine
Definition: MipsTargetMachine.h:27
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::MipsTargetMachine::getABI
const MipsABIInfo & getABI() const
Definition: MipsTargetMachine.h:75
llvm::MipselTargetMachine
Mips32/64 little endian target machine.
Definition: MipsTargetMachine.h:92
Optional.h
llvm::X86AS::FS
@ FS
Definition: X86.h:188
llvm::TargetOptions
Definition: TargetOptions.h:124
llvm::MipsABIInfo
Definition: MipsABIInfo.h:22
llvm::Function
Definition: Function.h:62
StringRef.h
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:137
llvm::MipsTargetMachine::getTargetTransformInfo
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
Definition: MipsTargetMachine.cpp:274
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:169
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::TargetMachine::RM
Reloc::Model RM
Definition: TargetMachine.h:103
llvm::Optional< Reloc::Model >
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::MipsTargetMachine::isLittleEndian
bool isLittleEndian() const
Definition: MipsTargetMachine.h:74
llvm::MipsebTargetMachine::MipsebTargetMachine
MipsebTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Definition: MipsTargetMachine.cpp:139
llvm::MipsTargetMachine::isNoopAddrSpaceCast
bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override
Returns true if a cast between SrcAS and DestAS is a noop.
Definition: MipsTargetMachine.h:67
llvm::MipsTargetMachine::getSubtargetImpl
const MipsSubtarget * getSubtargetImpl() const
Definition: MipsTargetMachine.h:48
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::TargetLoweringObjectFile
Definition: TargetLoweringObjectFile.h:44
TargetMachine.h
llvm::MipsebTargetMachine
Mips32/64 big endian target machine.
Definition: MipsTargetMachine.h:80
StringMap.h
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
llvm::EngineKind::JIT
@ JIT
Definition: ExecutionEngine.h:524
llvm::MipsTargetMachine::getObjFileLowering
TargetLoweringObjectFile * getObjFileLowering() const override
Definition: MipsTargetMachine.h:62
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:121
llvm::MipsTargetMachine::resetSubtarget
void resetSubtarget(MachineFunction *MF)
Reset the subtarget for the Mips target.
Definition: MipsTargetMachine.cpp:201
llvm::MachineFunction
Definition: MachineFunction.h:241
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::MipsSubtarget
Definition: MipsSubtarget.h:39
MipsABIInfo.h
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:406
llvm::MipsTargetMachine::~MipsTargetMachine
~MipsTargetMachine() override
llvm::MipsTargetMachine::createPassConfig
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Definition: MipsTargetMachine.cpp:244
CodeGen.h
llvm::MipselTargetMachine::MipselTargetMachine
MipselTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Definition: MipsTargetMachine.cpp:149
MipsSubtarget.h
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39