37 #define DEBUG_TYPE "mips"
67 Ret +=
"-i8:8:32-i16:16:32-i64:64";
73 Ret +=
"-n32:64-S128";
91 CPU, FS, Options, RM, CM, OL),
94 Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this),
95 NoMips16Subtarget(TT, CPU, FS.empty() ?
"-mips16" : FS.str() +
",-mips16",
97 Mips16Subtarget(TT, CPU, FS.empty() ?
"+mips16" : FS.str() +
",+mips16",
99 Subtarget = &DefaultSubtarget;
105 void MipsebTargetMachine::anchor() { }
114 void MipselTargetMachine::anchor() { }
136 bool hasNoMips16Attr =
147 FS += FS.
empty() ?
"+mips16" :
",+mips16";
148 else if (hasNoMips16Attr)
149 FS += FS.empty() ?
"-mips16" :
",-mips16";
151 FS += FS.empty() ?
"+soft-float" :
",+soft-float";
153 auto &
I = SubtargetMap[CPU +
FS];
183 EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
187 return getTM<MipsTargetMachine>();
191 return *getMipsTargetMachine().getSubtargetImpl();
194 void addIRPasses()
override;
195 bool addInstSelector()
override;
196 void addMachineSSAOptimization()
override;
197 void addPreEmitPass()
override;
199 void addPreRegAlloc()
override;
205 return new MipsPassConfig(
this, PM);
208 void MipsPassConfig::addIRPasses() {
211 if (getMipsSubtarget().os16())
213 if (getMipsSubtarget().inMips16HardFloat())
218 bool MipsPassConfig::addInstSelector() {
225 void MipsPassConfig::addMachineSSAOptimization() {
230 void MipsPassConfig::addPreRegAlloc() {
238 DEBUG(
errs() <<
"No Target Transform Info Pass Added\n");
243 DEBUG(
errs() <<
"Target Transform Info Pass Added\n");
251 void MipsPassConfig::addPreEmitPass() {
static ARMBaseTargetMachine::ARMABI computeTargetABI(const Triple &TT, StringRef CPU, const TargetOptions &Options)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
MCTargetOptions MCOptions
Machine level options.
MipsTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle)
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
FunctionPass * createMipsOptimizePICCallPass(MipsTargetMachine &TM)
Return an OptimizeCall object.
Analysis pass providing the TargetTransformInfo.
std::string str() const
str - Get the contents as an std::string.
void resetSubtarget(MachineFunction *MF)
Reset the subtarget for the Mips target.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form...
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
FunctionPass * createMipsSEISelDag(MipsTargetMachine &TM)
FunctionPass * createAtomicExpandPass(const TargetMachine *TM)
No attributes have been set.
Target-Independent Code Generator Pass Configuration Options.
static std::string computeDataLayout(const Triple &TT, StringRef CPU, const TargetOptions &Options, bool isLittle)
Concrete BasicTTIImpl that can be used if no further customization is needed.
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...
FunctionPass * createMipsLongBranchPass(MipsTargetMachine &TM)
createMipsLongBranchPass - Returns a pass that converts branches to long branches.
~MipsTargetMachine() override
void setSubtarget(const TargetSubtargetInfo *ST)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
This class describes a target machine that is implemented with the LLVM target-independent code gener...
FunctionPass * createMipsModuleISelDagPass(MipsTargetMachine &TM)
Triple - Helper class for working with autoconf configuration names.
MipsebTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
ModulePass * createMips16HardFloatPass(MipsTargetMachine &TM)
TargetIRAnalysis getTargetIRAnalysis() override
Get a TargetIRAnalysis implementation for the target.
FunctionPass * createMipsDelaySlotFillerPass(MipsTargetMachine &TM)
createMipsDelaySlotFillerPass - Returns a pass that fills in delay slots in Mips MachineFunctions ...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Target - Wrapper for Target specific information.
ModulePass * createMipsOs16Pass(MipsTargetMachine &TM)
FunctionPass * createMipsConstantIslandPass(MipsTargetMachine &tm)
createMipsLongBranchPass - Returns a pass that converts branches to long branches.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
const MipsSubtarget * getSubtargetImpl() const
bool allowMixed16_32() const
StringRef getValueAsString() const
Return the attribute's value as a string.
static MipsABIInfo computeTargetABI(const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
Module * getParent()
Get the module that this global value is contained inside of...
StringRef - Represent a constant reference to a string, i.e.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
MipselTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
FunctionPass * createMips16ISelDag(MipsTargetMachine &TM)
void LLVMInitializeMipsTarget()
bool empty() const
empty - Check if the string is empty.