aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-17 23:16:35 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-17 23:16:35 +0000
commitaf24964251e27c2dd863239ba66ffd967b593be5 (patch)
tree6aa2aad96c4ee1e25e25a227c37a5c0230d1a022 /lib/CodeGen
parentf428eb6c1b09a2322b7a577b0bf2e49dd107bcea (diff)
downloadexternal_llvm-af24964251e27c2dd863239ba66ffd967b593be5.zip
external_llvm-af24964251e27c2dd863239ba66ffd967b593be5.tar.gz
external_llvm-af24964251e27c2dd863239ba66ffd967b593be5.tar.bz2
Make the -verify-regalloc command line option available to base classes as
RegAllocBase::VerifyEnabled. Run the machine code verifier in a few interesting places during RegAllocGreedy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/RegAllocBase.h4
-rw-r--r--lib/CodeGen/RegAllocBasic.cpp9
-rw-r--r--lib/CodeGen/RegAllocGreedy.cpp6
3 files changed, 15 insertions, 4 deletions
diff --git a/lib/CodeGen/RegAllocBase.h b/lib/CodeGen/RegAllocBase.h
index 438a7d1..193c144 100644
--- a/lib/CodeGen/RegAllocBase.h
+++ b/lib/CodeGen/RegAllocBase.h
@@ -156,6 +156,10 @@ protected:
// Use this group name for NamedRegionTimer.
static const char *TimerGroupName;
+public:
+ /// VerifyEnabled - True when -verify-regalloc is given.
+ static bool VerifyEnabled;
+
private:
void seedLiveVirtRegs(std::priority_queue<std::pair<float, unsigned> >&);
diff --git a/lib/CodeGen/RegAllocBasic.cpp b/lib/CodeGen/RegAllocBasic.cpp
index f01ebf5..85a3d7f 100644
--- a/lib/CodeGen/RegAllocBasic.cpp
+++ b/lib/CodeGen/RegAllocBasic.cpp
@@ -53,11 +53,12 @@ static RegisterRegAlloc basicRegAlloc("basic", "basic register allocator",
// Temporary verification option until we can put verification inside
// MachineVerifier.
-static cl::opt<bool>
-VerifyRegAlloc("verify-regalloc",
- cl::desc("Verify live intervals before renaming"));
+static cl::opt<bool, true>
+VerifyRegAlloc("verify-regalloc", cl::location(RegAllocBase::VerifyEnabled),
+ cl::desc("Verify during register allocation"));
const char *RegAllocBase::TimerGroupName = "Register Allocation";
+bool RegAllocBase::VerifyEnabled = false;
namespace {
/// RABasic provides a minimal implementation of the basic register allocation
@@ -475,7 +476,7 @@ bool RABasic::runOnMachineFunction(MachineFunction &mf) {
// make the rewriter a separate pass and override verifyAnalysis instead. When
// that happens, verification naturally falls under VerifyMachineCode.
#ifndef NDEBUG
- if (VerifyRegAlloc) {
+ if (VerifyEnabled) {
// Verify accuracy of LiveIntervals. The standard machine code verifier
// ensures that each LiveIntervals covers all uses of the virtual reg.
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp
index d8c1b3d..8dbb568 100644
--- a/lib/CodeGen/RegAllocGreedy.cpp
+++ b/lib/CodeGen/RegAllocGreedy.cpp
@@ -328,6 +328,9 @@ unsigned RAGreedy::trySplit(LiveInterval &VirtReg, AllocationOrder &Order,
SplitEditor(*SA, *LIS, *VRM, *DomTree, LREdit)
.splitAroundLoop(Loop->getLoop());
+ if (VerifyEnabled)
+ MF->verify(this);
+
// We have new split regs, don't assign anything.
return 0;
}
@@ -400,6 +403,9 @@ bool RAGreedy::runOnMachineFunction(MachineFunction &mf) {
<< ((Value*)mf.getFunction())->getName() << '\n');
MF = &mf;
+ if (VerifyEnabled)
+ MF->verify(this);
+
RegAllocBase::init(getAnalysis<VirtRegMap>(), getAnalysis<LiveIntervals>());
DomTree = &getAnalysis<MachineDominatorTree>();
ReservedRegs = TRI->getReservedRegs(*MF);