summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't add live ranges for sub-registers when clobbering a physical register.Jakob Stoklund Olesen2011-04-111-8/+7
| | | | | | | | | Both coalescing and register allocation already check aliases for interference, so these extra segments are only slowing us down. This speeds up both linear scan and the greedy register allocator. llvm-svn: 129283
* Allow coalescing with reserved physregs in certain cases:Jakob Stoklund Olesen2011-04-041-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | When a virtual register has a single value that is defined as a copy of a reserved register, permit that copy to be joined. These virtual register are usually copies of the stack pointer: %vreg75<def> = COPY %ESP; GR32:%vreg75 MOV32mr %vreg75, 1, %noreg, 0, %noreg, %vreg74<kill> MOV32mi %vreg75, 1, %noreg, 8, %noreg, 0 MOV32mi %vreg75<kill>, 1, %noreg, 4, %noreg, 0 CALLpcrel32 ... Coalescing these virtual registers early decreases register pressure. Previously, they were coalesced by RALinScan::attemptTrivialCoalescing after register allocation was completed. The lower register pressure causes the mcinst-lowering-cmp0.ll test case to fail because it depends on linear scan spilling a particular register. I am deleting 2008-08-05-SpillerBug.ll because it is counting the number of instructions emitted, and its revision history shows the 'correct' count being edited many times. llvm-svn: 128845
* Extract physreg joining policy to a separate method.Jakob Stoklund Olesen2011-04-041-53/+57
| | | | llvm-svn: 128844
* Mark all uses as <undef> when joining a copy.Jakob Stoklund Olesen2011-03-311-3/+15
| | | | | | | | | | | | This way, shrinkToUses() will ignore the instruction that is about to be deleted, and we avoid leaving invalid live ranges that SplitKit doesn't like. Fix a misunderstanding in MachineVerifier about <def,undef> operands. The <undef> flag is valid on def operands where it has the same meaning as <undef> on a use operand. It only applies to sub-register defines which also read the full register. llvm-svn: 128642
* Make physreg coalescing independent on the number of uses of the virtual ↵Jakob Stoklund Olesen2011-03-091-3/+1
| | | | | | | | | | | | | | | | | register. The damage done by physreg coalescing only depends on the number of instructions the extended physreg live range covers. This fixes PR9438. The heuristic is still luck-based, and physreg coalescing really should be disabled completely. We need a register allocator with better hinting support before that is possible. Convert a test to FileCheck and force spilling by inserting an extra call. The previous spilling behavior was dependent on misguided physreg coalescing decisions. llvm-svn: 127351
* Avoid comparing invalid slot indexes, and assert that it doesn't happen.Jakob Stoklund Olesen2011-03-031-3/+1
| | | | | | | The SlotIndex created by the default construction does not represent a position in the function, and it doesn't make sense to compare it to other indexes. llvm-svn: 126924
* Switch to SmallVector in SimpleRegisterCoalescing for a 3.5% speedup on 403.gcc.Cameron Zwarich2011-02-171-3/+3
| | | | llvm-svn: 125728
* Add LiveIntervals::shrinkToUses().Jakob Stoklund Olesen2011-02-081-21/+9
| | | | | | | | After uses of a live range are removed, recompute the live range to only cover the remaining uses. This is necessary after rematerializing the value before some (but not all) uses. llvm-svn: 125058
* Check that a live range exists before shortening it. This fixes PR8989.Jakob Stoklund Olesen2011-01-201-3/+5
| | | | | | The live range may have been deleted earlier because of rematerialization. llvm-svn: 123891
* Add hidden -verify-coalescing to run the machine code verifier before and afterJakob Stoklund Olesen2011-01-201-0/+10
| | | | | | register coalescing. llvm-svn: 123890
* Replace TargetRegisterInfo::printReg with a PrintReg class that also works ↵Jakob Stoklund Olesen2011-01-091-8/+4
| | | | | | | | | | without a TRI instance. Print virtual registers numbered from 0 instead of the arbitrary FirstVirtualRegister. The first virtual register is printed as %vreg0. TRI::NoRegister is printed as %noreg. llvm-svn: 123107
* Remove some checks for StrongPHIElim. These checks make it impossible to use anCameron Zwarich2010-12-191-4/+2
| | | | | | | | | | | alternative register allocator that does not require LiveIntervals by specifying it on the command-line for a target that has StrongPHIElimination enabled by default. These checks are pretty meaningless anyways, since StrongPHIElimination and PHIElimination are never used at the same time. llvm-svn: 122176
* Fix a comment typo.Bob Wilson2010-12-171-2/+2
| | | | llvm-svn: 122016
* Update LiveDebugVariables during coalescing.Jakob Stoklund Olesen2010-12-021-0/+4
| | | | llvm-svn: 120720
* Implement the first half of LiveDebugVariables.Jakob Stoklund Olesen2010-12-021-0/+5
| | | | | | | | | | | | | | | | | | | Scan the MachineFunction for DBG_VALUE instructions, and replace them with a data structure similar to LiveIntervals. The live range of a DBG_VALUE is determined by propagating it down the dominator tree until a new DBG_VALUE is found. When a DBG_VALUE lives in a register, its live range is confined to the live range of the register's value. LiveDebugVariables runs before coalescing, so DBG_VALUEs are not artificially extended when registers are joined. The missing half will recreate DBG_VALUE instructions from the intervals when register allocation is complete. The pass is disabled by default. It can be enabled with the temporary command line option -live-debug-variables. llvm-svn: 120636
* Unbreak build.Evan Cheng2010-10-221-10/+0
| | | | llvm-svn: 117155
* Transfer implicit ops when forming load multiple and return instructions.Evan Cheng2010-10-221-1/+1
| | | | llvm-svn: 117151
* When SimpleRegisterCoalescing is trimming kill flags on a physical registerJakob Stoklund Olesen2010-10-201-1/+11
| | | | | | | | | | | operand, also check if subregisters are killed. Add <imp-def> operands for subregisters that remain alive after a super register is killed. I don't have a testcase for this that reproduces on trunk. <rdar://problem/8441758> llvm-svn: 116940
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-121-1/+11
| | | | | | | | | perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. llvm-svn: 116334
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* Drop the use of LiveInterval::iterator and the LiveRange class inJakob Stoklund Olesen2010-10-011-14/+7
| | | | | | RemoveCopyByCommutingDef. llvm-svn: 115386
* When RemoveCopyByCommutingDef is creating additional identity copies, just useJakob Stoklund Olesen2010-10-011-47/+7
| | | | | | | | | | | LiveInterval::MergeValueNumberInto instead of trying to extend LiveRanges and getting it wrong. This fixed PR8249 where a valno with a multi-segment live range was defined by an identity copy created by RemoveCopyByCommutingDef. Some of the live segments disappeared. llvm-svn: 115385
* Pretty up the debug output during RemoveCopyByCommutingDef.Jakob Stoklund Olesen2010-10-011-19/+7
| | | | llvm-svn: 115384
* Fixed some tests to avoid LiveIntervals::getInstructionFromIndex(..) ↵Lang Hames2010-09-261-5/+5
| | | | | | overhead where possible. Thanks to Jakob for the suggestions. llvm-svn: 114798
* Avoid using VNInfo::getCopy as much as possible. I want to get rid of it.Jakob Stoklund Olesen2010-09-251-10/+6
| | | | llvm-svn: 114794
* Removed VNInfo::isDefAccurate(). Def "accuracy" can be checked by testing ↵Lang Hames2010-09-251-10/+9
| | | | | | whether LiveIntervals::getInstructionFromIndex(def) returns NULL. llvm-svn: 114791
* Teach RemoveCopyByCommutingDef to check all aliases, not just subregisters.Jakob Stoklund Olesen2010-09-011-16/+14
| | | | | | | This caused a miscompilation in WebKit where %RAX had conflicting defs when RemoveCopyByCommutingDef was commuting a %EAX use. llvm-svn: 112751
* Add experimental -disable-physical-join command line option.Jakob Stoklund Olesen2010-08-311-0/+10
| | | | | | | | | | Eventually, we want to disable physreg coalescing completely, and let the register allocator do its job using hints. This option makes it possible to measure the impact of disabling physreg coalescing. llvm-svn: 112567
* Now that PassInfo and Pass::ID have been separated, move the rest of the ↵Owen Anderson2010-08-231-5/+3
| | | | | | passes over to the new registration API. llvm-svn: 111815
* Transpose the calculation of spill weights such that we are calculating oneJakob Stoklund Olesen2010-08-101-4/+1
| | | | | | | | | | | | | | register at a time. This turns out to be slightly faster than iterating over instructions, but more importantly, it allows us to compute spill weights for new registers created after the spill weight pass has run. Also compute the allocation hint at the same time as the spill weight. This allows us to use the spill weight as a cost metric for copies, and choose the most profitable hint if there is more than one possibility. The new hints provide a very small (< 0.1%) but universal code size improvement. llvm-svn: 110631
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Be more aggressive about removing joined physreg copies.Jakob Stoklund Olesen2010-08-051-3/+10
| | | | | | | When a joined COPY changes subreg liveness, we keep it around as a KILL, otherwise it is safe to delete. llvm-svn: 110403
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* Remove many calls to TII::isMoveInstr. Targets should be producing COPY anyway.Jakob Stoklund Olesen2010-07-161-78/+21
| | | | | | TII::isMoveInstr is going tobe completely removed. llvm-svn: 108507
* Remat uncoalescable COPY instrsJakob Stoklund Olesen2010-07-091-0/+11
| | | | llvm-svn: 108010
* Avoid creating %physreg:subidx operands in ↵Jakob Stoklund Olesen2010-07-091-1/+4
| | | | | | | | SimpleRegisterCoalescing::RemoveCopyByCommutingDef. This fixes PR7602. llvm-svn: 107957
* Deal with a few remaining spots that assume physical registers have live ↵Jakob Stoklund Olesen2010-07-091-2/+4
| | | | | | | | intervals. This fixes PR7601. llvm-svn: 107955
* Fix broken isCopy handling in TrimLiveIntervalToLastUse.Jakob Stoklund Olesen2010-07-091-3/+7
| | | | llvm-svn: 107950
* Revert "Fix broken isCopy handling in TrimLiveIntervalToLastUse"Jakob Stoklund Olesen2010-07-081-7/+3
| | | | | | This reverts commit 107921. It broke the clang self host. llvm-svn: 107926
* Fix broken isCopy handling in TrimLiveIntervalToLastUseJakob Stoklund Olesen2010-07-081-3/+7
| | | | llvm-svn: 107921
* Convert EXTRACT_SUBREG to COPY when emitting machine instrs.Jakob Stoklund Olesen2010-07-081-3/+7
| | | | | | | | | EXTRACT_SUBREG no longer appears as a machine instruction. Use COPY instead. Add isCopy() checks in many places using isMoveInstr() and isExtractSubreg(). The isMoveInstr hook will be removed later. llvm-svn: 107879
* Remove references to INSERT_SUBREG after de-SSA.Jakob Stoklund Olesen2010-07-081-6/+1
| | | | | | | Fix X86InstrInfo::convertToThreeAddressWithLEA to generate COPY instead of INSERT_SUBREG. llvm-svn: 107878
* Fix more places assuming subregisters have live intervalsJakob Stoklund Olesen2010-07-071-1/+6
| | | | llvm-svn: 107780
* Revert "Remove references to INSERT_SUBREG after de-SSA" r107725.Jakob Stoklund Olesen2010-07-071-1/+6
| | | | | | Buildbot breakage. llvm-svn: 107744
* Remove references to INSERT_SUBREG after de-SSAJakob Stoklund Olesen2010-07-061-6/+1
| | | | llvm-svn: 107732
* One more case assuming that subregs have live ranges.Jakob Stoklund Olesen2010-07-061-2/+2
| | | | llvm-svn: 107700
* Fix buildbot breakage where a def is missing.Jakob Stoklund Olesen2010-07-061-0/+2
| | | | llvm-svn: 107698
* Be more forgiving when calculating alias interference for physreg coalescing.Jakob Stoklund Olesen2010-07-061-102/+58
| | | | | | | | | | | | It is OK for an alias live range to overlap if there is a copy to or from the physical register. CoalescerPair can work out if the copy is coalescable independently of the alias. This means that we can join with the actual destination interval instead of using the getOrigDstReg() hack. It is no longer necessary to merge clobber ranges into subregisters. llvm-svn: 107695
* Detect and handle COPY in many places.Jakob Stoklund Olesen2010-07-031-18/+23
| | | | | | | This code is transitional, it will soon be possible to eliminate isExtractSubreg, isInsertSubreg, and isMoveInstr in most places. llvm-svn: 107547
OpenPOWER on IntegriCloud