30#define DEBUG_TYPE "mips-subtarget"
32#define GET_SUBTARGETINFO_TARGET_DESC
33#define GET_SUBTARGETINFO_CTOR
34#include "MipsGenSubtargetInfo.inc"
36#define OPTIONS_STRUCT_DEFS
37#include "MipsOptions.inc"
39bool MipsSubtarget::DspWarningPrinted =
false;
40bool MipsSubtarget::MSAWarningPrinted =
false;
41bool MipsSubtarget::VirtWarningPrinted =
false;
42bool MipsSubtarget::CRCWarningPrinted =
false;
43bool MipsSubtarget::GINVWarningPrinted =
false;
45void MipsSubtarget::anchor() {}
53 MipsArchVersion(MipsDefault), IsLittle(
little), IsSoftFloat(
false),
59 InMips16Mode(
false), InMips16HardFloat(CLOpts.mips16_hard_float),
65 StackAlignOverride(StackAlignOverride), TM(TM),
72 if (MipsArchVersion == MipsDefault)
73 MipsArchVersion = Mips32;
77 if (MipsArchVersion == Mips5)
82 "Invalid Arch & ABI pair.");
91 "FPU with 64-bit registers is not available on MIPS32 pre revision 2. "
92 "Use -mcpu=mips32r2 or greater.",
false);
106 if (UseIndirectJumpsHazard) {
109 "cannot combine indirect jumps with hazard barriers and microMIPS");
112 "indirect jumps with hazard barriers requires MIPS32R2 or later");
130 if (NoABICalls && TM.isPositionIndependent())
137 UseSmallSection = CLOpts.mgpopt;
138 if (!NoABICalls && CLOpts.mgpopt) {
139 errs() <<
"warning: cannot use small-data accesses for '-mabicalls'"
141 UseSmallSection =
false;
144 if (
hasDSPR2() && !DspWarningPrinted) {
146 errs() <<
"warning: the 'dspr2' ASE requires MIPS64 revision 2 or "
148 DspWarningPrinted =
true;
150 errs() <<
"warning: the 'dspr2' ASE requires MIPS32 revision 2 or "
152 DspWarningPrinted =
true;
154 }
else if (
hasDSP() && !DspWarningPrinted) {
156 errs() <<
"warning: the 'dsp' ASE requires MIPS64 revision 2 or "
158 DspWarningPrinted =
true;
160 errs() <<
"warning: the 'dsp' ASE requires MIPS32 revision 2 or "
162 DspWarningPrinted =
true;
169 errs() <<
"warning: the 'msa' ASE requires " << ArchName
170 <<
" revision 5 or greater\n";
171 MSAWarningPrinted =
true;
174 errs() <<
"warning: the 'virt' ASE requires " << ArchName
175 <<
" revision 5 or greater\n";
176 VirtWarningPrinted =
true;
179 errs() <<
"warning: the 'crc' ASE requires " << ArchName
180 <<
" revision 6 or greater\n";
181 CRCWarningPrinted =
true;
184 errs() <<
"warning: the 'ginv' ASE requires " << ArchName
185 <<
" revision 6 or greater\n";
186 GINVWarningPrinted =
true;
189 TSInfo = std::make_unique<MipsSelectionDAGInfo>();
202 return TM.isPositionIndependent();
209 CriticalPathRCs.clear();
210 CriticalPathRCs.push_back(
isGP64bit() ? &Mips::GPR64RegClass
211 : &Mips::GPR32RegClass);
230 if (InMips16Mode && !IsSoftFloat)
231 InMips16HardFloat =
true;
233 if (StackAlignOverride)
234 stackAlignment = *StackAlignOverride;
236 stackAlignment =
Align(16);
239 stackAlignment =
Align(8);
250 LLVM_DEBUG(
dbgs() <<
"use constant islands " << CLOpts.mips16_constant_islands
252 return CLOpts.mips16_constant_islands;
256 return TM.getRelocationModel();
285 RTLIB::impl___mips16_adddf3, RTLIB::impl___mips16_addsf3,
286 RTLIB::impl___mips16_divdf3, RTLIB::impl___mips16_divsf3,
287 RTLIB::impl___mips16_eqdf2, RTLIB::impl___mips16_eqsf2,
288 RTLIB::impl___mips16_extendsfdf2, RTLIB::impl___mips16_fix_truncdfsi,
289 RTLIB::impl___mips16_fix_truncsfsi, RTLIB::impl___mips16_floatsidf,
290 RTLIB::impl___mips16_floatsisf, RTLIB::impl___mips16_floatunsidf,
291 RTLIB::impl___mips16_floatunsisf, RTLIB::impl___mips16_gedf2,
292 RTLIB::impl___mips16_gesf2, RTLIB::impl___mips16_gtdf2,
293 RTLIB::impl___mips16_gtsf2, RTLIB::impl___mips16_ledf2,
294 RTLIB::impl___mips16_lesf2, RTLIB::impl___mips16_ltdf2,
295 RTLIB::impl___mips16_ltsf2, RTLIB::impl___mips16_muldf3,
296 RTLIB::impl___mips16_mulsf3, RTLIB::impl___mips16_nedf2,
297 RTLIB::impl___mips16_nesf2, RTLIB::impl___mips16_ret_dc,
298 RTLIB::impl___mips16_ret_df, RTLIB::impl___mips16_ret_sc,
299 RTLIB::impl___mips16_ret_sf, RTLIB::impl___mips16_subdf3,
300 RTLIB::impl___mips16_subsf3, RTLIB::impl___mips16_truncdfsf2,
301 RTLIB::impl___mips16_unorddf2, RTLIB::impl___mips16_unordsf2};
307 "Array not sorted!");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the simple types necessary to represent the attributes associated with functions a...
This file describes how to lower LLVM calls to machine code calls.
This file declares the targeting of the Machinelegalizer class for Mips.
This file declares the targeting of the RegisterBankInfo class for Mips.
Tracks which library functions to use for a particular subtarget or function.
This class provides legalization strategies.
This class provides the information for the target register banks.
void initLibcallLoweringInfo(LibcallLoweringInfo &Info) const override
const LegalizerInfo * getLegalizerInfo() const override
bool enablePostRAScheduler() const override
This overrides the PostRAScheduler bit in the SchedModel for each CPU.
MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS, StringRef ABIName, bool little, const MipsTargetMachine &TM, MaybeAlign StackAlignOverride)
This constructor initializes the data members to match that of the specified triple.
std::unique_ptr< InstructionSelector > InstSelector
bool useSoftFloat() const
MipsSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS, const TargetMachine &TM)
const CallLowering * getCallLowering() const override
std::unique_ptr< RegisterBankInfo > RegBankInfo
bool inMips16Mode() const
~MipsSubtarget() override
bool inAbs2008Mode() const
const MipsOptions & getCLOpts() const
std::unique_ptr< CallLowering > CallLoweringInfo
const MipsRegisterInfo * getRegisterInfo() const override
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
const RegisterBankInfo * getRegBankInfo() const override
static const RTLIB::LibcallImpl HardFloatLibCalls[34]
bool isPositionIndependent() const
InstructionSelector * getInstructionSelector() const override
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
std::unique_ptr< LegalizerInfo > Legalizer
const MipsTargetLowering * getTargetLowering() const override
void getCriticalPathRCs(RegClassVector &CriticalPathRCs) const override
const MipsABIInfo & getABI() const
bool useConstantIslands() const
Reloc::Model getRelocationModel() const
const MipsMCOptions & getMCCLOpts() const
CodeGenOptLevel getOptLevelToEnablePostRAScheduler() const override
Holds all the information related to register banks.
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
StringRef selectMipsCPU(const Triple &TT, StringRef CPU)
Select the Mips CPU for the given triple and cpu name.
This is an optimization pass for GlobalISel generic memory operations.
InstructionSelector * createMipsInstructionSelector(const MipsTargetMachine &, const MipsSubtarget &, const MipsRegisterBankInfo &)
@ Never
Never set the bit.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
CodeGenOptLevel
Code generation optimization level.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
This struct is a compact representation of a valid (non-zero power of two) alignment.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
static RTLIB::Libcall getLibcallFromImpl(RTLIB::LibcallImpl Impl)
Return the libcall provided by Impl.