41 #define DEBUG_TYPE "mips"
74 Ret +=
"-i8:8:32-i16:16:32-i64:64";
80 Ret +=
"-n32:64-S128";
110 Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this),
111 NoMips16Subtarget(TT, CPU, FS.empty() ?
"-mips16" : FS.str() +
",-mips16",
113 Mips16Subtarget(TT, CPU, FS.empty() ?
"+mips16" : FS.str() +
",+mips16",
115 Subtarget = &DefaultSubtarget;
121 void MipsebTargetMachine::anchor() {}
131 void MipselTargetMachine::anchor() {}
154 bool hasNoMips16Attr =
157 bool HasMicroMipsAttr =
159 bool HasNoMicroMipsAttr =
170 FS += FS.
empty() ?
"+mips16" :
",+mips16";
171 else if (hasNoMips16Attr)
172 FS += FS.empty() ?
"-mips16" :
",-mips16";
173 if (HasMicroMipsAttr)
174 FS += FS.empty() ?
"+micromips" :
",+micromips";
175 else if (HasNoMicroMipsAttr)
176 FS += FS.empty() ?
"-micromips" :
",-micromips";
178 FS += FS.empty() ?
"+soft-float" :
",+soft-float";
180 auto &
I = SubtargetMap[CPU + FS];
186 I = llvm::make_unique<MipsSubtarget>(
TargetTriple, CPU, FS, isLittle,
210 EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
214 return getTM<MipsTargetMachine>();
218 return *getMipsTargetMachine().getSubtargetImpl();
221 void addIRPasses()
override;
222 bool addInstSelector()
override;
223 void addPreEmitPass()
override;
224 void addPreRegAlloc()
override;
230 return new MipsPassConfig(*
this, PM);
233 void MipsPassConfig::addIRPasses() {
236 if (getMipsSubtarget().os16())
238 if (getMipsSubtarget().inMips16HardFloat())
243 bool MipsPassConfig::addInstSelector() {
250 void MipsPassConfig::addPreRegAlloc() {
257 DEBUG(
errs() <<
"No Target Transform Info Pass Added\n");
262 DEBUG(
errs() <<
"Target Transform Info Pass Added\n");
270 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 * createMicroMipsSizeReductionPass()
Returns an instance of the MicroMips size reduction pass.
Target & getTheMipselTarget()
Analysis pass providing the TargetTransformInfo.
FunctionPass * createMipsDelaySlotFillerPass()
createMipsDelaySlotFillerPass - Returns a pass that fills in delay slots in Mips MachineFunctions ...
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 ...
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.
Target & getTheMips64Target()
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.
ModulePass * createMipsOs16Pass()
static std::string computeDataLayout(const Triple &TT, StringRef CPU, const TargetOptions &Options, bool isLittle)
Function Alias Analysis false
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 * createMipsOptimizePICCallPass()
Return an OptimizeCall object.
~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.
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()
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Triple - Helper class for working with autoconf configuration names.
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)
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()
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.
FunctionPass * createMipsLongBranchPass()
createMipsLongBranchPass - Returns a pass that converts branches to long branches.
FunctionPass * createMipsModuleISelDagPass()
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")
FunctionPass * createAtomicExpandPass()
void LLVMInitializeMipsTarget()