38 #define DEBUG_TYPE "mips"
71 Ret +=
"-i8:8:32-i16:16:32-i64:64";
77 Ret +=
"-n32:64-S128";
107 Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this),
108 NoMips16Subtarget(TT, CPU, FS.empty() ?
"-mips16" : FS.str() +
",-mips16",
110 Mips16Subtarget(TT, CPU, FS.empty() ?
"+mips16" : FS.str() +
",+mips16",
112 Subtarget = &DefaultSubtarget;
118 void MipsebTargetMachine::anchor() { }
128 void MipselTargetMachine::anchor() { }
151 bool hasNoMips16Attr =
162 FS += FS.
empty() ?
"+mips16" :
",+mips16";
163 else if (hasNoMips16Attr)
164 FS += FS.empty() ?
"-mips16" :
",-mips16";
166 FS += FS.empty() ?
"+soft-float" :
",+soft-float";
168 auto &
I = SubtargetMap[CPU + FS];
174 I = llvm::make_unique<MipsSubtarget>(
TargetTriple, CPU, FS, isLittle,
198 EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
202 return getTM<MipsTargetMachine>();
206 return *getMipsTargetMachine().getSubtargetImpl();
209 void addIRPasses()
override;
210 bool addInstSelector()
override;
211 void addPreEmitPass()
override;
213 void addPreRegAlloc()
override;
219 return new MipsPassConfig(
this, PM);
222 void MipsPassConfig::addIRPasses() {
225 if (getMipsSubtarget().os16())
227 if (getMipsSubtarget().inMips16HardFloat())
232 bool MipsPassConfig::addInstSelector() {
239 void MipsPassConfig::addPreRegAlloc() {
246 DEBUG(
errs() <<
"No Target Transform Info Pass Added\n");
251 DEBUG(
errs() <<
"Target Transform Info Pass Added\n");
259 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.
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 * createMipsOptimizePICCallPass(MipsTargetMachine &TM)
Return an OptimizeCall object.
Target & getTheMipselTarget()
Analysis pass providing the TargetTransformInfo.
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
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 * createAtomicExpandPass(const TargetMachine *TM)
No attributes have been set.
Target-Independent Code Generator Pass Configuration Options.
Target & getTheMips64Target()
Function Alias Analysis false
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
MipsebTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL)
FunctionPass * createMipsHazardSchedule()
Returns a pass that clears pipeline hazards.
static std::string computeDataLayout(const Triple &TT, StringRef CPU, const TargetOptions &Options, bool isLittle)
Target & getTheMips64elTarget()
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...
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
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 * createMipsConstantIslandPass()
Returns a pass that converts branches to long branches.
FunctionPass * createMipsModuleISelDagPass(MipsTargetMachine &TM)
FunctionPass * createMips16ISelDag(MipsTargetMachine &TM, CodeGenOpt::Level OptLevel)
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Triple - Helper class for working with autoconf configuration names.
ModulePass * createMips16HardFloatPass(MipsTargetMachine &TM)
TargetIRAnalysis getTargetIRAnalysis() override
Get a TargetIRAnalysis implementation for the target.
MipselTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL)
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.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
Target & getTheMipsTarget()
ModulePass * createMipsOs16Pass(MipsTargetMachine &TM)
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.
MipsTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle)
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")
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
void LLVMInitializeMipsTarget()