diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-02-13 03:01:43 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-02-13 03:01:43 +0000 |
commit | 14fad81f260b9e49c65aa61b7bbdd36942810b94 (patch) | |
tree | a6d00881c3c6596e57f1b8a38fa7b8b860805161 /lib/CodeGen/SimpleRegisterCoalescing.h | |
parent | 78297d875b1243a515b766ba4cdc676afd85a891 (diff) | |
download | external_llvm-14fad81f260b9e49c65aa61b7bbdd36942810b94.tar.gz external_llvm-14fad81f260b9e49c65aa61b7bbdd36942810b94.tar.bz2 external_llvm-14fad81f260b9e49c65aa61b7bbdd36942810b94.zip |
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.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.h b/lib/CodeGen/SimpleRegisterCoalescing.h index 1120fb3d05..32a44da3d8 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. |