summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-12-10 01:12:10 +0000
committerMatthias Braun <matze@braunis.de>2014-12-10 01:12:10 +0000
commit3f1d8fdd33af8241bbd0ee0a2fa9d0d31eccd787 (patch)
tree67ffd6bed551e905735922c09ba298459cfd092c /llvm/lib/CodeGen/LiveInterval.cpp
parente62c2070927f1304d9bfa17fb5084b01acf5e68b (diff)
downloadbcm5719-llvm-3f1d8fdd33af8241bbd0ee0a2fa9d0d31eccd787.tar.gz
bcm5719-llvm-3f1d8fdd33af8241bbd0ee0a2fa9d0d31eccd787.zip
LiveInterval: Add support to track liveness of subregisters.
This code adds the required data structures. Algorithms to compute it follow. llvm-svn: 223877
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index bacd6197808..5162579adf1 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -26,6 +26,7 @@
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include <algorithm>
@@ -641,6 +642,11 @@ void LiveRange::print(raw_ostream &OS) const {
void LiveInterval::print(raw_ostream &OS) const {
OS << PrintReg(reg) << ' ';
super::print(OS);
+ // Print subranges
+ for (const_subrange_iterator I = subrange_begin(), E = subrange_end();
+ I != E; ++I) {
+ OS << format(" L%04X ", I->LaneMask) << *I;
+ }
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -669,6 +675,27 @@ void LiveRange::verify() const {
}
}
}
+
+void LiveInterval::verify(const MachineRegisterInfo *MRI) const {
+ super::verify();
+
+ // Make sure SubRanges are fine and LaneMasks are disjunct.
+ unsigned Mask = 0;
+ unsigned MaxMask = MRI != nullptr ? MRI->getMaxLaneMaskForVReg(reg) : ~0u;
+ for (const_subrange_iterator I = subrange_begin(), E = subrange_end(); I != E;
+ ++I) {
+ // Subrange lanemask should be disjunct to any previous subrange masks.
+ assert((Mask & I->LaneMask) == 0);
+ Mask |= I->LaneMask;
+
+ // subrange mask should not contained in maximum lane mask for the vreg.
+ assert((Mask & ~MaxMask) == 0);
+
+ I->verify();
+ // Main liverange should cover subrange.
+ assert(covers(*I));
+ }
+}
#endif
@@ -959,6 +986,8 @@ void ConnectedVNInfoEqClasses::Distribute(LiveInterval *LIV[],
} else
*J++ = *I;
}
+ // TODO: do not cheat anymore by simply cleaning all subranges
+ LI.clearSubRanges();
LI.segments.erase(J, E);
// Transfer VNInfos to their new owners and renumber them.
OpenPOWER on IntegriCloud