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 | 1446726f3eb2e247a539098159bf6cd7750a0cb5 (patch) | |
| tree | fc7b7d6d872875cbe4ee0ed03abdac799f19990d /llvm/lib/CodeGen/SimpleRegisterCoalescing.h | |
| parent | 87abe955fcd3ec42feb0c5b790ba5016f4e60a77 (diff) | |
| download | bcm5719-llvm-1446726f3eb2e247a539098159bf6cd7750a0cb5.tar.gz bcm5719-llvm-1446726f3eb2e247a539098159bf6cd7750a0cb5.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%.
llvm-svn: 47046
Diffstat (limited to 'llvm/lib/CodeGen/SimpleRegisterCoalescing.h')
| -rw-r--r-- | llvm/lib/CodeGen/SimpleRegisterCoalescing.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SimpleRegisterCoalescing.h b/llvm/lib/CodeGen/SimpleRegisterCoalescing.h index 1120fb3d05c..32a44da3d89 100644 --- a/llvm/lib/CodeGen/SimpleRegisterCoalescing.h +++ b/llvm/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. |

