30 #define DEBUG_TYPE "mips-subtarget" 32 #define GET_SUBTARGETINFO_TARGET_DESC 33 #define GET_SUBTARGETINFO_CTOR 34 #include "MipsGenSubtargetInfo.inc" 40 cl::desc(
"Allow for a mixture of Mips16 " 41 "and Mips32 code in a single output file"),
45 cl::desc(
"Compile all functions that don't use " 46 "floating point as Mips 16"),
50 cl::desc(
"Enable mips16 hard float."),
55 cl::desc(
"Enable mips16 constant islands."),
60 cl::desc(
"Enable gp-relative addressing of mips small data items"));
62 bool MipsSubtarget::DspWarningPrinted =
false;
63 bool MipsSubtarget::MSAWarningPrinted =
false;
64 bool MipsSubtarget::VirtWarningPrinted =
false;
65 bool MipsSubtarget::CRCWarningPrinted =
false;
66 bool MipsSubtarget::GINVWarningPrinted =
false;
68 void MipsSubtarget::anchor() {}
74 IsLittle(little), IsSoftFloat(
false), IsSingleFloat(
false), IsFPXX(
false),
84 UseIndirectJumpsHazard(
false), StackAlignOverride(StackAlignOverride),
85 TM(TM), TargetTriple(TT), TSInfo(),
91 if (MipsArchVersion == MipsDefault)
92 MipsArchVersion = Mips32;
96 if (MipsArchVersion == Mips1)
98 if (MipsArchVersion == Mips5)
104 "Invalid Arch & ABI pair.");
113 "FPU with 64-bit registers is not available on MIPS32 pre revision 2. " 114 "Use -mcpu=mips32r2 or greater.");
128 if (UseIndirectJumpsHazard) {
131 "cannot combine indirect jumps with hazard barriers and microMIPS");
134 "indirect jumps with hazard barriers requires MIPS32R2 or later");
159 UseSmallSection =
GPOpt;
160 if (!NoABICalls &&
GPOpt) {
161 errs() <<
"warning: cannot use small-data accesses for '-mabicalls'" 163 UseSmallSection =
false;
166 if (
hasDSPR2() && !DspWarningPrinted) {
168 errs() <<
"warning: the 'dspr2' ASE requires MIPS64 revision 2 or " 170 DspWarningPrinted =
true;
172 errs() <<
"warning: the 'dspr2' ASE requires MIPS32 revision 2 or " 174 DspWarningPrinted =
true;
176 }
else if (
hasDSP() && !DspWarningPrinted) {
178 errs() <<
"warning: the 'dsp' ASE requires MIPS64 revision 2 or " 180 DspWarningPrinted =
true;
182 errs() <<
"warning: the 'dsp' ASE requires MIPS32 revision 2 or " 184 DspWarningPrinted =
true;
191 errs() <<
"warning: the 'msa' ASE requires " << ArchName
192 <<
" revision 5 or greater\n";
193 MSAWarningPrinted =
true;
196 errs() <<
"warning: the 'virt' ASE requires " << ArchName
197 <<
" revision 5 or greater\n";
198 VirtWarningPrinted =
true;
201 errs() <<
"warning: the 'crc' ASE requires " << ArchName
202 <<
" revision 6 or greater\n";
203 CRCWarningPrinted =
true;
206 errs() <<
"warning: the 'ginv' ASE requires " << ArchName
207 <<
" revision 6 or greater\n";
208 GINVWarningPrinted =
true;
217 *static_cast<const MipsTargetMachine *>(&TM), *
this, *RBI));
228 CriticalPathRCs.clear();
229 CriticalPathRCs.push_back(
isGP64bit() ? &Mips::GPR64RegClass
230 : &Mips::GPR32RegClass);
245 InstrItins = getInstrItineraryForCPU(CPUName);
247 if (InMips16Mode && !IsSoftFloat)
248 InMips16HardFloat =
true;
250 if (StackAlignOverride)
251 stackAlignment = *StackAlignOverride;
253 stackAlignment =
Align(16);
256 stackAlignment =
Align(8);
const RegisterBankInfo * getRegBankInfo() const override
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
std::unique_ptr< InstructionSelector > InstSelector
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
void getCriticalPathRCs(RegClassVector &CriticalPathRCs) const override
This file declares the targeting of the Machinelegalizer class for Mips.
block Block Frequency true
Holds all the information related to register banks.
This file contains the simple types necessary to represent the attributes associated with functions a...
This class provides legalization strategies.
const MipsABIInfo & getABI() const
MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS, bool little, const MipsTargetMachine &TM, MaybeAlign StackAlignOverride)
This constructor initializes the data members to match that of the specified triple.
This file declares the targeting of the RegisterBankInfo class for Mips.
Reloc::Model getRelocationModel() const
Returns the code generation relocation model.
InstructionSelector * createMipsInstructionSelector(const MipsTargetMachine &, MipsSubtarget &, MipsRegisterBankInfo &)
initializer< Ty > init(const Ty &Val)
const LegalizerInfo * getLegalizerInfo() const override
std::unique_ptr< RegisterBankInfo > RegBankInfo
static cl::opt< bool > Mips16ConstantIslands("mips16-constant-islands", cl::NotHidden, cl::desc("Enable mips16 constant islands."), cl::init(true))
const Triple & getTargetTriple() const
StringRef selectMipsCPU(const Triple &TT, StringRef CPU)
Select the Mips CPU for the given triple and cpu name.
const MipsABIInfo & getABI() const
Triple - Helper class for working with autoconf configuration names.
std::unique_ptr< CallLowering > CallLoweringInfo
static bool useConstantIslands()
const MipsRegisterInfo * getRegisterInfo() const override
bool isPositionIndependent() const
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
bool enablePostRAScheduler() const override
This overrides the PostRAScheduler bit in the SchedModel for each CPU.
bool inAbs2008Mode() const
This class provides the information for the target register banks.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const CallLowering * getCallLowering() const override
const MipsTargetLowering * getTargetLowering() const override
Provides the logic to select generic machine instructions.
static cl::opt< bool > GPOpt("mgpopt", cl::Hidden, cl::desc("Enable gp-relative addressing of mips small data items"))
bool isPositionIndependent() const
static cl::opt< bool > Mips_Os16("mips-os16", cl::init(false), cl::desc("Compile all functions that don't use " "floating point as Mips 16"), cl::Hidden)
This file describes how to lower LLVM calls to machine code calls.
CodeGenOpt::Level getOptLevelToEnablePostRAScheduler() const override
Reloc::Model getRelocationModel() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
InstructionSelector * getInstructionSelector() const override
MipsSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS, const TargetMachine &TM)
Primary interface to the complete machine description for the target machine.
static cl::opt< bool > Mips16HardFloat("mips16-hard-float", cl::NotHidden, cl::desc("Enable mips16 hard float."), cl::init(false))
StringRef - Represent a constant reference to a string, i.e.
static cl::opt< bool > Mixed16_32("mips-mixed-16-32", cl::init(false), cl::desc("Allow for a mixture of Mips16 " "and Mips32 code in a single output file"), cl::Hidden)