aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-12-24LiveIntervalAnalysis: Fix performance bug that I introduced in r224663.Matthias Braun1-2/+2
Without a reference the code did not remember when moving the iterators of the subranges/registerunit ranges forward and instead would scan from the beginning again at the next position. llvm-svn: 224803
2014-12-20LiveIntervalAnalysis: No kill flags for partially undefined uses.Matthias Braun1-24/+68
We must not add kill flags when reading a vreg with some undefined subregisters, if subreg liveness tracking is enabled. This is because the register allocator may reuse these undefined subregisters for other values which are not killed. llvm-svn: 224664
2014-12-20LiveIntervalAnalysis: cleanup addKills(), NFCMatthias Braun1-19/+18
- Use more const modifiers - Use references for things that can't be nullptr - Improve some variable names llvm-svn: 224663
2014-12-18LiveIntervalAnalysis: Cleanup computeDeadValuesMatthias Braun1-24/+33
- This also fixes a bug introduced in r223880 where values were not correctly marked as Dead anymore. - Cleanup computeDeadValues(): split up SubRange code variant, simplify arguments. llvm-svn: 224538
2014-12-16LiveRangeCalc: Rewrite subrange calculationMatthias Braun1-2/+1
This changes subrange calculation to calculate subranges sequentially instead of in parallel. The code is easier to understand that way and addresses the code review issues raised about LiveOutData being hard to understand/needing more comments by removing them :) llvm-svn: 224313
2014-12-15Revert "LiveRangeCalc: Rewrite subrange calculation"Matthias Braun1-6/+14
Revert until I find out why non-subreg enabled targets break. This reverts commit 6097277eefb9c5fb35a7f493c783ee1fd1b9d6a7. llvm-svn: 224278
2014-12-15LiveRangeCalc: Rewrite subrange calculationMatthias Braun1-14/+6
This changes subrange calculation to calculate subranges sequentially instead of in parallel. The code is easier to understand that way and addresses the code review issues raised about LiveOutData being hard to understand/needing more comments by removing them :) llvm-svn: 224272
2014-12-11LiveInterval: Use range based for loops for subregister ranges.Matthias Braun1-13/+9
llvm-svn: 223991
2014-12-10LiveInterval: Use more range based for loops for value numbers and segments.Matthias Braun1-4/+2
llvm-svn: 223978
2014-12-10VirtRegMap: No implicit defs/uses for super registers with subreg liveness ↵Matthias Braun1-0/+24
tracking. Adding the implicit defs/uses to the superregisters is semantically questionable but was not dangerous before as the register allocator never assigned the same register to two overlapping LiveIntervals even when the actually live subregisters do not overlap. With subregister liveness tracking enabled this does actually happen and leads to subsequent bugs if we don't stop adding the superregister defs/uses. llvm-svn: 223892
2014-12-10LiveIntervalAnalysis: Add subregister aware variants pruneValue().Matthias Braun1-10/+20
llvm-svn: 223886
2014-12-10Add a flag to enable/disable subregister liveness.Matthias Braun1-0/+8
llvm-svn: 223884
2014-12-10LiveIntervalAnalysis: Adapt repairIntervalsInRange() to subregister liveness.Matthias Braun1-77/+92
llvm-svn: 223883
2014-12-10LiveIntervalAnalysis: Adapt handleMove() to subregister ranges.Matthias Braun1-16/+30
llvm-svn: 223881
2014-12-10LiveIntervalAnalysis: Update SubRanges in shrinkToUses().Matthias Braun1-75/+146
llvm-svn: 223880
2014-12-10LiveInterval: Add support to track liveness of subregisters.Matthias Braun1-0/+2
This code adds the required data structures. Algorithms to compute it follow. llvm-svn: 223877
2014-11-19Update SetVector to rely on the underlying set's insert to return a ↵David Blaikie1-4/+5
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-14Access the subtarget off of the MachineFunction rather thanEric Christopher1-4/+2
through the TargetMachine. llvm-svn: 219661
2014-08-04Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher1-2/+3
information and update all callers. No functional change. llvm-svn: 214781
2014-06-03Calculate dead instructions when a live interval is created.Pete Cooper1-9/+18
This gets us closer to being able to remove LiveVariables entirely which is where dead instructions are currently tagged as such. Reviewed by Jakob Olesen llvm-svn: 210132
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-6/+6
instead of comparing to nullptr. llvm-svn: 206142
2014-03-13Phase 1 of refactoring the MachineRegisterInfo iterators to make them suitableOwen Anderson1-6/+8
for use with C++11 range-based for-loops. The gist of phase 1 is to remove the skipInstruction() and skipBundle() methods from these iterators, instead splitting each iterator into a version that walks operands, a version that walks instructions, and a version that walks bundles. This has the result of making some "clever" loops in lib/CodeGen more verbose, but also makes their iterator invalidation characteristics much more obvious to the casual reader. (Making them concise again in the future is a good motivating case for a pre-incrementing range adapter!) Phase 2 of this undertaking with consist of removing the getOperand() method, and changing operator*() of the operand-walker to return a MachineOperand&. At that point, it should be possible to add range views for them that work as one might expect. llvm-svn: 203757
2014-03-02[C++11] Replace llvm::tie with std::tie.Benjamin Kramer1-2/+2
The old implementation is no longer needed in C++11. llvm-svn: 202644
2014-03-02[C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer1-10/+10
Remove the old functions. llvm-svn: 202636
2013-12-14[block-freq] Rename getEntryFrequency() -> getEntryFreq() to match ↵Michael Gottesman1-1/+1
getBlockFreq() in all *BlockFrequencyInfo*. llvm-svn: 197304
2013-12-14[block-freq] Refactor LiveInterals::getSpillWeight to use the new ↵Michael Gottesman1-3/+7
MachineBlockFrequencyInfo methods. This is slightly more interesting than the previous batch of changes. Specifically: 1. We refactor getSpillWeight to take a MachineBlockFrequencyInfo (MBFI) object. This enables us to completely encapsulate the actual manner we use the MachineBlockFrequencyInfo to get our spill weights. This yields cleaner code since one does not need to fetch the actual block frequency before getting the spill weight if all one wants it the spill weight. It also gives us access to entry frequency which we need for our computation. 2. Instead of having getSpillWeight take a MachineBasicBlock (as one might think) to look up the block frequency via the MBFI object, we instead take in a MachineInstr object. The reason for this is that the method is supposed to return the spill weight for an instruction according to the comments around the function. llvm-svn: 197296
2013-11-13Replacing HUGE_VALF with llvm::huge_valf in order to work around a warning ↵Aaron Ballman1-1/+2
triggered in MSVC 12. Patch reviewed by Reid Kleckner and Jim Grosbach. llvm-svn: 194533
2013-10-10Print register in LiveInterval::print()Matthias Braun1-2/+2
llvm-svn: 192398
2013-10-10Represent RegUnit liveness with LiveRange instanceMatthias Braun1-69/+70
Previously LiveInterval has been used, but having a spill weight and register number is unnecessary for a register unit. llvm-svn: 192397
2013-10-10Work on LiveRange instead of LiveInterval where possibleMatthias Braun1-7/+7
Also change some pointer arguments to references at some places where 0-pointers are not allowed. llvm-svn: 192396
2013-10-10Pass LiveQueryResult by valueMatthias Braun1-3/+3
This makes the API a bit more natural to use and makes it easier to make LiveRanges implementation details private. llvm-svn: 192394
2013-10-10Refactor LiveInterval: introduce new LiveRange classMatthias Braun1-18/+17
LiveRange just manages a list of segments and a list of value numbers now as LiveInterval did previously, but without having details like spill weight or a fixed register number. LiveInterval is now a subclass of LiveRange and simply adds the spill weight and the register number. llvm-svn: 192393
2013-10-10Rename LiveRange to LiveInterval::SegmentMatthias Braun1-28/+32
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-10-04Fix typoMatthias Braun1-1/+1
llvm-svn: 191964
2013-08-14Auto-compute live intervals on demand.Mark Lacey1-6/+3
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-08-14Improve misleading comment.Jakob Stoklund Olesen1-1/+1
Patch by Matthias Braun! llvm-svn: 188391
2013-06-21Added -precompute-phys-liveness for testing LiveIntervals updates.Andrew Trick1-0/+14
llvm-svn: 184573
2013-06-17Switch spill weights from a basic loop depth estimation to BlockFrequencyInfo.Benjamin Kramer1-15/+4
The main advantages here are way better heuristics, taking into account not just loop depth but also __builtin_expect and other static heuristics and will eventually learn how to use profile info. Most of the work in this patch is pushing the MachineBlockFrequencyInfo analysis into the right places. This is good for a 5% speedup on zlib's deflate (x86_64), there were some very unfortunate spilling decisions in its hottest loop in longest_match(). Other benchmarks I tried were mostly neutral. This changes register allocation in subtle ways, update the tests for it. 2012-02-20-MachineCPBug.ll was deleted as it's very fragile and the instruction it looked for was gone already (but the FileCheck pattern picked up unrelated stuff). llvm-svn: 184105
2013-05-22Simplify logic now that r182490 is in place. No functional change intended.Chad Rosier1-8/+4
llvm-svn: 182527
2013-03-08Rewrite the physreg part of findLastUseBefore().Jakob Stoklund Olesen1-24/+36
To find the last use of a register unit, start from the bottom and scan upwards until a user is found. <rdar://problem/13353090> llvm-svn: 176706
2013-02-23Make some fixes for LiveInterval repair with debug info. Debug valueCameron Zwarich1-1/+5
MachineInstrs don't have a slot index. llvm-svn: 175961
2013-02-20Find anchoring end points for repairIntervalsInRange and repairIndexesInRangeCameron Zwarich1-0/+7
automatically. llvm-svn: 175673
2013-02-20Make repairIntervalsInRange() more robust. There are now no longer any liveness-Cameron Zwarich1-15/+58
related failures when running 'make check' without LiveVariables with the verifier enabled. Some of the remaining failures elsewhere may still be fallout from incorrect updating of LiveIntervals or the few missing cases left in the two-address pass. llvm-svn: 175672
2013-02-20Add support to the two-address pass for updating LiveIntervals in many of theCameron Zwarich1-11/+40
common transformations. This includes updating repairIntervalsInRange() to handle more cases. llvm-svn: 175604
2013-02-20Add SlotIndexes::repairIndexesInRange(), which repairs SlotIndexes after addingCameron Zwarich1-0/+2
and removing instructions. The implementation seems more complicated than it needs to be, but I couldn't find something simpler that dealt with all of the corner cases. Also add a call to repairIndexesInRange() from repairIntervalsInRange(). llvm-svn: 175601
2013-02-17Remove use of reverse iterators in repairIntervalsInRange(). While they wereCameron Zwarich1-7/+12
arguably better than forward iterators for this use case, they are confusing and there are some implementation problems with reverse iterators and MI bundles. llvm-svn: 175393
2013-02-17Use ArrayRef instead of a reference to a SmallVectorImpl.Cameron Zwarich1-1/+1
llvm-svn: 175385
2013-02-17Add support for updating the LiveIntervals of registers used by 'exotic'Cameron Zwarich1-0/+36
terminators that actually have register uses when splitting critical edges. This commit also introduces a method repairIntervalsInRange() on LiveIntervals, which allows for repairing LiveIntervals in a small range after an arbitrary target hook modifies, inserts, and removes instructions. It's pretty limited right now, but I hope to extend it to support all of the things that are done by the convertToThreeAddress() target hooks. llvm-svn: 175382
2013-02-09Remove the old liveness algorithm.Jakob Stoklund Olesen1-308/+5
This is part of the plan to delete LiveVariables. llvm-svn: 174783