From f11344d770dd781144d073c0ee2aef792b77ee7a Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Thu, 11 Nov 2010 17:46:29 +0000 Subject: 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. llvm-svn: 118800 --- llvm/lib/CodeGen/RegAllocBase.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/RegAllocBase.h') diff --git a/llvm/lib/CodeGen/RegAllocBase.h b/llvm/lib/CodeGen/RegAllocBase.h index 8c3971dee14..c8c78567f87 100644 --- a/llvm/lib/CodeGen/RegAllocBase.h +++ b/llvm/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 &splitLVRs); #ifndef NDEBUG @@ -146,7 +155,8 @@ protected: private: void seedLiveVirtRegs(LiveVirtRegQueue &lvrQ); - void spillReg(unsigned reg, SmallVectorImpl &splitLVRs); + void spillReg(LiveInterval &lvr, unsigned reg, + SmallVectorImpl &splitLVRs); }; } // end namespace llvm -- cgit v1.2.3