31 #define DEBUG_TYPE "mips-subtarget" 33 #define GET_SUBTARGETINFO_TARGET_DESC 34 #define GET_SUBTARGETINFO_CTOR 35 #include "MipsGenSubtargetInfo.inc" 41 cl::desc(
"Allow for a mixture of Mips16 " 42 "and Mips32 code in a single output file"),
46 cl::desc(
"Compile all functions that don't use " 47 "floating point as Mips 16"),
51 cl::desc(
"Enable mips16 hard float."),
56 cl::desc(
"Enable mips16 constant islands."),
61 cl::desc(
"Enable gp-relative addressing of mips small data items"));
63 bool MipsSubtarget::DspWarningPrinted =
false;
64 bool MipsSubtarget::MSAWarningPrinted =
false;
65 bool MipsSubtarget::VirtWarningPrinted =
false;
66 bool MipsSubtarget::CRCWarningPrinted =
false;
67 bool MipsSubtarget::GINVWarningPrinted =
false;
69 void MipsSubtarget::anchor() {}
73 unsigned StackAlignOverride)
75 IsLittle(little), IsSoftFloat(
false), IsSingleFloat(
false), IsFPXX(
false),
85 StackAlignOverride(StackAlignOverride),
86 TM(TM), TargetTriple(TT), TSInfo(),
92 if (MipsArchVersion == MipsDefault)
93 MipsArchVersion = Mips32;
97 if (MipsArchVersion == Mips1)
99 if (MipsArchVersion == Mips5)
105 "Invalid Arch & ABI pair.");
124 if (UseIndirectJumpsHazard) {
127 "cannot combine indirect jumps with hazard barriers and microMIPS");
130 "indirect jumps with hazard barriers requires MIPS32R2 or later");
148 UseSmallSection =
GPOpt;
149 if (!NoABICalls &&
GPOpt) {
150 errs() <<
"warning: cannot use small-data accesses for '-mabicalls'" 152 UseSmallSection =
false;
155 if (
hasDSPR2() && !DspWarningPrinted) {
157 errs() <<
"warning: the 'dspr2' ASE requires MIPS64 revision 2 or " 159 DspWarningPrinted =
true;
161 errs() <<
"warning: the 'dspr2' ASE requires MIPS32 revision 2 or " 163 DspWarningPrinted =
true;
165 }
else if (
hasDSP() && !DspWarningPrinted) {
167 errs() <<
"warning: the 'dsp' ASE requires MIPS64 revision 2 or " 169 DspWarningPrinted =
true;
171 errs() <<
"warning: the 'dsp' ASE requires MIPS32 revision 2 or " 173 DspWarningPrinted =
true;
180 errs() <<
"warning: the 'msa' ASE requires " << ArchName
181 <<
" revision 5 or greater\n";
182 MSAWarningPrinted =
true;
185 errs() <<
"warning: the 'virt' ASE requires " << ArchName
186 <<
" revision 5 or greater\n";
187 VirtWarningPrinted =
true;
190 errs() <<
"warning: the 'crc' ASE requires " << ArchName
191 <<
" revision 6 or greater\n";
192 CRCWarningPrinted =
true;
195 errs() <<
"warning: the 'ginv' ASE requires " << ArchName
196 <<
" revision 6 or greater\n";
197 GINVWarningPrinted =
true;
206 *static_cast<const MipsTargetMachine *>(&TM), *
this, *RBI));
217 CriticalPathRCs.clear();
218 CriticalPathRCs.push_back(
isGP64bit() ? &Mips::GPR64RegClass
219 : &Mips::GPR32RegClass);
234 InstrItins = getInstrItineraryForCPU(CPUName);
236 if (InMips16Mode && !IsSoftFloat)
237 InMips16HardFloat =
true;
239 if (StackAlignOverride)
240 stackAlignment = StackAlignOverride;
const RegisterBankInfo * getRegBankInfo() const override
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.
MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS, bool little, const MipsTargetMachine &TM, unsigned StackAlignOverride)
This constructor initializes the data members to match that of the specified triple.
void getCriticalPathRCs(RegClassVector &CriticalPathRCs) const override
This file declares the targeting of the Machinelegalizer class for Mips.
block Block Frequency true
const InstructionSelector * getInstructionSelector() const override
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
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
bool enablePostRAScheduler() const override
This overrides the PostRAScheduler bit in the SchedModel for each CPU.
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.
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)