46 #define DEBUG_TYPE "mips" 86 Ret +=
"-i8:8:32-i16:16:32-i64:64";
92 Ret +=
"-n32:64-S128";
124 DefaultSubtarget(TT, CPU, FS, isLittle, *this,
126 NoMips16Subtarget(TT, CPU, FS.
empty() ?
"-mips16" : FS.str() +
",-mips16",
129 Mips16Subtarget(TT, CPU, FS.
empty() ?
"+mips16" : FS.str() +
",+mips16",
132 Subtarget = &DefaultSubtarget;
138 void MipsebTargetMachine::anchor() {}
148 void MipselTargetMachine::anchor() {}
171 bool hasNoMips16Attr =
174 bool HasMicroMipsAttr =
176 bool HasNoMicroMipsAttr =
187 FS += FS.
empty() ?
"+mips16" :
",+mips16";
188 else if (hasNoMips16Attr)
189 FS += FS.empty() ?
"-mips16" :
",-mips16";
190 if (HasMicroMipsAttr)
191 FS += FS.empty() ?
"+micromips" :
",+micromips";
192 else if (HasNoMicroMipsAttr)
193 FS += FS.empty() ?
"-micromips" :
",-micromips";
195 FS += FS.empty() ?
"+soft-float" :
",+soft-float";
197 auto &
I = SubtargetMap[CPU +
FS];
203 I = std::make_unique<MipsSubtarget>(
227 EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
231 return getTM<MipsTargetMachine>();
235 return *getMipsTargetMachine().getSubtargetImpl();
238 void addIRPasses()
override;
239 bool addInstSelector()
override;
240 void addPreEmitPass()
override;
241 void addPreRegAlloc()
override;
242 bool addIRTranslator()
override;
243 void addPreLegalizeMachineIR()
override;
244 bool addLegalizeMachineIR()
override;
245 bool addRegBankSelect()
override;
246 bool addGlobalInstructionSelect()
override;
248 std::unique_ptr<CSEConfigBase> getCSEConfig()
const override;
254 return new MipsPassConfig(*
this, PM);
257 std::unique_ptr<CSEConfigBase> MipsPassConfig::getCSEConfig()
const {
261 void MipsPassConfig::addIRPasses() {
264 if (getMipsSubtarget().os16())
266 if (getMipsSubtarget().inMips16HardFloat())
271 bool MipsPassConfig::addInstSelector() {
278 void MipsPassConfig::addPreRegAlloc() {
284 if (Subtarget->allowMixed16_32()) {
297 void MipsPassConfig::addPreEmitPass() {
322 bool MipsPassConfig::addIRTranslator() {
327 void MipsPassConfig::addPreLegalizeMachineIR() {
331 bool MipsPassConfig::addLegalizeMachineIR() {
336 bool MipsPassConfig::addRegBankSelect() {
341 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
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.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
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()
ModulePass * createMipsOs16Pass()
const MipsSubtarget * getSubtargetImpl() const
static std::string computeDataLayout(const Triple &TT, StringRef CPU, const TargetOptions &Options, bool isLittle)
std::unique_ptr< CSEConfigBase > getStandardCSEConfigForOpt(CodeGenOpt::Level Level)
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.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
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()
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 ...
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
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)
#define LLVM_EXTERNAL_VISIBILITY
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 &)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsTarget()