summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocBase.h
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2010-11-11 17:46:29 +0000
committerAndrew Trick <atrick@apple.com>2010-11-11 17:46:29 +0000
commit8a83d54528c197675ba0f21ebe95ac30fa3d8841 (patch)
treefdf0c61575f1df20e903a3e481acf8561e30ab0c /lib/CodeGen/RegAllocBase.h
parent8e78cc4e130a8773cc8a2be2a94c4a97317ac383 (diff)
downloadllvm-8a83d54528c197675ba0f21ebe95ac30fa3d8841.tar.gz
llvm-8a83d54528c197675ba0f21ebe95ac30fa3d8841.tar.bz2
llvm-8a83d54528c197675ba0f21ebe95ac30fa3d8841.tar.xz
Check TRI->getReservedRegs because other allocators do it. Even though
it makes no sense for allocation_order iterators to visit reserved regs. The inline spiller depends on AliasAnalysis. Manage the Query state to avoid uninitialized or stale results. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocBase.h')
-rw-r--r--lib/CodeGen/RegAllocBase.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/CodeGen/RegAllocBase.h b/lib/CodeGen/RegAllocBase.h
index 8c3971dee1..c8c78567f8 100644
--- a/lib/CodeGen/RegAllocBase.h
+++ b/lib/CodeGen/RegAllocBase.h
@@ -106,6 +106,15 @@ protected:
// A RegAlloc pass should call this before allocatePhysRegs.
void init(const TargetRegisterInfo &tri, VirtRegMap &vrm, LiveIntervals &lis);
+ // Get an initialized query to check interferences between lvr and preg. Note
+ // that Query::init must be called at least once for each physical register
+ // before querying a new live virtual register. This ties queries_ and
+ // physReg2liu_ together.
+ LiveIntervalUnion::Query &query(LiveInterval &lvr, unsigned preg) {
+ queries_[preg].init(&lvr, &physReg2liu_[preg]);
+ return queries_[preg];
+ }
+
// The top-level driver. The output is a VirtRegMap that us updated with
// physical register assignments.
//
@@ -135,7 +144,7 @@ protected:
// Helper for spilling all live virtual registers currently unified under preg
// that interfere with the most recently queried lvr. Return true if spilling
// was successful, and append any new spilled/split intervals to splitLVRs.
- bool spillInterferences(unsigned preg,
+ bool spillInterferences(LiveInterval &lvr, unsigned preg,
SmallVectorImpl<LiveInterval*> &splitLVRs);
#ifndef NDEBUG
@@ -146,7 +155,8 @@ protected:
private:
void seedLiveVirtRegs(LiveVirtRegQueue &lvrQ);
- void spillReg(unsigned reg, SmallVectorImpl<LiveInterval*> &splitLVRs);
+ void spillReg(LiveInterval &lvr, unsigned reg,
+ SmallVectorImpl<LiveInterval*> &splitLVRs);
};
} // end namespace llvm