summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-10-02 21:16:50 +0000
committerEric Christopher <echristo@apple.com>2012-10-02 21:16:50 +0000
commit96bd4418b2320dec7cf9573c4f1da0a0ef31465e (patch)
tree1899e9b59191e4a1f7f54d70278b0bb063bf2d22 /lib/CodeGen
parentdf5f0fbc27923be610bed35c32ba8ba91f5699ce (diff)
downloadllvm-96bd4418b2320dec7cf9573c4f1da0a0ef31465e.tar.gz
llvm-96bd4418b2320dec7cf9573c4f1da0a0ef31465e.tar.bz2
llvm-96bd4418b2320dec7cf9573c4f1da0a0ef31465e.tar.xz
Remove the SavePoint infrastructure from fast isel, replace
with just an insert point from the MachineBasicBlock and let the location be updated as we access it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/FastISel.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index 683fac6744..818940490f 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -149,13 +149,13 @@ unsigned FastISel::getRegForValue(const Value *V) {
!FuncInfo.StaticAllocaMap.count(cast<AllocaInst>(V))))
return FuncInfo.InitializeRegForValue(V);
- SavePoint SaveInsertPt = enterLocalValueArea();
+ MachineBasicBlock::iterator SaveIter = enterLocalValueArea();
// Materialize the value in a register. Emit any instructions in the
// local value area.
Reg = materializeRegForValue(V, VT);
- leaveLocalValueArea(SaveInsertPt);
+ leaveLocalValueArea(SaveIter);
return Reg;
}
@@ -238,7 +238,16 @@ unsigned FastISel::lookUpRegForValue(const Value *V) {
DenseMap<const Value *, unsigned>::iterator I = FuncInfo.ValueMap.find(V);
if (I != FuncInfo.ValueMap.end())
return I->second;
- return LocalValueMap[V];
+ unsigned Reg = LocalValueMap[V];
+
+ // If we managed to find a register here then go ahead and replace the
+ // current location with the location we're currently emitted for,
+ // 'moving' the value to a place that's closer to where it originally
+ // started.
+ if (Reg)
+ MRI.getVRegDef(Reg)->setDebugLoc(DL);
+
+ return Reg;
}
/// UpdateValueMap - Update the value map to include the new mapping for this
@@ -316,22 +325,18 @@ void FastISel::removeDeadCode(MachineBasicBlock::iterator I,
recomputeInsertPt();
}
-FastISel::SavePoint FastISel::enterLocalValueArea() {
+MachineBasicBlock::iterator FastISel::enterLocalValueArea() {
MachineBasicBlock::iterator OldInsertPt = FuncInfo.InsertPt;
- DebugLoc OldDL = DL;
recomputeInsertPt();
- DL = DebugLoc();
- SavePoint SP = { OldInsertPt, OldDL };
- return SP;
+ return OldInsertPt;
}
-void FastISel::leaveLocalValueArea(SavePoint OldInsertPt) {
+void FastISel::leaveLocalValueArea(MachineBasicBlock::iterator I) {
if (FuncInfo.InsertPt != FuncInfo.MBB->begin())
LastLocalValue = llvm::prior(FuncInfo.InsertPt);
// Restore the previous insert position.
- FuncInfo.InsertPt = OldInsertPt.InsertPt;
- DL = OldInsertPt.DL;
+ FuncInfo.InsertPt = I;
}
/// SelectBinaryOp - Select and emit code for a binary operator instruction,