aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-10-18 07:49:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-10-18 07:49:59 +0000
commit4ae31a5d3297af4c6e9752ec91d76b6daa0fc05c (patch)
tree6527351c0aed04902c6cb7250531c61023a16432 /include/llvm/CodeGen
parentcf1d7256d0bb1e9e3101bf201e4d60529b30b6ff (diff)
Really fix PR1734. Carefully track which register uses are sub-register uses by
traversing inverse register coalescing map. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/SimpleRegisterCoalescing.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/SimpleRegisterCoalescing.h b/include/llvm/CodeGen/SimpleRegisterCoalescing.h
index 93d3e1da21..b62c26cf22 100644
--- a/include/llvm/CodeGen/SimpleRegisterCoalescing.h
+++ b/include/llvm/CodeGen/SimpleRegisterCoalescing.h
@@ -37,19 +37,24 @@ namespace llvm {
LiveIntervals *li_;
LiveVariables *lv_;
- typedef IndexedMap<unsigned> Reg2RegMap;
- Reg2RegMap r2rMap_;
-
BitVector allocatableRegs_;
DenseMap<const TargetRegisterClass*, BitVector> allocatableRCRegs_;
+ /// r2rMap_ - Map from register to its representative register.
+ ///
+ IndexedMap<unsigned> r2rMap_;
+
+ /// r2rRevMap_ - Reverse of r2rRevMap_, i.e. Map from register to all
+ /// the registers it represent.
+ IndexedMap<std::vector<unsigned> > r2rRevMap_;
+
/// JoinedLIs - Keep track which register intervals have been coalesced
/// with other intervals.
BitVector JoinedLIs;
- /// SubRegIdxes - Keep track of sub-register and sub-indexes.
+ /// SubRegIdxes - Keep track of sub-register and indexes.
///
- std::vector<std::pair<unsigned, unsigned> > SubRegIdxes;
+ SmallVector<std::pair<unsigned, unsigned>, 32> SubRegIdxes;
public:
static char ID; // Pass identifcation, replacement for typeid
@@ -132,10 +137,15 @@ namespace llvm {
bool AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,
MachineInstr *CopyMI);
+ /// AddSubRegIdxPairs - Recursively mark all the registers represented by the
+ /// specified register as sub-registers. The recursion level is expected to be
+ /// shallow.
+ void AddSubRegIdxPairs(unsigned Reg, unsigned SubIdx);
+
/// lastRegisterUse - Returns the last use of the specific register between
/// cycles Start and End. It also returns the use operand by reference. It
/// returns NULL if there are no uses.
- MachineInstr *lastRegisterUse(unsigned Start, unsigned End, unsigned Reg,
+ MachineInstr *lastRegisterUse(unsigned Start, unsigned End, unsigned Reg,
MachineOperand *&MOU);
/// findDefOperand - Returns the MachineOperand that is a def of the specific