aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/PHIElimination.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-11-19Update SetVector to rely on the underlying set's insert to return a ↵David Blaikie1-1/+1
pair<iterator, bool> This is to be consistent with StringSet and ultimately with the standard library's associative container insert function. This lead to updating SmallSet::insert to return pair<iterator, bool>, and then to update SmallPtrSet::insert to return pair<iterator, bool>, and then to update all the existing users of those functions... llvm-svn: 222334
2014-10-14Remove unnecessary TargetMachine.h includes.Eric Christopher1-1/+0
llvm-svn: 219672
2014-08-24Use range based for loops to avoid needing to re-mention SmallPtrSet size.Craig Topper1-3/+1
llvm-svn: 216351
2014-08-05Have MachineFunction cache a pointer to the subtarget to make lookupsEric Christopher1-2/+1
shorter/easier and have the DAG use that to do the same lookup. This can be used in the future for TargetMachine based caching lookups from the MachineFunction easily. Update the MIPS subtarget switching machinery to update this pointer at the same time it runs. llvm-svn: 214838
2014-08-04Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher1-1/+3
information and update all callers. No functional change. llvm-svn: 214781
2014-04-30Convert more loops to range-based equivalentsAlexey Samsonov1-5/+7
llvm-svn: 207714
2014-04-30Convert several loops over MachineFunction basic blocks to range-based loopsAlexey Samsonov1-3/+2
llvm-svn: 207683
2014-04-22[Modules] Remove potential ODR violations by sinking the DEBUG_TYPEChandler Carruth1-1/+2
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. llvm-svn: 206837
2014-04-14[C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper1-3/+3
instead of comparing to nullptr. llvm-svn: 206142
2014-03-17Switch a number of loops in lib/CodeGen over to range-based for-loops, now thatOwen Anderson1-4/+2
the MachineRegisterInfo iterators are compatible with it. llvm-svn: 204075
2014-03-13Phase 2 of the great MachineRegisterInfo cleanup. This time, we're changingOwen Anderson1-2/+3
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. llvm-svn: 203865
2014-03-07[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-2/+2
class. llvm-svn: 203220
2014-03-02[C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer1-6/+6
Remove the old functions. llvm-svn: 202636
2014-01-22Fix typoMatt Arsenault1-1/+1
llvm-svn: 199784
2013-10-10Rename LiveRange to LiveInterval::SegmentMatthias Braun1-8/+8
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. llvm-svn: 192392
2013-08-14Auto-compute live intervals on demand.Mark Lacey1-1/+1
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. llvm-svn: 188437
2013-07-01Fix the build after r185363. Use llvm::next instead of raw next.Cameron Zwarich1-1/+1
llvm-svn: 185367
2013-07-01Fix PR16508.Cameron Zwarich1-4/+8
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. llvm-svn: 185363
2013-02-21Don't rely on the isDead() MachineOperand flag when updating LiveIntervals.Cameron Zwarich1-1/+3
llvm-svn: 175732
2013-02-21Use getInterval() instead of getOrCreateInterval().Cameron Zwarich1-1/+1
llvm-svn: 175731
2013-02-20Remove verification after PHIElimination when using LiveIntervals, and move itCameron Zwarich1-3/+0
after the two-address pass. The remaining problems in 'make check' are occurring later. llvm-svn: 175598
2013-02-20Avoid recomputing an inserted instruction's SlotIndex.Cameron Zwarich1-2/+1
llvm-svn: 175597
2013-02-20Add preservation of SlotIndexes to PHIElimination.Cameron Zwarich1-0/+1
llvm-svn: 175596
2013-02-12Don't consider definitions by other PHIs live-in when trimming a PHI source'sCameron Zwarich1-1/+5
live range after inserting a copy at the end of a block. llvm-svn: 174945
2013-02-12Fix indentation.Cameron Zwarich1-2/+2
llvm-svn: 174944
2013-02-12Add a hidden option to PHIElimination to split all critical edges. This isCameron Zwarich1-4/+9
particularly useful for catching issues with architectures that have exotic terminators like MIPS. llvm-svn: 174938
2013-02-11Add support for updating LiveIntervals to ↵Cameron Zwarich1-1/+1
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. llvm-svn: 174870
2013-02-10Abstract the liveness checking in PHIElimination::SplitPHIEdges() to supportCameron Zwarich1-2/+37
both LiveVariables and LiveIntervals. llvm-svn: 174850
2013-02-10Add support for updating LiveIntervals to PHIElimination. If LiveIntervals areCameron Zwarich1-29/+142
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. llvm-svn: 174831
2013-02-10Remove ancient references to 'atomic' phis in PHIElimination that don't reallyCameron Zwarich1-12/+8
make sense anymore. llvm-svn: 174829
2013-02-10Make LiveVariables an instance variable of PHIElimination.Cameron Zwarich1-11/+9
llvm-svn: 174828
2013-01-02Move all of the header files which are involved in modelling the LLVM IRChandler Carruth1-1/+1
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. llvm-svn: 171366
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth1-6/+6
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. =] llvm-svn: 169131
2012-07-20Split loop exiting edges more aggressively.Jakob Stoklund Olesen1-13/+56
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 llvm-svn: 160571
2012-07-04Allow multiple terminators to read virtual registers.Jakob Stoklund Olesen1-33/+29
Find the kill as the last terminator to read SrcReg. Patch by Philipp Brüschweiler! llvm-svn: 159722
2012-06-25Teach PHIElimination to handle <undef> operands.Jakob Stoklund Olesen1-19/+34
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. llvm-svn: 159121
2012-02-10RegAlloc superpass: includes phi elimination, coalescing, and scheduling.Andrew Trick1-3/+7
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. llvm-svn: 150226
2012-01-20Delete an unused member variable.Jakob Stoklund Olesen1-1/+0
llvm-svn: 148594
2011-12-06First chunk of MachineInstr bundle support.Evan Cheng1-1/+1
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 llvm-svn: 145975
2011-07-29Add an isSSA() flag to MachineRegisterInfo.Jakob Stoklund Olesen1-0/+3
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. llvm-svn: 136532
2011-04-23Remove unused STL header includes.Jay Foad1-1/+0
llvm-svn: 130068
2011-03-10Add an option to disable critical edge splitting in PHIElimination.Cameron Zwarich1-4/+12
llvm-svn: 127398
2011-02-17Adjust indenting of arguments.Cameron Zwarich1-3/+3
llvm-svn: 125727
2011-02-17Return Changed from SplitPHIEdges rather than always returning true.Cameron Zwarich1-1/+1
llvm-svn: 125726
2011-02-14Add a statistic to PHIElimination tracking the number of critical edges split.Cameron Zwarich1-2/+7
llvm-svn: 125476
2011-01-14Try for the third time to teach getFirstTerminator() about debug values.Jakob Stoklund Olesen1-2/+8
This time let's rephrase to trick gcc-4.3 into not miscompiling. llvm-svn: 123432
2011-01-14Revert r123419. It still breaks llvm-gcc-i386-linux-selfhost.Jakob Stoklund Olesen1-8/+2
llvm-svn: 123423
2011-01-14Try again to teach getFirstTerminator() about debug values.Jakob Stoklund Olesen1-2/+8
Fix some callers to better deal with debug values. llvm-svn: 123419
2011-01-13Speculatively revert r123384 to make llvm-gcc-i386-linux-selfhost buildbot ↵Devang Patel1-2/+0
happy. llvm-svn: 123389
2011-01-13Teach MachineBasicBlock::getFirstTerminator to ignore debug values.Jakob Stoklund Olesen1-0/+2
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. llvm-svn: 123384