summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegisterCoalescer.cpp
Commit message (Collapse)AuthorAge
* Print register in LiveInterval::print()Matthias Braun2013-10-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192398 91177308-0d34-0410-b5e6-96231b3b80d8
* Represent RegUnit liveness with LiveRange instanceMatthias Braun2013-10-10
| | | | | | | Previously LiveInterval has been used, but having a spill weight and register number is unnecessary for a register unit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192397 91177308-0d34-0410-b5e6-96231b3b80d8
* Work on LiveRange instead of LiveInterval where possibleMatthias Braun2013-10-10
| | | | | | | Also change some pointer arguments to references at some places where 0-pointers are not allowed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192396 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass LiveQueryResult by valueMatthias Braun2013-10-10
| | | | | | | This makes the API a bit more natural to use and makes it easier to make LiveRanges implementation details private. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192394 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename LiveRange to LiveInterval::SegmentMatthias Braun2013-10-10
| | | | | | | | The Segment struct contains a single interval; multiple instances of this struct are used to construct a live range, but the struct is not a live range by itself. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192392 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix commentMatthias Braun2013-10-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191966 91177308-0d34-0410-b5e6-96231b3b80d8
* Added temp flag -misched-bench for staging in default changes.Andrew Trick2013-09-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191423 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide basic type safety for array_pod_sort comparators.Benjamin Kramer2013-09-22
| | | | | | | | This makes using array_pod_sort significantly safer. The implementation relies on function pointer casting but that should be safe as we're dealing with void* here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191175 91177308-0d34-0410-b5e6-96231b3b80d8
* avoid unnecessary direct access to LiveInterval::rangesMatthias Braun2013-09-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190170 91177308-0d34-0410-b5e6-96231b3b80d8
* remove unused argument from LiveRanges::join()Matthias Braun2013-09-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190169 91177308-0d34-0410-b5e6-96231b3b80d8
* remove pointless assertMatthias Braun2013-09-06
| | | | | | The if above it ensures the property anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190168 91177308-0d34-0410-b5e6-96231b3b80d8
* fix commentMatthias Braun2013-09-06
| | | | | | There's no 'B3' in the example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190167 91177308-0d34-0410-b5e6-96231b3b80d8
* Track new virtual registers by register number.Mark Lacey2013-08-14
| | | | | | | | | | Track new virtual registers by register number, rather than by the live interval created for them. This is the first step in separating the creation of new virtual registers and new live intervals. Eventually live intervals will be created and populated on demand after the virtual registers have been created and used in instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188434 91177308-0d34-0410-b5e6-96231b3b80d8
* Use modern API to avoid exposing LiveInterval internals.Jakob Stoklund Olesen2013-07-05
| | | | | | No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185733 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a -join-globalcopies bug; handle undef operands.Andrew Trick2013-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184569 91177308-0d34-0410-b5e6-96231b3b80d8
* Modify the -join-globalcopies option (off by default).Andrew Trick2013-06-21
| | | | | | | Always coalesce in forward order to propagate rematerialization. I'm fixing this option so I can enable it by default soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184568 91177308-0d34-0410-b5e6-96231b3b80d8
* Make rematerialization in the coalescer less sensitive to LRG order.Andrew Trick2013-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184567 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark rematerialized super/sub registers as dead.Tim Northover2013-06-14
| | | | | | | | | | | | | When we're rematerializing into a not-quite-right register we already add the real definition as an imp-def, but we should also be marking the "official" register as dead, since nothing else is going to use it as a result of this remat. Not doing this can affect pressure tracking. rdar://problem/14158833 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184002 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix rematerialization into physical registers.Tim Northover2013-05-30
| | | | | | | | | | | | | | | | | r182872 introduced a bug in how the register-coalescer's rematerialization handled defining a physical register. It relied on the output of the coalescer's setRegisters method to determine whether the replacement instruction needed an implicit-def. However, this value isn't necessarily the same as the CopyMI's actual destination register which is what the rest of the basic-block expects us to be defining. The commit changes the rematerializer to use the actual register attached to CopyMI in its decision. This will be tested soon by an X86 patch which moves everything to using MOV32r0 instead of other sizes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182925 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach ReMaterialization to be more cunning about subregistersTim Northover2013-05-29
| | | | | | | | | | | | | | | | This allows rematerialization during register coalescing to handle more cases involving operations like SUBREG_TO_REG which might need to be rematerialized using sub-register indices. For example, code like: v1(GPR64):sub_32 = MOVZ something v2(GPR64) = COPY v1(GPR64) should be convertable to: v2(GPR64):sub_32 = MOVZ something but previously we just gave up in places like this git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182872 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused #includes.Bill Wendling2013-03-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176467 91177308-0d34-0410-b5e6-96231b3b80d8
* RegisterCoalescer::reMaterializeTrivialDef() can constrain the destinationCameron Zwarich2013-02-14
| | | | | | register class to match the defining instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175130 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix RegisterCoalescer::rematerializeTrivialDef() so that it works on flippedCameron Zwarich2013-02-14
| | | | | | | CoalescerPairs. Also, make it take a CoalescerPair directly like other methods of RegisterCoalescer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175123 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some issues with rematerialization in RegisterCoalescer when the destinationCameron Zwarich2013-02-14
| | | | | | | | | | | | of the copy is a subregister def. The current code assumes that it can do a full def of the destination register, but it is not checking that the def operand is read-undef. It also doesn't clear the subregister index of the destination in the new instruction to reflect the full subregister def. These issues were found running 'make check' with my next commit that enables rematerialization in more cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175122 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: LiveDebugVarible can remove DBG_VALUEs, make sure we emit them back.Manman Ren2013-02-13
| | | | | | | | | | | | | | | RegisterCoalescer used to depend on LiveDebugVariable. LDV removes DBG_VALUEs without emitting them at the end. We fix this by removing LDV from RegisterCoalescer. Also add an assertion to make sure we call emitDebugValues if DBG_VALUEs are removed at runOnMachineFunction. rdar://problem/13183203 Reviewed by Andy & Jakob git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175023 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR14732 by handling all kinds of IMPLICIT_DEF live ranges.Jakob Stoklund Olesen2013-01-03
| | | | | | | | | | | | | | | | Most IMPLICIT_DEF instructions are removed by the ProcessImplicitDefs pass, and a few are reinserted by PHIElimination when a PHI argument is <undef>. RegisterCoalescer was assuming that all IMPLICIT_DEF live ranges look like those created by PHIElimination, and that their live range never leaves the basic block. The PR14732 test case does tricks with PHI nodes that causes a longer IMPLICIT_DEF live range to appear. This happens very rarely, but RegisterCoalescer should be able to handle it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171435 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid rewriting instructions twice.Jakob Stoklund Olesen2012-11-29
| | | | | | | | | This could cause miscompilations in targets where sub-register composition is not always idempotent (ARM). <rdar://problem/12758887> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168837 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the LiveRegMatrix analysis available to targets.Jakob Stoklund Olesen2012-11-28
| | | | | | | | | | | No functional change, just moved header files. Targets can inject custom passes between register allocation and rewriting. This makes it possible to tweak the register allocation before rewriting, using the full global interference checking available from LiveRegMatrix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168806 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove duplicated #includes.Jakub Staszak2012-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168712 91177308-0d34-0410-b5e6-96231b3b80d8
* Use array_pod_sort instead of std::sort.Andrew Trick2012-11-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168203 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an obvious merge bug in -join-globalcopies (disabled).Andrew Trick2012-11-15
| | | | | | | | Jakub Staszak spotted this in review. I don't notice these things until I manually rerun benchmarks. But reducing unit tests is a very high priority. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168021 91177308-0d34-0410-b5e6-96231b3b80d8
* Use reserve() to avoid vector reallocation.Jakub Staszak2012-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167991 91177308-0d34-0410-b5e6-96231b3b80d8
* canJoinPhys method doesn't modify CoalescerPair. Make it const.Jakub Staszak2012-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167972 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert -join-splitedges to a boolean cmd line option.Andrew Trick2012-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167880 91177308-0d34-0410-b5e6-96231b3b80d8
* The MachineScheduler does not currently require JoinSplitEdges.Andrew Trick2012-11-13
| | | | | | | This option will eventually either be enabled unconditionally or replaced by a more general live range splitting optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167879 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix -join-splitedges: my previous "cleanup" broke it.Andrew Trick2012-11-13
| | | | | | | Working on reducing unit tests. This won't be enabled unless a subtarget enables misched. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167851 91177308-0d34-0410-b5e6-96231b3b80d8
* misched: Allow subtargets to enable misched and dependent options.Andrew Trick2012-11-13
| | | | | | | | | | | | This allows me to begin enabling (or backing out) misched by default for one subtarget at a time. To run misched we typically want to: - Disable SelectionDAG scheduling (use the source order scheduler) - Enable more aggressive coalescing (until we decide to always run the coalescer this way) - Enable MachineScheduler pass itself. Disabling PostRA sched may follow for some subtargets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167826 91177308-0d34-0410-b5e6-96231b3b80d8
* Added RegisterCoalescer support for joining global copies first.Andrew Trick2012-11-13
| | | | | | | | | | | | This adds the -join-globalcopies option which can be enabled by default once misched is also enabled. Ideally, the register coalescer would be able to split local live ranges in a way that produces copies that can be easily resolved by the scheduler. Until then, this heuristic should be good enough to at least allow the scheduler to run after coalescing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167825 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup the main RegisterCoalescer loop.Andrew Trick2012-11-13
| | | | | | Block priorities still apply outside loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167793 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup -join-splitedges. Make the loop more obvious.Andrew Trick2012-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167785 91177308-0d34-0410-b5e6-96231b3b80d8
* Added a temporary option to avoid critical edges splitting.Andrew Trick2012-11-12
| | | | | | | | | This teaches the register coalescer to be less prone to split critical edges. I am currently benchmarking this with the new (post-coalescer) scheduler. I plan to enable this by default and remove the option as soon as misched is enabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167758 91177308-0d34-0410-b5e6-96231b3b80d8
* Exploit the new identity composition in composeSubRegIndices().Jakob Stoklund Olesen2012-11-01
| | | | | | | The static compose() function in RegisterCoalescer was doing the exact same thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167198 91177308-0d34-0410-b5e6-96231b3b80d8
* Completely disallow partial copies in adjustCopiesBackFrom().Jakob Stoklund Olesen2012-10-29
| | | | | | | | | | | | Partial copies can show up even when CoalescerPair.isPartial() returns false. For example: %vreg24:dsub_0<def> = COPY %vreg31:dsub_0; QPR:%vreg24,%vreg31 Such a partial-partial copy is not good enough for the transformation adjustCopiesBackFrom() needs to do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166944 91177308-0d34-0410-b5e6-96231b3b80d8
* Never attempt to join an early-clobber def with a regular kill.Jakob Stoklund Olesen2012-10-27
| | | | | | This fixes PR14194. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166880 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash when the Assignments vector is empty.Jakob Stoklund Olesen2012-10-21
| | | | | | Reported by Vincent Lejeune using an out-of-tree target. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166398 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r166046 "Switch back to the old coalescer for now to fix the 32 bit bit"Jakob Stoklund Olesen2012-10-16
| | | | | | A fix for PR14098, including the test case is in the next commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166067 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch back to the old coalescer for now to fix the 32 bit bitRafael Espindola2012-10-16
| | | | | | llvm+clang+compiler-rt bootstrap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166046 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove RegisterClassInfo::isReserved() and isAllocatable().Jakob Stoklund Olesen2012-10-15
| | | | | | Clients can use the equivalent functions in MRI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165990 91177308-0d34-0410-b5e6-96231b3b80d8