diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-06-24 00:12:39 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-06-24 00:12:39 +0000 |
commit | e9c59711d3d1e8b133763393bea92af6e36b0031 (patch) | |
tree | c72c317fe18aa2514dab558fc45987c1007c11fb /include | |
parent | 774cca70b10bc679daff8203d639d9004a2eb194 (diff) | |
download | llvm-e9c59711d3d1e8b133763393bea92af6e36b0031.tar.gz llvm-e9c59711d3d1e8b133763393bea92af6e36b0031.tar.bz2 llvm-e9c59711d3d1e8b133763393bea92af6e36b0031.tar.xz |
Replace a big gob of old coalescer logic with the new CoalescerPair class.
CoalescerPair can determine if a copy can be coalesced, and which register gets
merged away. The old logic in SimpleRegisterCoalescing had evolved into
something a bit too convoluted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/LiveIntervalAnalysis.h | 7 | ||||
-rw-r--r-- | include/llvm/CodeGen/RegisterCoalescer.h | 16 |
2 files changed, 18 insertions, 5 deletions
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index 32fa70970d..8f4de3f026 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -133,10 +133,9 @@ namespace llvm { bool conflictsWithPhysReg(const LiveInterval &li, VirtRegMap &vrm, unsigned reg); - /// conflictsWithSubPhysRegRef - Similar to conflictsWithPhysRegRef except - /// it checks for sub-register reference and it can check use as well. - bool conflictsWithSubPhysRegRef(LiveInterval &li, unsigned Reg, - bool CheckUse, + /// conflictsWithAliasRef - Similar to conflictsWithPhysRegRef except + /// it checks for alias uses and defs. + bool conflictsWithAliasRef(LiveInterval &li, unsigned Reg, SmallPtrSet<MachineInstr*,32> &JoinedCopies); // Interval creation diff --git a/include/llvm/CodeGen/RegisterCoalescer.h b/include/llvm/CodeGen/RegisterCoalescer.h index e3d3e79633..7aec10ccb3 100644 --- a/include/llvm/CodeGen/RegisterCoalescer.h +++ b/include/llvm/CodeGen/RegisterCoalescer.h @@ -165,9 +165,15 @@ namespace llvm { /// virtual register. unsigned subIdx_; + /// origDstReg_ - dstReg_ without subreg adjustments. + unsigned origDstReg_; + /// partial_ - True when the original copy was a partial subregister copy. bool partial_; + /// crossClass_ - True when both regs are virtual, and newRC is constrained. + bool crossClass_; + /// flipped_ - True when DstReg and SrcReg are reversed from the oriignal copy /// instruction. bool flipped_; @@ -186,7 +192,8 @@ namespace llvm { public: CoalescerPair(const TargetInstrInfo &tii, const TargetRegisterInfo &tri) : tii_(tii), tri_(tri), dstReg_(0), srcReg_(0), subIdx_(0), - partial_(false), flipped_(false), newRC_(0) {} + origDstReg_(0), partial_(false), crossClass_(false), flipped_(false), + newRC_(0) {} /// setRegisters - set registers to match the copy instruction MI. Return /// false if MI is not a coalescable copy instruction. @@ -207,6 +214,9 @@ namespace llvm { /// full register, but was a subreg operation. bool isPartial() const { return partial_; } + /// isCrossClass - Return true if DstReg is virtual and NewRC is a smaller register class than DstReg's. + bool isCrossClass() const { return crossClass_; } + /// isFlipped - Return true when getSrcReg is the register being defined by /// the original copy instruction. bool isFlipped() const { return flipped_; } @@ -222,6 +232,10 @@ namespace llvm { /// coalesced into, or 0. unsigned getSubIdx() const { return subIdx_; } + /// getOrigDstReg - Return DstReg as it appeared in the original copy + /// instruction before any subreg adjustments. + unsigned getOrigDstReg() const { return isPhys() ? origDstReg_ : dstReg_; } + /// getNewRC - Return the register class of the coalesced register. const TargetRegisterClass *getNewRC() const { return newRC_; } }; |