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>();
306 static const struct {
308 RTLIB::LibcallImpl Mips16Impl;
309 RTLIB::LibcallImpl GenericImpl;
310 } HardFloatCalls[] = {
311 {RTLIB::ADD_F64, RTLIB::impl___mips16_adddf3, RTLIB::impl___adddf3},
312 {RTLIB::ADD_F32, RTLIB::impl___mips16_addsf3, RTLIB::impl___addsf3},
313 {RTLIB::DIV_F64, RTLIB::impl___mips16_divdf3, RTLIB::impl___divdf3},
314 {RTLIB::DIV_F32, RTLIB::impl___mips16_divsf3, RTLIB::impl___divsf3},
315 {RTLIB::FCMP3_PRED_OEQ_F64, RTLIB::impl___mips16_eqdf2,
316 RTLIB::impl___eqdf2},
317 {RTLIB::FCMP3_PRED_OEQ_F32, RTLIB::impl___mips16_eqsf2,
318 RTLIB::impl___eqsf2},
319 {RTLIB::FPEXT_F32_F64, RTLIB::impl___mips16_extendsfdf2,
320 RTLIB::impl___extendsfdf2},
321 {RTLIB::FPTOSINT_F64_I32, RTLIB::impl___mips16_fix_truncdfsi,
322 RTLIB::impl___fixdfsi},
323 {RTLIB::FPTOSINT_F32_I32, RTLIB::impl___mips16_fix_truncsfsi,
324 RTLIB::impl___fixsfsi},
325 {RTLIB::SINTTOFP_I32_F64, RTLIB::impl___mips16_floatsidf,
326 RTLIB::impl___floatsidf},
327 {RTLIB::SINTTOFP_I32_F32, RTLIB::impl___mips16_floatsisf,
328 RTLIB::impl___floatsisf},
329 {RTLIB::UINTTOFP_I32_F64, RTLIB::impl___mips16_floatunsidf,
330 RTLIB::impl___floatunsidf},
331 {RTLIB::UINTTOFP_I32_F32, RTLIB::impl___mips16_floatunsisf,
332 RTLIB::impl___floatunsisf},
333 {RTLIB::FCMP3_PRED_OGE_F64, RTLIB::impl___mips16_gedf2,
334 RTLIB::impl___gedf2},
335 {RTLIB::FCMP3_PRED_OGE_F32, RTLIB::impl___mips16_gesf2,
336 RTLIB::impl___gesf2},
337 {RTLIB::FCMP3_PRED_OGT_F64, RTLIB::impl___mips16_gtdf2,
338 RTLIB::impl___gtdf2},
339 {RTLIB::FCMP3_PRED_OGT_F32, RTLIB::impl___mips16_gtsf2,
340 RTLIB::impl___gtsf2},
341 {RTLIB::FCMP3_PRED_OLE_F64, RTLIB::impl___mips16_ledf2,
342 RTLIB::impl___ledf2},
343 {RTLIB::FCMP3_PRED_OLE_F32, RTLIB::impl___mips16_lesf2,
344 RTLIB::impl___lesf2},
345 {RTLIB::FCMP3_PRED_OLT_F64, RTLIB::impl___mips16_ltdf2,
346 RTLIB::impl___ltdf2},
347 {RTLIB::FCMP3_PRED_OLT_F32, RTLIB::impl___mips16_ltsf2,
348 RTLIB::impl___ltsf2},
349 {RTLIB::MUL_F64, RTLIB::impl___mips16_muldf3, RTLIB::impl___muldf3},
350 {RTLIB::MUL_F32, RTLIB::impl___mips16_mulsf3, RTLIB::impl___mulsf3},
351 {RTLIB::FCMP3_PRED_UNE_F64, RTLIB::impl___mips16_nedf2,
352 RTLIB::impl___nedf2},
353 {RTLIB::FCMP3_PRED_UNE_F32, RTLIB::impl___mips16_nesf2,
354 RTLIB::impl___nesf2},
355 {RTLIB::MIPS16_RET_DC, RTLIB::impl___mips16_ret_dc, RTLIB::Unsupported},
356 {RTLIB::MIPS16_RET_DF, RTLIB::impl___mips16_ret_df, RTLIB::Unsupported},
357 {RTLIB::MIPS16_RET_SC, RTLIB::impl___mips16_ret_sc, RTLIB::Unsupported},
358 {RTLIB::MIPS16_RET_SF, RTLIB::impl___mips16_ret_sf, RTLIB::Unsupported},
359 {RTLIB::SUB_F64, RTLIB::impl___mips16_subdf3, RTLIB::impl___subdf3},
360 {RTLIB::SUB_F32, RTLIB::impl___mips16_subsf3, RTLIB::impl___subsf3},
361 {RTLIB::FPROUND_F64_F32, RTLIB::impl___mips16_truncdfsf2,
362 RTLIB::impl___truncdfsf2},
363 {RTLIB::UO_F64, RTLIB::impl___mips16_unorddf2, RTLIB::impl___unorddf2},
364 {RTLIB::UO_F32, RTLIB::impl___mips16_unordsf2, RTLIB::impl___unordsf2},
368 for (
const auto &E : HardFloatCalls) {
369 Info.setLibcallImpl(E.LC,
370 UseMips16HardFloat ? E.Mips16Impl : E.GenericImpl);