aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveInterval.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-04-18[NFC] Header cleanupMehdi Amini1-1/+0
Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
2016-03-24LiveInterval: Fix Distribute() failing on liveranges with unused VNInfosMatthias Braun1-8/+13
This fixes http://llvm.org/PR26991 llvm-svn: 264345
2016-02-27CodeGen: Take MachineInstr& in SlotIndexes and LiveIntervals, NFCDuncan P. N. Exon Smith1-6/+6
Take MachineInstr by reference instead of by pointer in SlotIndexes and the SlotIndex wrappers in LiveIntervals. The MachineInstrs here are never null, so this cleans up the API a bit. It also incidentally removes a few implicit conversions from MachineInstrBundleIterator to MachineInstr* (see PR26753). At a couple of call sites it was convenient to convert to a range-based for loop over MachineBasicBlock::instr_begin/instr_end, so I added MachineBasicBlock::instrs. llvm-svn: 262115
2016-02-18Remove uses of builtin comma operator.Richard Trieu1-3/+5
Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261270
2016-02-08[regalloc][WinEH] Do not mark intervals as not spillable if they contain a ↵Andrew Kaylor1-0/+34
regmask Differential Revision: http://reviews.llvm.org/D16831 llvm-svn: 260164
2016-01-29Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren1-5/+4
r259192 post commit comment. clang part in r259232, this is the LLVM part of the patch. llvm-svn: 259240
2016-01-20LiveInterval: Add utility class to rename independent subregister usageMatthias Braun1-0/+183
This renaming is necessary to avoid a subregister aware scheduler accidentally creating liveness "holes" which are rejected by the MachineVerifier. Explanation as found in this patch: Helper class that can divide MachineOperands of a virtual register into equivalence classes of connected components. MachineOperands belong to the same equivalence class when they are part of the same SubRange segment or adjacent segments (adjacent in control flow); Different subranges affected by the same MachineOperand belong to the same equivalence class. Example: vreg0:sub0 = ... vreg0:sub1 = ... vreg0:sub2 = ... ... xxx = op vreg0:sub1 vreg0:sub1 = ... store vreg0:sub0_sub1 The example contains 3 different equivalence classes: - One for the (dead) vreg0:sub2 definition - One containing the first vreg0:sub1 definition and its use, but not the second definition! - The remaining class contains all other operands involving vreg0. We provide a utility function here to rename disjunct classes to different virtual registers. Differential Revision: http://reviews.llvm.org/D16126 llvm-svn: 258257
2016-01-08LiveInterval: A LiveRange is enough for ConnectedVNInfoEqClasses::Classify()Matthias Braun1-5/+5
llvm-svn: 257129
2015-09-25TargetRegisterInfo: Introduce PrintLaneMask.Matthias Braun1-2/+1
This makes it more convenient to print lane masks and lead to more uniform printing. llvm-svn: 248624
2015-09-25TargetRegisterInfo: Add typedef unsigned LaneBitmask and use it where ↵Matthias Braun1-4/+4
apropriate; NFC llvm-svn: 248623
2015-09-24Fix typoMatt Arsenault1-1/+1
llvm-svn: 248549
2015-09-22LiveInterval: Distribute subregister liveranges to new intervals in ↵Matthias Braun1-29/+65
ConnectedVNInfoEqClasses::Distribute() This improves ConnectedVNInfoEqClasses::Distribute() to distribute the segments and value numbers in the subranges instead of conservatively clearing all subregister info. No separate test here, just clearing the subrange instead of properly distributing them would however break my upcoming fix regarding dead super register definitions. Differential Revision: http://reviews.llvm.org/D13075 llvm-svn: 248334
2015-09-22LiveIntervalAnalysis: Factor common code into splitSeparateComponents; NFCMatthias Braun1-9/+7
llvm-svn: 248241
2015-07-16LiveInterval: Document and enforce rules about empty subranges.Matthias Braun1-0/+2
Empty subranges are not allowed in a LiveInterval and must be removed instead: Check this in the verifiers, put a reminder for this in the comment of the shrinkToUses variant for a single lane and make it automatic for the shrinkToUses variant for a LiveInterval. llvm-svn: 242431
2015-04-08Oops, didn't mean to commit my debug fprintfsMatthias Braun1-4/+1
llvm-svn: 234385
2015-04-08LiveInterval: Fix computeFromMainRange() producing adjacent segments with ↵Matthias Braun1-14/+45
same valno If two livesegments from different subranges happened to have the same definition they could possibly end up as two adjacent segments in the main liverange with the same value number which is not allowed. Detect such cases and fix them in the 2nd pass of computeFromMainRange() if necessary. No testcase as there is only an out-of-tree target where I can sensibly come up with one. llvm-svn: 234382
2015-03-23Move private classes into anonymous namespacesBenjamin Kramer1-0/+2
NFC. llvm-svn: 232944
2015-03-04Recommit r231168: unique_ptrify LiveRange::segmentSetDavid Blaikie1-1/+0
GCC 4.7's libstdc++ doesn't have std::map::emplace, but it does have std::unordered_map::emplace, and the use case here doesn't appear to need ordering. The container has been changed in a separate/precursor patch, and now this patch should hopefully build cleanly even with GCC 4.7. & then I realized the order of the container did matter, so extra handling of ordering was added in r231189. Original commit message: This makes LiveRange non-copyable, and LiveInterval is already non-movable (due to the explicit dtor), so now it's non-copyable and non-movable. Fix the one case where we were relying on the (deprecated in C++11) implicit copy ctor of LiveInterval (which happened to work because the ctor created an object with a null segmentSet, so double-deleting the null pointer was fine). llvm-svn: 231192
2015-03-04Revert "unique_ptrify LiveRange::segmentSet"David Blaikie1-0/+1
Apparently something does care about ordering of LiveIntervals... so revert all that stuff (r231175, r231176, r231177) & take some time to re-evaluate. llvm-svn: 231184
2015-03-03Recommit r231168: unique_ptrify LiveRange::segmentSetDavid Blaikie1-1/+0
GCC 4.7's libstdc++ doesn't have std::map::emplace, but it does have std::unordered_map::emplace, and the use case here doesn't appear to need ordering. The container has been changed in a separate/precursor patch, and now this patch should hopefully build cleanly even with GCC 4.7. Original commit message: This makes LiveRange non-copyable, and LiveInterval is already non-movable (due to the explicit dtor), so now it's non-copyable and non-movable. Fix the one case where we were relying on the (deprecated in C++11) implicit copy ctor of LiveInterval (which happened to work because the ctor created an object with a null segmentSet, so double-deleting the null pointer was fine). llvm-svn: 231176
2015-03-03Revert "unique_ptrify LiveRange::segmentSet"David Blaikie1-0/+1
GCC 4.7 *shakes fist* (doesn't have std::map::emplace... ) This reverts commit r231168. llvm-svn: 231173
2015-03-03unique_ptrify LiveRange::segmentSetDavid Blaikie1-1/+0
This makes LiveRange non-copyable, and LiveInterval is already non-movable (due to the explicit dtor), so now it's non-copyable and non-movable. Fix the one case where we were relying on the (deprecated in C++11) implicit copy ctor of LiveInterval (which happened to work because the ctor created an object with a null segmentSet, so double-deleting the null pointer was fine). llvm-svn: 231168
2015-03-03Revert "Remove the explicit SDNodeIterator::operator= in favor of the ↵David Blaikie1-0/+1
implicit default" Accidentally committed a few more of these cleanup changes than intended. Still breaking these out & tidying them up. This reverts commit r231135. llvm-svn: 231136
2015-03-03Remove the explicit SDNodeIterator::operator= in favor of the implicit defaultDavid Blaikie1-1/+0
There doesn't seem to be any need to assert that iterator assignment is between iterators over the same node - if you want to reuse an iterator variable to iterate another node, that's perfectly acceptable. Just don't mix comparisons between iterators into disjoint sequences, as usual. llvm-svn: 231135
2015-02-28LiveRange: Replace a creative vector erase loop with std::remove_if.Benjamin Kramer1-7/+3
I didn't see this so far because it scans backwards, but that doesn't make it any less quadratic. NFC. llvm-svn: 230863
2015-02-18LiveRangeCalc: Rename some parameters from kill to use, NFC.Matthias Braun1-4/+4
Those parameters did not necessarily describe kill points but just uses. llvm-svn: 229601
2015-02-06[LiveIntervalAnalysis] Speed up creation of live ranges for physical registersQuentin Colombet1-142/+303
by using a segment set. The patch addresses a compile-time performance regression in the LiveIntervals analysis pass (see http://llvm.org/bugs/show_bug.cgi?id=18580). This regression is especially critical when compiling long functions. Our analysis had shown that the most of time is taken for generation of live intervals for physical registers. Insertions in the middle of the array of live ranges cause quadratic algorithmic complexity, which is apparently the main reason for the slow-down. Overview of changes: - The patch introduces an additional std::set<Segment>* member in LiveRange for storing segments in the phase of initial creation. The set is used if this member is not NULL, otherwise everything works the old way. - The set of operations on LiveRange used during initial creation (i.e. used by createDeadDefs and extendToUses) have been reimplemented to use the segment set if it is available. - After a live range is created the contents of the set are flushed to the segment vector, because the set is not as efficient as the vector for the later uses of the live range. After the flushing, the set is deleted and cannot be used again. - The set is only for live ranges computed in LiveIntervalAnalysis::computeLiveInRegUnits() and getRegUnit() but not in computeVirtRegs(), because I did not bring any performance benefits to computeVirtRegs() and for some examples even brought a slow down. Patch by Vaidas Gasiunas <vaidas.gasiunas@sap.com> Differential Revision: http://reviews.llvm.org/D6013 llvm-svn: 228421
2015-02-06LiveInterval: Fix SubRange memory leak.Matthias Braun1-1/+16
llvm-svn: 228405
2015-01-07LiveInterval: Implement feedback by Quentin Colombet.Matthias Braun1-25/+32
llvm-svn: 225413
2014-12-24LiveInterval: Remove accidentally committed debug code.Matthias Braun1-10/+0
llvm-svn: 224807
2014-12-24LiveInterval: Introduce createMainRangeFromSubranges().Matthias Braun1-0/+214
This function constructs the main liverange by merging all subranges if subregister liveness tracking is available. This should be slightly faster to compute instead of performing the liveness calculation again for the main range. More importantly it avoids cases where the main liverange would cover positions where no subrange was live. These cases happened for partial definitions where the actual defined part was dead and only the undefined parts used later. The register coalescing requires that every part covered by the main live range has at least one subrange live. I also expect this function to become usefull later for places where the subranges are modified in a way that it is hard to correctly fix the main liverange in the machine scheduler, we can simply reconstruct it from subranges then. llvm-svn: 224806
2014-12-11LiveInterval: Use range based for loops for subregister ranges.Matthias Braun1-9/+7
llvm-svn: 223991
2014-12-10LiveInterval: Use more range based for loops for value numbers and segments.Matthias Braun1-28/+26
llvm-svn: 223978
2014-12-10LiveInterval: Add removeEmptySubRanges().Matthias Braun1-0/+17
llvm-svn: 223887
2014-12-10LiveInterval: Add support to track liveness of subregisters.Matthias Braun1-0/+29
This code adds the required data structures. Algorithms to compute it follow. llvm-svn: 223877
2014-12-10LiveInterval: Add a 'covers' operation to LiveRange.Matthias Braun1-0/+21
llvm-svn: 223876
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-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 2 of the great MachineRegisterInfo cleanup. This time, we're changingOwen Anderson1-2/+2
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-02[C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer1-11/+11
Remove the old functions. llvm-svn: 202636
2013-10-10Print register in LiveInterval::print()Matthias Braun1-0/+9
llvm-svn: 192398
2013-10-10Pass LiveQueryResult by valueMatthias Braun1-1/+1
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-98/+92
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-112/+110
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-09-06avoid unnecessary direct access to LiveInterval::rangesMatthias Braun1-24/+23
llvm-svn: 190170
2013-09-06remove unused argument from LiveRanges::join()Matthias Braun1-2/+1
llvm-svn: 190169
2013-08-14Remove unnecessary parameter to RenumberValues.Jakob Stoklund Olesen1-1/+1
Patch by Matthias Braun! llvm-svn: 188393
2013-07-11Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector ↵Craig Topper1-1/+1
size. llvm-svn: 186098
2013-05-23Fix PR16110: Handle DBG_VALUE in ConnectedVNInfoEqClasses::Distribute().Jakob Stoklund Olesen1-2/+10
Now that the LiveDebugVariables pass is running *after* register coalescing, the ConnectedVNInfoEqClasses class needs to deal with DBG_VALUE instructions. This only comes up when rematerialization during coalescing causes the remaining live range of a virtual register to separate into two connected components. llvm-svn: 182592
2013-02-20Don't allocate memory in LiveInterval::join().Jakob Stoklund Olesen1-10/+7
Rewrite value numbers directly in the 'Other' LiveInterval which is moribund anyway. This avoids allocating the OtherAssignments vector. llvm-svn: 175690