summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a39ed7)
raw | patch | inline | side by side (parent: 8a39ed7)
author | Dan Gohman <gohman@apple.com> | |
Tue, 20 Apr 2010 00:48:35 +0000 (00:48 +0000) | ||
committer | Dan Gohman <gohman@apple.com> | |
Tue, 20 Apr 2010 00:48:35 +0000 (00:48 +0000) |
SelectionDAGBuilder, where it doesn't have to be as complicated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101848 91177308-0d34-0410-b5e6-96231b3b80d8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101848 91177308-0d34-0410-b5e6-96231b3b80d8
index 2e9a3dd59a6da7b7f55cd127260e999cbb8ef21b..202efe2f9f0a8354e71840b1056ceb49f26d5c87 100644 (file)
MBB = mbb;
}
- /// setCurDebugLoc - Set the current debug location information, which is used
- /// when creating a machine instruction.
- ///
- void setCurDebugLoc(DebugLoc dl) { DL = dl; }
-
/// getCurDebugLoc() - Return current debug location information.
DebugLoc getCurDebugLoc() const { return DL; }
index c791c45c0e05607a7f0478d920a5ea30828427eb..cd72fe7003d2a77ad8e3de25f958e4ba30fd5dd2 100644 (file)
bool
FastISel::SelectInstruction(const Instruction *I) {
+ DL = I->getDebugLoc();
+
// First, try doing target-independent selection.
- if (SelectOperator(I, I->getOpcode()))
+ if (SelectOperator(I, I->getOpcode())) {
+ DL = DebugLoc();
return true;
+ }
// Next, try calling the target to attempt to handle the instruction.
- if (TargetSelectInstruction(I))
+ if (TargetSelectInstruction(I)) {
+ DL = DebugLoc();
return true;
+ }
+ DL = DebugLoc();
return false;
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index e21bc796b95f13eb84271e8551dbf7e355d54024..470689bd06f502df10ce1ee053b631781434ab75 100644 (file)
}
void SelectionDAGBuilder::visit(const Instruction &I) {
+ CurDebugLoc = I.getDebugLoc();
+
visit(I.getOpcode(), I);
+
+ CurDebugLoc = DebugLoc();
}
void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) {
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
index 883b9b1b18b22c2fa7bc0fab3367fc0e10ac751e..1f9e43ff339299b4fb5f7e7896e23b76edee256c 100644 (file)
SDValue getControlRoot();
DebugLoc getCurDebugLoc() const { return CurDebugLoc; }
- void setCurDebugLoc(DebugLoc dl) { CurDebugLoc = dl; }
unsigned getSDNodeOrder() const { return SDNodeOrder; }
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index d47c76bbbfa64e8703377c43a8104a3d09189122..796b14d070087348c82ca970c78d483ff3e9a65f 100644 (file)
return true;
}
-/// SetDebugLoc - Update MF's and SDB's DebugLocs if debug information is
-/// attached with this instruction.
-static void SetDebugLoc(const Instruction *I, SelectionDAGBuilder *SDB,
- FastISel *FastIS, MachineFunction *MF) {
- DebugLoc DL = I->getDebugLoc();
- if (DL.isUnknown()) return;
-
- SDB->setCurDebugLoc(DL);
-
- if (FastIS)
- FastIS->setCurDebugLoc(DL);
-}
-
-/// ResetDebugLoc - Set MF's and SDB's DebugLocs to Unknown.
-static void ResetDebugLoc(SelectionDAGBuilder *SDB, FastISel *FastIS) {
- SDB->setCurDebugLoc(DebugLoc());
- if (FastIS)
- FastIS->setCurDebugLoc(DebugLoc());
-}
-
MachineBasicBlock *
SelectionDAGISel::SelectBasicBlock(MachineBasicBlock *BB,
const BasicBlock *LLVMBB,
// are handled below.
for (BasicBlock::const_iterator I = Begin;
I != End && !SDB->HasTailCall && !isa<TerminatorInst>(I);
- ++I) {
- SetDebugLoc(I, SDB, 0, MF);
+ ++I)
SDB->visit(*I);
- ResetDebugLoc(SDB, 0);
- }
if (!SDB->HasTailCall) {
// Ensure that all instructions which are used outside of their defining
HandlePHINodesInSuccessorBlocks(LLVMBB);
// Lower the terminator after the copies are emitted.
- SetDebugLoc(LLVMBB->getTerminator(), SDB, 0, MF);
SDB->visit(*LLVMBB->getTerminator());
- ResetDebugLoc(SDB, 0);
}
}
if (isa<TerminatorInst>(BI))
if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, FastIS)) {
++NumFastIselFailures;
- ResetDebugLoc(SDB, FastIS);
if (EnableFastISelVerbose || EnableFastISelAbort) {
dbgs() << "FastISel miss: ";
BI->dump();
break;
}
- SetDebugLoc(BI, SDB, FastIS, MF);
-
// Try to select the instruction with FastISel.
- if (FastIS->SelectInstruction(BI)) {
- ResetDebugLoc(SDB, FastIS);
+ if (FastIS->SelectInstruction(BI))
continue;
- }
-
- // Clear out the debug location so that it doesn't carry over to
- // unrelated instructions.
- ResetDebugLoc(SDB, FastIS);
// Then handle certain instructions as single-LLVM-Instruction blocks.
if (isa<CallInst>(BI)) {