diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/Mips/MipsSubtarget.cpp | 38 | ||||
-rw-r--r-- | llvm/lib/Target/Mips/MipsSubtarget.h | 6 |
2 files changed, 44 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsSubtarget.cpp b/llvm/lib/Target/Mips/MipsSubtarget.cpp index f6af7e22e35..cbc2ef79e4f 100644 --- a/llvm/lib/Target/Mips/MipsSubtarget.cpp +++ b/llvm/lib/Target/Mips/MipsSubtarget.cpp @@ -57,6 +57,10 @@ static cl::opt<bool> GPOpt("mgpopt", cl::Hidden, cl::desc("Enable gp-relative addressing of mips small data items")); +bool MipsSubtarget::DspWarningPrinted = false; + +bool MipsSubtarget::MSAWarningPrinted = false; + void MipsSubtarget::anchor() {} MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS, @@ -129,6 +133,40 @@ MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS, << "\n"; UseSmallSection = false; } + + if (hasDSPR2() && !DspWarningPrinted) { + if (hasMips64() && !hasMips64r2()) { + errs() << "warning: the 'dspr2' ASE requires MIPS64 revision 2 or " + << "greater\n"; + DspWarningPrinted = true; + } else if (hasMips32() && !hasMips32r2()) { + errs() << "warning: the 'dspr2' ASE requires MIPS32 revision 2 or " + << "greater\n"; + DspWarningPrinted = true; + } + } else if (hasDSP() && !DspWarningPrinted) { + if (hasMips64() && !hasMips64r2()) { + errs() << "warning: the 'dsp' ASE requires MIPS64 revision 2 or " + << "greater\n"; + DspWarningPrinted = true; + } else if (hasMips32() && !hasMips32r2()) { + errs() << "warning: the 'dsp' ASE requires MIPS32 revision 2 or " + << "greater\n"; + DspWarningPrinted = true; + } + } + + if (hasMSA() && !MSAWarningPrinted) { + if (hasMips64() && !hasMips64r5()) { + errs() << "warning: the 'msa' ASE requires MIPS64 revision 5 or " + << "greater\n"; + MSAWarningPrinted = true; + } else if (hasMips32() && !hasMips32r5()) { + errs() << "warning: the 'msa' ASE requires MIPS32 revision 5 or " + << "greater\n"; + MSAWarningPrinted = true; + } + } } bool MipsSubtarget::isPositionIndependent() const { diff --git a/llvm/lib/Target/Mips/MipsSubtarget.h b/llvm/lib/Target/Mips/MipsSubtarget.h index 8b10b0596e0..bdf71fce85a 100644 --- a/llvm/lib/Target/Mips/MipsSubtarget.h +++ b/llvm/lib/Target/Mips/MipsSubtarget.h @@ -44,6 +44,12 @@ class MipsSubtarget : public MipsGenSubtargetInfo { enum class CPU { P5600 }; + // Used to avoid printing dsp warnings multiple times. + static bool DspWarningPrinted; + + // Used to avoid printing msa warnings multiple times. + static bool MSAWarningPrinted; + // Mips architecture version MipsArchEnum MipsArchVersion; |