summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SplitKit.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-08-02 22:37:22 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-08-02 22:37:22 +0000
commitae8027cc95f48d4044ec681823e081ec575e797c (patch)
treed42a75c7fb62e14246443c994240ed5df9db739f /llvm/lib/CodeGen/SplitKit.cpp
parentf047ff4fe109c5441d2e142bd01056aeb8f35e84 (diff)
downloadbcm5719-llvm-ae8027cc95f48d4044ec681823e081ec575e797c.tar.gz
bcm5719-llvm-ae8027cc95f48d4044ec681823e081ec575e797c.zip
Add a BlockInfo::FirstDef field.
This is either an invalid SlotIndex, or valno->def for the first value defined inside the block. PHI values are not counted as defined inside the block. The FirstDef field will be used when estimating the cost of spilling around a block. llvm-svn: 136736
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r--llvm/lib/CodeGen/SplitKit.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp
index 0679a619f5c..45b976ca25b 100644
--- a/llvm/lib/CodeGen/SplitKit.cpp
+++ b/llvm/lib/CodeGen/SplitKit.cpp
@@ -188,6 +188,13 @@ bool SplitAnalysis::calcLiveBlockInfo() {
// LVI is the first live segment overlapping MBB.
BI.LiveIn = LVI->start <= Start;
+ // When not live in, the first use should be a def.
+ if (!BI.LiveIn) {
+ assert(LVI->start == LVI->valno->def && "Dangling LiveRange start");
+ assert(LVI->start == BI.FirstUse && "First instr should be a def");
+ BI.FirstDef = BI.FirstUse;
+ }
+
// Look for gaps in the live range.
BI.LiveOut = true;
while (LVI->end < Stop) {
@@ -197,6 +204,7 @@ bool SplitAnalysis::calcLiveBlockInfo() {
BI.LastUse = LastStop;
break;
}
+
if (LastStop < LVI->start) {
// There is a gap in the live range. Create duplicate entries for the
// live-in snippet and the live-out snippet.
@@ -210,8 +218,13 @@ bool SplitAnalysis::calcLiveBlockInfo() {
// Set up BI for the live-out part.
BI.LiveIn = false;
BI.LiveOut = true;
- BI.FirstUse = LVI->start;
+ BI.FirstUse = BI.FirstDef = LVI->start;
}
+
+ // A LiveRange that starts in the middle of the block must be a def.
+ assert(LVI->start == LVI->valno->def && "Dangling LiveRange start");
+ if (!BI.FirstDef)
+ BI.FirstDef = LVI->start;
}
UseBlocks.push_back(BI);
OpenPOWER on IntegriCloud