summaryrefslogtreecommitdiff
path: root/lib/Target/Mips
diff options
context:
space:
mode:
authorVladimir Stefanovic <vladimir.stefanovic@rt-rk.com>2018-07-04 19:26:31 +0000
committerVladimir Stefanovic <vladimir.stefanovic@rt-rk.com>2018-07-04 19:26:31 +0000
commitd04690c89baa523884d1b59403bf05d676166fcf (patch)
tree0f280c04822eb30890ccac420d7a5c3706214d12 /lib/Target/Mips
parent1631efd1b8ca12ea92da2f71489fb0ecebafdb76 (diff)
[mips] Warn when crc, ginv, virt flags are used with too old revision
CRC and GINV ASE require revision 6, Virtualization requires revision 5. Print a warning when revision is older than required. Differential Revision: https://reviews.llvm.org/D48843 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r--lib/Target/Mips/MipsSubtarget.cpp35
-rw-r--r--lib/Target/Mips/MipsSubtarget.h9
2 files changed, 33 insertions, 11 deletions
diff --git a/lib/Target/Mips/MipsSubtarget.cpp b/lib/Target/Mips/MipsSubtarget.cpp
index e5ba4fa5a8b..0c39a45467c 100644
--- a/lib/Target/Mips/MipsSubtarget.cpp
+++ b/lib/Target/Mips/MipsSubtarget.cpp
@@ -61,8 +61,10 @@ static cl::opt<bool>
cl::desc("Enable gp-relative addressing of mips small data items"));
bool MipsSubtarget::DspWarningPrinted = false;
-
bool MipsSubtarget::MSAWarningPrinted = false;
+bool MipsSubtarget::VirtWarningPrinted = false;
+bool MipsSubtarget::CRCWarningPrinted = false;
+bool MipsSubtarget::GINVWarningPrinted = false;
void MipsSubtarget::anchor() {}
@@ -172,16 +174,27 @@ MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
}
}
- 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;
- }
+ StringRef ArchName = hasMips64() ? "MIPS64" : "MIPS32";
+
+ if (!hasMips32r5() && hasMSA() && !MSAWarningPrinted) {
+ errs() << "warning: the 'msa' ASE requires " << ArchName
+ << " revision 5 or greater\n";
+ MSAWarningPrinted = true;
+ }
+ if (!hasMips32r5() && hasVirt() && !VirtWarningPrinted) {
+ errs() << "warning: the 'virt' ASE requires " << ArchName
+ << " revision 5 or greater\n";
+ VirtWarningPrinted = true;
+ }
+ if (!hasMips32r6() && hasCRC() && !CRCWarningPrinted) {
+ errs() << "warning: the 'crc' ASE requires " << ArchName
+ << " revision 6 or greater\n";
+ CRCWarningPrinted = true;
+ }
+ if (!hasMips32r6() && hasGINV() && !GINVWarningPrinted) {
+ errs() << "warning: the 'ginv' ASE requires " << ArchName
+ << " revision 6 or greater\n";
+ GINVWarningPrinted = true;
}
CallLoweringInfo.reset(new MipsCallLowering(*getTargetLowering()));
diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h
index 0504fc2c579..676d702ba63 100644
--- a/lib/Target/Mips/MipsSubtarget.h
+++ b/lib/Target/Mips/MipsSubtarget.h
@@ -54,6 +54,15 @@ class MipsSubtarget : public MipsGenSubtargetInfo {
// Used to avoid printing msa warnings multiple times.
static bool MSAWarningPrinted;
+ // Used to avoid printing crc warnings multiple times.
+ static bool CRCWarningPrinted;
+
+ // Used to avoid printing ginv warnings multiple times.
+ static bool GINVWarningPrinted;
+
+ // Used to avoid printing virt warnings multiple times.
+ static bool VirtWarningPrinted;
+
// Mips architecture version
MipsArchEnum MipsArchVersion;