54 MipsArchVersion(MipsDefault), IsLittle(
little), IsSoftFloat(
false),
60 InMips16Mode(
false), InMips16HardFloat(CLOpts.mips16_hard_float),
66 StackAlignOverride(StackAlignOverride), TM(TM),
73 if (MipsArchVersion == MipsDefault)
74 MipsArchVersion = Mips32;
78 if (MipsArchVersion == Mips5)
84 const bool IsValidArchABI =
98 "FPU with 64-bit registers is not available on MIPS32 pre revision 2. "
99 "Use -mcpu=mips32r2 or greater.",
false);
115 if (UseIndirectJumpsHazard) {
118 "cannot combine indirect jumps with hazard barriers and microMIPS");
121 "indirect jumps with hazard barriers requires MIPS32R2 or later");
142 if (NoABICalls && TM.isPositionIndependent())
149 UseSmallSection = CLOpts.mgpopt;
150 if (!NoABICalls && CLOpts.mgpopt) {
151 errs() <<
"warning: cannot use small-data accesses for '-mabicalls'"
153 UseSmallSection = false;
158 errs() <<
"warning: the 'dspr2' ASE requires MIPS64 revision 2 or "
160 DspWarningPrinted =
true;
162 errs() <<
"warning: the 'dspr2' ASE requires MIPS32 revision 2 or "
164 DspWarningPrinted =
true;
166 }
else if (
hasDSP() && !DspWarningPrinted) {
168 errs() <<
"warning: the 'dsp' ASE requires MIPS64 revision 2 or "
170 DspWarningPrinted =
true;
172 errs() <<
"warning: the 'dsp' ASE requires MIPS32 revision 2 or "
174 DspWarningPrinted =
true;
182 errs() <<
"warning: the 'msa' ASE requires " << ArchName
183 <<
" revision 5 or greater\n";
184 MSAWarningPrinted =
true;
187 errs() <<
"warning: the 'virt' ASE requires " << ArchName
188 <<
" revision 5 or greater\n";
189 VirtWarningPrinted =
true;
192 errs() <<
"warning: the 'crc' ASE requires " << ArchName
193 <<
" revision 6 or greater\n";
194 CRCWarningPrinted =
true;
197 errs() <<
"warning: the 'ginv' ASE requires " << ArchName
198 <<
" revision 6 or greater\n";
199 GINVWarningPrinted =
true;
203 TSInfo = std::make_unique<MipsSelectionDAGInfo>();
331 static const struct {
333 RTLIB::LibcallImpl Mips16Impl;
334 RTLIB::LibcallImpl GenericImpl;
335 } HardFloatCalls[] = {
336 {RTLIB::ADD_F64, RTLIB::impl___mips16_adddf3, RTLIB::impl___adddf3},
337 {RTLIB::ADD_F32, RTLIB::impl___mips16_addsf3, RTLIB::impl___addsf3},
338 {RTLIB::DIV_F64, RTLIB::impl___mips16_divdf3, RTLIB::impl___divdf3},
339 {RTLIB::DIV_F32, RTLIB::impl___mips16_divsf3, RTLIB::impl___divsf3},
340 {RTLIB::FCMP3_PRED_OEQ_F64, RTLIB::impl___mips16_eqdf2,
341 RTLIB::impl___eqdf2},
342 {RTLIB::FCMP3_PRED_OEQ_F32, RTLIB::impl___mips16_eqsf2,
343 RTLIB::impl___eqsf2},
344 {RTLIB::FPEXT_F32_F64, RTLIB::impl___mips16_extendsfdf2,
345 RTLIB::impl___extendsfdf2},
346 {RTLIB::FPTOSINT_F64_I32, RTLIB::impl___mips16_fix_truncdfsi,
347 RTLIB::impl___fixdfsi},
348 {RTLIB::FPTOSINT_F32_I32, RTLIB::impl___mips16_fix_truncsfsi,
349 RTLIB::impl___fixsfsi},
350 {RTLIB::SINTTOFP_I32_F64, RTLIB::impl___mips16_floatsidf,
351 RTLIB::impl___floatsidf},
352 {RTLIB::SINTTOFP_I32_F32, RTLIB::impl___mips16_floatsisf,
353 RTLIB::impl___floatsisf},
354 {RTLIB::UINTTOFP_I32_F64, RTLIB::impl___mips16_floatunsidf,
355 RTLIB::impl___floatunsidf},
356 {RTLIB::UINTTOFP_I32_F32, RTLIB::impl___mips16_floatunsisf,
357 RTLIB::impl___floatunsisf},
358 {RTLIB::FCMP3_PRED_OGE_F64, RTLIB::impl___mips16_gedf2,
359 RTLIB::impl___gedf2},
360 {RTLIB::FCMP3_PRED_OGE_F32, RTLIB::impl___mips16_gesf2,
361 RTLIB::impl___gesf2},
362 {RTLIB::FCMP3_PRED_OGT_F64, RTLIB::impl___mips16_gtdf2,
363 RTLIB::impl___gtdf2},
364 {RTLIB::FCMP3_PRED_OGT_F32, RTLIB::impl___mips16_gtsf2,
365 RTLIB::impl___gtsf2},
366 {RTLIB::FCMP3_PRED_OLE_F64, RTLIB::impl___mips16_ledf2,
367 RTLIB::impl___ledf2},
368 {RTLIB::FCMP3_PRED_OLE_F32, RTLIB::impl___mips16_lesf2,
369 RTLIB::impl___lesf2},
370 {RTLIB::FCMP3_PRED_OLT_F64, RTLIB::impl___mips16_ltdf2,
371 RTLIB::impl___ltdf2},
372 {RTLIB::FCMP3_PRED_OLT_F32, RTLIB::impl___mips16_ltsf2,
373 RTLIB::impl___ltsf2},
374 {RTLIB::MUL_F64, RTLIB::impl___mips16_muldf3, RTLIB::impl___muldf3},
375 {RTLIB::MUL_F32, RTLIB::impl___mips16_mulsf3, RTLIB::impl___mulsf3},
376 {RTLIB::FCMP3_PRED_UNE_F64, RTLIB::impl___mips16_nedf2,
377 RTLIB::impl___nedf2},
378 {RTLIB::FCMP3_PRED_UNE_F32, RTLIB::impl___mips16_nesf2,
379 RTLIB::impl___nesf2},
380 {RTLIB::MIPS16_RET_DC, RTLIB::impl___mips16_ret_dc, RTLIB::Unsupported},
381 {RTLIB::MIPS16_RET_DF, RTLIB::impl___mips16_ret_df, RTLIB::Unsupported},
382 {RTLIB::MIPS16_RET_SC, RTLIB::impl___mips16_ret_sc, RTLIB::Unsupported},
383 {RTLIB::MIPS16_RET_SF, RTLIB::impl___mips16_ret_sf, RTLIB::Unsupported},
384 {RTLIB::SUB_F64, RTLIB::impl___mips16_subdf3, RTLIB::impl___subdf3},
385 {RTLIB::SUB_F32, RTLIB::impl___mips16_subsf3, RTLIB::impl___subsf3},
386 {RTLIB::FPROUND_F64_F32, RTLIB::impl___mips16_truncdfsf2,
387 RTLIB::impl___truncdfsf2},
388 {RTLIB::UO_F64, RTLIB::impl___mips16_unorddf2, RTLIB::impl___unorddf2},
389 {RTLIB::UO_F32, RTLIB::impl___mips16_unordsf2, RTLIB::impl___unordsf2},
393 for (
const auto &E : HardFloatCalls) {
394 Info.setLibcallImpl(E.LC,
395 UseMips16HardFloat ? E.Mips16Impl : E.GenericImpl);