summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalUnion.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-17 04:09:47 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-12-17 04:09:47 +0000
commit9c7f3a46d80d99b0d3238dfe07b8622415edfdcd (patch)
tree57a54b4969aa3bb13bf0b845f4cd377ee71805d7 /llvm/lib/CodeGen/LiveIntervalUnion.cpp
parent09982c0a49d4e5bead417b64365f58987536d878 (diff)
downloadbcm5719-llvm-9c7f3a46d80d99b0d3238dfe07b8622415edfdcd.tar.gz
bcm5719-llvm-9c7f3a46d80d99b0d3238dfe07b8622415edfdcd.zip
Provide LiveIntervalUnion::Query::checkLoopInterference.
This is a three-way interval list intersection between a virtual register, a live interval union, and a loop. It will be used to identify interference-free loops for live range splitting. llvm-svn: 122034
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalUnion.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalUnion.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalUnion.cpp b/llvm/lib/CodeGen/LiveIntervalUnion.cpp
index 079468a4f03..7ebe96f0660 100644
--- a/llvm/lib/CodeGen/LiveIntervalUnion.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalUnion.cpp
@@ -16,6 +16,7 @@
#define DEBUG_TYPE "regalloc"
#include "LiveIntervalUnion.h"
#include "llvm/ADT/SparseBitVector.h"
+#include "llvm/CodeGen/MachineLoopRanges.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetRegisterInfo.h"
@@ -284,3 +285,30 @@ collectInterferingVRegs(unsigned MaxInterferingRegs) {
SeenAllInterferences = true;
return InterferingVRegs.size();
}
+
+bool LiveIntervalUnion::Query::checkLoopInterference(MachineLoopRange *Loop) {
+ // VirtReg is likely live throughout the loop, so start by checking LIU-Loop
+ // overlaps.
+ IntervalMapOverlaps<LiveIntervalUnion::Map, MachineLoopRange::Map>
+ Overlaps(LiveUnion->getMap(), Loop->getMap());
+ if (!Overlaps.valid())
+ return false;
+
+ // The loop is overlapping an LIU assignment. Check VirtReg as well.
+ LiveInterval::iterator VRI = VirtReg->find(Overlaps.start());
+
+ for (;;) {
+ if (VRI == VirtReg->end())
+ return false;
+ if (VRI->start < Overlaps.stop())
+ return true;
+
+ Overlaps.advanceTo(VRI->start);
+ if (!Overlaps.valid())
+ return false;
+ if (Overlaps.start() < VRI->end)
+ return true;
+
+ VRI = VirtReg->advanceTo(VRI, Overlaps.start());
+ }
+}
OpenPOWER on IntegriCloud