TargetMachine: Indicate whether machine verifier passes.

This adds a callback to the LLVMTargetMachine that lets target indicate
that they do not pass the machine verifier checks in all cases yet.

This is intended to be a temporary measure while the targets are fixed
allowing us to enable the machine verifier by default with
EXPENSIVE_CHECKS enabled!

Differential Revision: https://reviews.llvm.org/D33696

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304320 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun
2017-05-31 18:41:23 +00:00
parent 8ea517852a
commit 664dca2daa
13 changed files with 51 additions and 4 deletions
+6
View File
@@ -299,6 +299,12 @@ public:
bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx,
raw_pwrite_stream &OS,
bool DisableVerify = true) override;
/// Returns true if the target is expected to pass all machine verifier
/// checks. This is a stopgap measure to fix targets one by one. We will
/// remove this at some point and always enable the verifier when
/// EXPENSIVE_CHECKS is enabled.
virtual bool isMachineVerifierClean() const { return true; }
};
} // end namespace llvm
+6 -1
View File
@@ -430,7 +430,12 @@ void TargetPassConfig::addPrintPass(const std::string &Banner) {
}
void TargetPassConfig::addVerifyPass(const std::string &Banner) {
if (VerifyMachineCode)
bool Verify = VerifyMachineCode;
#ifdef EXPENSIVE_CHECKS
if (VerifyMachineCode == cl::BOU_UNSET)
Verify = TM->isMachineVerifierClean();
#endif
if (Verify)
PM->add(createMachineVerifierPass(Banner));
}
+4 -1
View File
@@ -69,7 +69,6 @@ public:
return -1;
return 0;
}
};
//===----------------------------------------------------------------------===//
@@ -89,6 +88,10 @@ public:
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
const R600Subtarget *getSubtargetImpl(const Function &) const override;
bool isMachineVerifierClean() const override {
return false;
}
};
//===----------------------------------------------------------------------===//
+4
View File
@@ -60,6 +60,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
/// ARM/Thumb little endian target machine.
+4
View File
@@ -41,6 +41,10 @@ public:
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
bool isMachineVerifierClean() const override {
return false;
}
private:
std::unique_ptr<TargetLoweringObjectFile> TLOF;
AVRSubtarget SubTarget;
+4
View File
@@ -49,6 +49,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
} // namespace llvm
+4
View File
@@ -66,6 +66,10 @@ public:
bool isLittleEndian() const { return isLittle; }
const MipsABIInfo &getABI() const { return ABI; }
bool isMachineVerifierClean() const override {
return false;
}
};
/// Mips32/64 big endian target machine.
+3
View File
@@ -65,6 +65,9 @@ public:
TargetIRAnalysis getTargetIRAnalysis() override;
bool isMachineVerifierClean() const override {
return false;
}
}; // NVPTXTargetMachine.
class NVPTXTargetMachine32 : public NVPTXTargetMachine {
+4
View File
@@ -55,6 +55,10 @@ public:
const Triple &TT = getTargetTriple();
return (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le);
};
bool isMachineVerifierClean() const override {
return false;
}
};
/// PowerPC 32-bit target machine.
+4
View File
@@ -40,6 +40,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
/// Sparc 32-bit target machine
@@ -51,6 +51,8 @@ public:
}
bool targetSchedulesPostRAScheduling() const override { return true; };
bool isMachineVerifierClean() const override { return false; }
};
} // end namespace llvm
+4
View File
@@ -49,6 +49,10 @@ public:
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
bool isMachineVerifierClean() const override {
return false;
}
};
} // end namespace llvm
+2 -2
View File
@@ -7,8 +7,8 @@
# This test ensures that the command line accepts
# several run passes on the same command line and
# actually create the proper pipeline for it.
# PSEUDO_PEEPHOLE: -expand-isel-pseudos -peephole-opt
# PEEPHOLE_PSEUDO: -peephole-opt -expand-isel-pseudos
# PSEUDO_PEEPHOLE: -expand-isel-pseudos {{(-machineverifier )?}}-peephole-opt
# PEEPHOLE_PSEUDO: -peephole-opt {{(-machineverifier )?}}-expand-isel-pseudos
# Make sure there are no other passes happening after what we asked.
# CHECK-NEXT: --- |