aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2016-03-29 17:40:22 +0000
committerDerek Schuff <dschuff@google.com>2016-03-29 17:40:22 +0000
commit42666eeea22f582ba706290c9b565e83882813b6 (patch)
tree845e2aab027b048d6fa352c3a3f3f07854ffe8ae /llvm/lib/CodeGen/MachineVerifier.cpp
parentf46262e0b7a183c22b9384cd729c5fb0f05e5d38 (diff)
downloadllvm-42666eeea22f582ba706290c9b565e83882813b6.zip
llvm-42666eeea22f582ba706290c9b565e83882813b6.tar.gz
llvm-42666eeea22f582ba706290c9b565e83882813b6.tar.bz2
Add MachineVerifier check for AllVRegsAllocated MachineFunctionProperty
Summary: Check that any function that has the property set is free of virtual register operands. Also, it is actually VirtRegMap (and not the register allocators) that acutally remove the VReg operands (except for RegAllocFast). Reviewers: qcolombet Subscribers: MatzeB, llvm-commits, qcolombet Differential Revision: http://reviews.llvm.org/D18535 llvm-svn: 264755
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 15180b5..b957fd8 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -251,6 +251,7 @@ namespace {
void verifyStackFrame();
void verifySlotIndexes() const;
+ void verifyProperties(const MachineFunction &MF);
};
struct MachineVerifierPass : public MachineFunctionPass {
@@ -307,6 +308,19 @@ void MachineVerifier::verifySlotIndexes() const {
}
}
+void MachineVerifier::verifyProperties(const MachineFunction &MF) {
+ // If a pass has introduced virtual registers without clearing the
+ // AllVRegsAllocated property (or set it without allocating the vregs)
+ // then report an error.
+ if (MF.getProperties().hasProperty(
+ MachineFunctionProperties::Property::AllVRegsAllocated) &&
+ MRI->getNumVirtRegs()) {
+ report(
+ "Function has AllVRegsAllocated property but there are VReg operands",
+ &MF);
+ }
+}
+
unsigned MachineVerifier::verify(MachineFunction &MF) {
foundErrors = 0;
@@ -331,6 +345,8 @@ unsigned MachineVerifier::verify(MachineFunction &MF) {
verifySlotIndexes();
+ verifyProperties(MF);
+
visitMachineFunctionBefore();
for (MachineFunction::const_iterator MFI = MF.begin(), MFE = MF.end();
MFI!=MFE; ++MFI) {