45 #define DEBUG_TYPE "mips" 85 Ret +=
"-i8:8:32-i16:16:32-i64:64";
91 Ret +=
"-n32:64-S128";
122 Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this,
123 Options.StackAlignmentOverride),
124 NoMips16Subtarget(TT, CPU, FS.
empty() ?
"-mips16" : FS.str() +
",-mips16",
125 isLittle, *this, Options.StackAlignmentOverride),
126 Mips16Subtarget(TT, CPU, FS.
empty() ?
"+mips16" : FS.str() +
",+mips16",
127 isLittle, *this, Options.StackAlignmentOverride) {
128 Subtarget = &DefaultSubtarget;
134 void MipsebTargetMachine::anchor() {}
144 void MipselTargetMachine::anchor() {}
167 bool hasNoMips16Attr =
170 bool HasMicroMipsAttr =
172 bool HasNoMicroMipsAttr =
183 FS += FS.
empty() ?
"+mips16" :
",+mips16";
184 else if (hasNoMips16Attr)
185 FS += FS.empty() ?
"-mips16" :
",-mips16";
186 if (HasMicroMipsAttr)
187 FS += FS.empty() ?
"+micromips" :
",+micromips";
188 else if (HasNoMicroMipsAttr)
189 FS += FS.empty() ?
"-micromips" :
",-micromips";
191 FS += FS.empty() ?
"+soft-float" :
",+soft-float";
193 auto &
I = SubtargetMap[CPU + FS];
199 I = llvm::make_unique<MipsSubtarget>(
TargetTriple, CPU, FS, isLittle, *
this,
223 EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
227 return getTM<MipsTargetMachine>();
231 return *getMipsTargetMachine().getSubtargetImpl();
234 void addIRPasses()
override;
235 bool addInstSelector()
override;
236 void addPreEmitPass()
override;
237 void addPreRegAlloc()
override;
238 bool addIRTranslator()
override;
239 void addPreLegalizeMachineIR()
override;
240 bool addLegalizeMachineIR()
override;
241 bool addRegBankSelect()
override;
242 bool addGlobalInstructionSelect()
override;
248 return new MipsPassConfig(*
this, PM);
251 void MipsPassConfig::addIRPasses() {
254 if (getMipsSubtarget().os16())
256 if (getMipsSubtarget().inMips16HardFloat())
261 bool MipsPassConfig::addInstSelector() {
268 void MipsPassConfig::addPreRegAlloc() {
274 if (Subtarget->allowMixed16_32()) {
287 void MipsPassConfig::addPreEmitPass() {
312 bool MipsPassConfig::addIRTranslator() {
317 void MipsPassConfig::addPreLegalizeMachineIR() {
321 bool MipsPassConfig::addLegalizeMachineIR() {
326 bool MipsPassConfig::addRegBankSelect() {
331 bool MipsPassConfig::addGlobalInstructionSelect() {
void initializeMipsBranchExpansionPass(PassRegistry &)
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)
static ARMBaseTargetMachine::ARMABI computeTargetABI(const Triple &TT, StringRef CPU, const TargetOptions &Options)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
CodeModel::Model getEffectiveCodeModel(Optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
MCTargetOptions MCOptions
Machine level options.
This class represents lattice values for constants.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
FunctionPass * createMipsSEISelDag(MipsTargetMachine &TM, CodeGenOpt::Level OptLevel)
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
FunctionPass * createMipsBranchExpansion()
Target & getTheMipselTarget()
FunctionPass * createMipsDelaySlotFillerPass()
createMipsDelaySlotFillerPass - Returns a pass that fills in delay slots in Mips MachineFunctions ...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
void resetSubtarget(MachineFunction *MF)
Reset the subtarget for the Mips target.
block Block Frequency true
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type make_unique(Args &&... args)
Constructs a new T() with the given args and returns a unique_ptr<T> which owns the object...
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
This file contains the simple types necessary to represent the attributes associated with functions a...
No attributes have been set.
Target-Independent Code Generator Pass Configuration Options.
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
Target & getTheMips64Target()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
ModulePass * createMipsOs16Pass()
const MipsSubtarget * getSubtargetImpl() const
static std::string computeDataLayout(const Triple &TT, StringRef CPU, const TargetOptions &Options, bool isLittle)
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
Target & getTheMips64elTarget()
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
Concrete BasicTTIImpl that can be used if no further customization is needed.
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
FunctionPass * createMipsOptimizePICCallPass()
Return an OptimizeCall object.
~MipsTargetMachine() override
FunctionPass * createMipsPreLegalizeCombiner()
void setSubtarget(const TargetSubtargetInfo *ST)
This class describes a target machine that is implemented with the LLVM target-independent code gener...
FunctionPass * createMipsConstantIslandPass()
Returns a pass that converts branches to long branches.
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
FunctionPass * createMips16ISelDag(MipsTargetMachine &TM, CodeGenOpt::Level OptLevel)
ModulePass * createMips16HardFloatPass()
FunctionPass * createMipsExpandPseudoPass()
createMipsExpandPseudoPass - returns an instance of the pseudo instruction expansion pass...
Triple - Helper class for working with autoconf configuration names.
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
unsigned StackAlignmentOverride
StackAlignmentOverride - Override default stack alignment for target.
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)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
This pass is responsible for selecting generic machine instructions to target-specific instructions...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Target - Wrapper for Target specific information.
void initializeMicroMipsSizeReducePass(PassRegistry &)
Target & getTheMipsTarget()
FunctionPass * createMicroMipsSizeReducePass()
Returns an instance of the MicroMips size reduction pass.
StringRef getValueAsString() const
Return the attribute's value as a string.
FunctionPass * createMipsModuleISelDagPass()
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)
This file declares the IRTranslator pass.
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
Module * getParent()
Get the module that this global value is contained inside of...
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
void initializeMipsDelaySlotFillerPass(PassRegistry &)
FunctionPass * createAtomicExpandPass()
void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
void initializeMipsPreLegalizerCombinerPass(PassRegistry &)
void LLVMInitializeMipsTarget()