aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SimpleRegisterCoalescing.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-02-13 03:01:43 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-02-13 03:01:43 +0000
commit70071434ae6080c09ffdc8e069da92619381b930 (patch)
treea6d00881c3c6596e57f1b8a38fa7b8b860805161 /lib/CodeGen/SimpleRegisterCoalescing.h
parentba8d51c1d7bf4ada96ff27550ac3576b31323b3a (diff)
downloadexternal_llvm-70071434ae6080c09ffdc8e069da92619381b930.zip
external_llvm-70071434ae6080c09ffdc8e069da92619381b930.tar.gz
external_llvm-70071434ae6080c09ffdc8e069da92619381b930.tar.bz2
Initial support for copy elimination by commuting its definition MI.
PR1877. A3 = op A2 B0<kill> ... B1 = A3 <- this copy ... = op A3 <- more uses ==> B2 = op B0 A2<kill> ... B1 = B2 <- now an identify copy ... = op B2 <- more uses This speeds up FreeBench/neural by 29%, Olden/bh by 12%, oopack_v1p8 by 53%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SimpleRegisterCoalescing.h')
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.h b/lib/CodeGen/SimpleRegisterCoalescing.h
index 1120fb3..32a44da 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.h
+++ b/lib/CodeGen/SimpleRegisterCoalescing.h
@@ -80,6 +80,7 @@ namespace llvm {
class SimpleRegisterCoalescing : public MachineFunctionPass,
public RegisterCoalescer {
MachineFunction* mf_;
+ const MachineRegisterInfo* mri_;
const TargetMachine* tm_;
const TargetRegisterInfo* tri_;
const TargetInstrInfo* tii_;
@@ -114,6 +115,9 @@ namespace llvm {
///
SmallPtrSet<MachineInstr*, 32> JoinedCopies;
+ /// ChangedCopies - Keep track of copies modified due to commuting.
+ SmallPtrSet<MachineInstr*, 32> ChangedCopies;
+
public:
static char ID; // Pass identifcation, replacement for typeid
SimpleRegisterCoalescing() : MachineFunctionPass((intptr_t)&ID) {}
@@ -168,7 +172,7 @@ namespace llvm {
/// if the copy was successfully coalesced away. If it is not currently
/// possible to coalesce this interval, but it may be possible if other
/// things get coalesced, then it returns true by reference in 'Again'.
- bool JoinCopy(CopyRec TheCopy, bool &Again);
+ bool JoinCopy(CopyRec &TheCopy, bool &Again);
/// JoinIntervals - Attempt to join these two intervals. On failure, this
/// returns false. Otherwise, if one of the intervals being joined is a
@@ -192,6 +196,9 @@ namespace llvm {
bool AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,
MachineInstr *CopyMI);
+ bool RemoveCopyByCommutingDef(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.