45 #define DEBUG_TYPE "mips" 84 Ret +=
"-i8:8:32-i16:16:32-i64:64";
90 Ret +=
"-n32:64-S128";
127 Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this,
128 Options.StackAlignmentOverride),
129 NoMips16Subtarget(TT, CPU, FS.empty() ?
"-mips16" : FS.str() +
",-mips16",
130 isLittle, *this, Options.StackAlignmentOverride),
131 Mips16Subtarget(TT, CPU, FS.empty() ?
"+mips16" : FS.str() +
",+mips16",
132 isLittle, *this, Options.StackAlignmentOverride) {
133 Subtarget = &DefaultSubtarget;
139 void MipsebTargetMachine::anchor() {}
149 void MipselTargetMachine::anchor() {}
172 bool hasNoMips16Attr =
175 bool HasMicroMipsAttr =
177 bool HasNoMicroMipsAttr =
188 FS += FS.
empty() ?
"+mips16" :
",+mips16";
189 else if (hasNoMips16Attr)
190 FS += FS.empty() ?
"-mips16" :
",-mips16";
191 if (HasMicroMipsAttr)
192 FS += FS.empty() ?
"+micromips" :
",+micromips";
193 else if (HasNoMicroMipsAttr)
194 FS += FS.empty() ?
"-micromips" :
",-micromips";
196 FS += FS.empty() ?
"+soft-float" :
",+soft-float";
198 auto &
I = SubtargetMap[CPU + FS];
204 I = llvm::make_unique<MipsSubtarget>(
TargetTriple, CPU, FS, isLittle, *
this,
228 EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
232 return getTM<MipsTargetMachine>();
236 return *getMipsTargetMachine().getSubtargetImpl();
239 void addIRPasses()
override;
240 bool addInstSelector()
override;
241 void addPreEmitPass()
override;
242 void addPreRegAlloc()
override;
244 bool addIRTranslator()
override;
245 bool addLegalizeMachineIR()
override;
246 bool addRegBankSelect()
override;
247 bool addGlobalInstructionSelect()
override;
253 return new MipsPassConfig(*
this, PM);
256 void MipsPassConfig::addIRPasses() {
259 if (getMipsSubtarget().os16())
261 if (getMipsSubtarget().inMips16HardFloat())
266 bool MipsPassConfig::addInstSelector() {
273 void MipsPassConfig::addPreRegAlloc() {
279 if (Subtarget->allowMixed16_32()) {
289 void MipsPassConfig::addPreEmit2() {
295 void MipsPassConfig::addPreEmitPass() {
320 bool MipsPassConfig::addIRTranslator() {
325 bool MipsPassConfig::addLegalizeMachineIR() {
330 bool MipsPassConfig::addRegBankSelect() {
335 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.
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.
Compute iterated dominance frontiers using a linear time algorithm.
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.
static CodeModel::Model getEffectiveCodeModel(Optional< CodeModel::Model > CM)
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
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.
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 LLVMInitializeMipsTarget()