summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PHIElimination.cpp
Commit message (Collapse)AuthorAge
* Convert more loops to range-based equivalentsAlexey Samsonov2014-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207714 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert several loops over MachineFunction basic blocks to range-based loopsAlexey Samsonov2014-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207683 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Remove potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-22
| | | | | | | | | | | | define below all header includes in the lib/CodeGen/... tree. While the current modules implementation doesn't check for this kind of ODR violation yet, it is likely to grow support for it in the future. It also removes one layer of macro pollution across all the included headers. Other sub-trees will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206837 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-14
| | | | | | instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206142 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch a number of loops in lib/CodeGen over to range-based for-loops, now thatOwen Anderson2014-03-17
| | | | | | | the MachineRegisterInfo iterators are compatible with it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204075 91177308-0d34-0410-b5e6-96231b3b80d8
* Phase 2 of the great MachineRegisterInfo cleanup. This time, we're changingOwen Anderson2014-03-13
| | | | | | | | | | | operator* on the by-operand iterators to return a MachineOperand& rather than a MachineInstr&. At this point they almost behave like normal iterators! Again, this requires making some existing loops more verbose, but should pave the way for the big range-based for-loop cleanups in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203865 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-07
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203220 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-02
| | | | | | Remove the old functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202636 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typoMatt Arsenault2014-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199784 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
* Auto-compute live intervals on demand.Mark Lacey2013-08-14
| | | | | | | | | | | | | | | When new virtual registers are created during splitting/spilling, defer creation of the live interval until we need to use the live interval. Along with the recent commits to notify LiveRangeEdit when new virtual registers are created, this makes it possible for functions like TargetInstrInfo::loadRegFromStackSlot() and TargetInstrInfo::storeRegToStackSlot() to create multiple virtual registers as part of the process of generating loads/stores for different register classes, and then have the live intervals for those new registers computed when they are needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188437 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the build after r185363. Use llvm::next instead of raw next.Cameron Zwarich2013-07-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185367 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR16508.Cameron Zwarich2013-07-01
| | | | | | | | | | | | When phis get lowered, destination copies are inserted using an iterator that is determined once for all phis in the block, which BuildMI interprets as a request to insert an instruction directly before the iterator. In the case of a cyclic phi, source copies may also be inserted directly before this iterator, which can cause source copies to be inserted before destination copies. The fix is to keep an iterator to the last phi and then advance it while lowering each phi in order to insert destination copies directly after the phis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185363 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't rely on the isDead() MachineOperand flag when updating LiveIntervals.Cameron Zwarich2013-02-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175732 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getInterval() instead of getOrCreateInterval().Cameron Zwarich2013-02-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175731 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove verification after PHIElimination when using LiveIntervals, and move itCameron Zwarich2013-02-20
| | | | | | | after the two-address pass. The remaining problems in 'make check' are occurring later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175598 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid recomputing an inserted instruction's SlotIndex.Cameron Zwarich2013-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175597 91177308-0d34-0410-b5e6-96231b3b80d8
* Add preservation of SlotIndexes to PHIElimination.Cameron Zwarich2013-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175596 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't consider definitions by other PHIs live-in when trimming a PHI source'sCameron Zwarich2013-02-12
| | | | | | live range after inserting a copy at the end of a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174945 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix indentation.Cameron Zwarich2013-02-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174944 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a hidden option to PHIElimination to split all critical edges. This isCameron Zwarich2013-02-12
| | | | | | | particularly useful for catching issues with architectures that have exotic terminators like MIPS. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174938 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for updating LiveIntervals to ↵Cameron Zwarich2013-02-11
| | | | | | | | | | | | | | | MachineBasicBlock::SplitCriticalEdge(). This is currently a bit hairier than it needs to be, since depending on where the split block resides the end ListEntry of the split block may be the end ListEntry of the original block or a new entry. Some changes to the SlotIndexes updating should make it possible to eliminate the two cases here. This also isn't as optimized as it could be. In the future Liveinterval should probably get a flag that indicates whether the LiveInterval is within a single basic block. We could ignore all such intervals when splitting an edge. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174870 91177308-0d34-0410-b5e6-96231b3b80d8
* Abstract the liveness checking in PHIElimination::SplitPHIEdges() to supportCameron Zwarich2013-02-10
| | | | | | both LiveVariables and LiveIntervals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174850 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for updating LiveIntervals to PHIElimination. If LiveIntervals areCameron Zwarich2013-02-10
| | | | | | | | | | | | | | | | | | | present, it currently verifies them with the MachineVerifier, and this passed all of the test cases in 'make check' (when accounting for existing verifier errors). There were some assertion failures in the two-address pass, but they also happened on code without phis and look like they are caused by different kill flags from LiveIntervals. The only part that doesn't work is the critical edge splitting heuristic, because there isn't currently an efficient way to update LiveIntervals after splitting an edge. I'll probably start by implementing the slow fallback and test that it works before tackling the fast path for single-block ranges. The existing code that updates LiveVariables is fairly slow as it is. There isn't a command-line option for enabling this; instead, just edit PHIElimination.cpp to require LiveIntervals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174831 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove ancient references to 'atomic' phis in PHIElimination that don't reallyCameron Zwarich2013-02-10
| | | | | | make sense anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174829 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LiveVariables an instance variable of PHIElimination.Cameron Zwarich2013-02-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174828 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
* Split loop exiting edges more aggressively.Jakob Stoklund Olesen2012-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PHIElimination splits critical edges when it predicts it can resolve interference and eliminate copies. It doesn't split the edge if the interference wouldn't be resolved anyway because the phi-use register is live in the critical edge anyway. Teach PHIElimination to split loop exiting edges with interference, even if it wouldn't resolve the interference. This removes the necessary copies from the loop, which is still an improvement from injecting the copies into the loop. The test case demonstrates the improvement. Before: LBB0_1: cmpb $0, (%rdx) leaq 1(%rdx), %rdx movl %esi, %eax je LBB0_1 After: LBB0_1: cmpb $0, (%rdx) leaq 1(%rdx), %rdx je LBB0_1 movl %esi, %eax git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160571 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow multiple terminators to read virtual registers.Jakob Stoklund Olesen2012-07-04
| | | | | | | | Find the kill as the last terminator to read SrcReg. Patch by Philipp Brüschweiler! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159722 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach PHIElimination to handle <undef> operands.Jakob Stoklund Olesen2012-06-25
| | | | | | | | | When a PHI use is <undef>, don't emit a copy in the predecessor block, but insert an IMPLICIT_DEF instruction instead. This ensures that virtual register uses are always jointly dominated by defs, even if some of them are IMPLICIT_DEF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159121 91177308-0d34-0410-b5e6-96231b3b80d8
* RegAlloc superpass: includes phi elimination, coalescing, and scheduling.Andrew Trick2012-02-10
| | | | | | | | | | | | | | | | Creates a configurable regalloc pipeline. Ensure specific llc options do what they say and nothing more: -reglloc=... has no effect other than selecting the allocator pass itself. This patch introduces a new umbrella flag, "-optimize-regalloc", to enable/disable the optimizing regalloc "superpass". This allows for example testing coalscing and scheduling under -O0 or vice-versa. When a CodeGen pass requires the MachineFunction to have a particular property, we need to explicitly define that property so it can be directly queried rather than naming a specific Pass. For example, to check for SSA, use MRI->isSSA, not addRequired<PHIElimination>. CodeGen transformation passes are never "required" as an analysis ProcessImplicitDefs does not require LiveVariables. We have a plan to massively simplify some of the early passes within the regalloc superpass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150226 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete an unused member variable.Jakob Stoklund Olesen2012-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148594 91177308-0d34-0410-b5e6-96231b3b80d8
* First chunk of MachineInstr bundle support.Evan Cheng2011-12-06
| | | | | | | | | | 1. Added opcode BUNDLE 2. Taught MachineInstr class to deal with bundled MIs 3. Changed MachineBasicBlock iterator to skip over bundled MIs; added an iterator to walk all the MIs 4. Taught MachineBasicBlock methods about bundled MIs git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145975 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an isSSA() flag to MachineRegisterInfo.Jakob Stoklund Olesen2011-07-29
| | | | | | | | | | | | | This flag is true from isel to register allocation when the machine function is required to be in SSA form. The TwoAddressInstructionPass and PHIElimination passes clear the flag. The SSA flag wil be used by the machine code verifier to check for SSA form, and eventually an assertion can enforce it in +Asserts builds. This will catch the common target error of creating machine code with multiple defs of a virtual register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136532 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused STL header includes.Jay Foad2011-04-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130068 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an option to disable critical edge splitting in PHIElimination.Cameron Zwarich2011-03-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127398 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust indenting of arguments.Cameron Zwarich2011-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125727 91177308-0d34-0410-b5e6-96231b3b80d8
* Return Changed from SplitPHIEdges rather than always returning true.Cameron Zwarich2011-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125726 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a statistic to PHIElimination tracking the number of critical edges split.Cameron Zwarich2011-02-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125476 91177308-0d34-0410-b5e6-96231b3b80d8
* Try for the third time to teach getFirstTerminator() about debug values.Jakob Stoklund Olesen2011-01-14
| | | | | | This time let's rephrase to trick gcc-4.3 into not miscompiling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123432 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r123419. It still breaks llvm-gcc-i386-linux-selfhost.Jakob Stoklund Olesen2011-01-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123423 91177308-0d34-0410-b5e6-96231b3b80d8
* Try again to teach getFirstTerminator() about debug values.Jakob Stoklund Olesen2011-01-14
| | | | | | Fix some callers to better deal with debug values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123419 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculatively revert r123384 to make llvm-gcc-i386-linux-selfhost buildbot ↵Devang Patel2011-01-13
| | | | | | happy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123389 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach MachineBasicBlock::getFirstTerminator to ignore debug values.Jakob Stoklund Olesen2011-01-13
| | | | | | | It will still return an iterator that points to the first terminator or end(), but there may be DBG_VALUE instructions following the first terminator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123384 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace TargetRegisterInfo::printReg with a PrintReg class that also works ↵Jakob Stoklund Olesen2011-01-09
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123107 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the PHIElimination.h header, as it is no longer needed.Cameron Zwarich2010-12-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120959 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the FindCopyInsertPoint method of PHIElimination to a new standaloneCameron Zwarich2010-12-05
| | | | | | | function so that it can be shared with StrongPHIElimination. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120951 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove PHIElimination's private copy of SkipPHIsAndLabels.Cameron Zwarich2010-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120918 91177308-0d34-0410-b5e6-96231b3b80d8
* Now with fewer extraneous semicolons!Owen Anderson2010-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8