summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-08-26 05:01:18 +0000
committerDevang Patel <dpatel@apple.com>2009-08-26 05:01:18 +0000
commit824598883513789516a919651f4b35e7a638ec5c (patch)
tree5a87b0b92a0c718d5f87d80b51cc4a6b9251eb63 /lib/CodeGen/SelectionDAG
parentbe1f788676ff6a71bc0324ac38af7626fdcf92b2 (diff)
downloadllvm-824598883513789516a919651f4b35e7a638ec5c.tar.gz
llvm-824598883513789516a919651f4b35e7a638ec5c.tar.bz2
llvm-824598883513789516a919651f4b35e7a638ec5c.tar.xz
Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/FastISel.cpp15
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp12
4 files changed, 20 insertions, 17 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index 5b4c79a9fd..4c60b29e91 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -335,7 +335,7 @@ bool FastISel::SelectCall(User *I) {
if (isValidDebugInfoIntrinsic(*RSI, CodeGenOpt::None) && DW
&& DW->ShouldEmitDwarfDebug()) {
unsigned ID =
- DW->RecordRegionStart(RSI->getContext());
+ DW->RecordRegionStart(cast<GlobalVariable>(RSI->getContext()));
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
BuildMI(MBB, DL, II).addImm(ID);
}
@@ -346,7 +346,7 @@ bool FastISel::SelectCall(User *I) {
if (isValidDebugInfoIntrinsic(*REI, CodeGenOpt::None) && DW
&& DW->ShouldEmitDwarfDebug()) {
unsigned ID = 0;
- DISubprogram Subprogram(REI->getContext());
+ DISubprogram Subprogram(cast<GlobalVariable>(REI->getContext()));
if (isInlinedFnEnd(*REI, MF.getFunction())) {
// This is end of an inlined function.
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
@@ -359,7 +359,7 @@ bool FastISel::SelectCall(User *I) {
BuildMI(MBB, DL, II).addImm(ID);
} else {
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
- ID = DW->RecordRegionEnd(REI->getContext());
+ ID = DW->RecordRegionEnd(cast<GlobalVariable>(REI->getContext()));
BuildMI(MBB, DL, II).addImm(ID);
}
}
@@ -384,7 +384,7 @@ bool FastISel::SelectCall(User *I) {
setCurDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo()));
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
- DISubprogram SP(FSI->getSubprogram());
+ DISubprogram SP(cast<GlobalVariable>(FSI->getSubprogram()));
unsigned LabelID = DW->RecordInlinedFnStart(SP,
DICompileUnit(PrevLocTpl.CompileUnit),
PrevLocTpl.Line,
@@ -398,7 +398,7 @@ bool FastISel::SelectCall(User *I) {
MF.setDefaultDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo()));
// llvm.dbg.func_start also defines beginning of function scope.
- DW->RecordRegionStart(FSI->getSubprogram());
+ DW->RecordRegionStart(cast<GlobalVariable>(FSI->getSubprogram()));
return true;
}
case Intrinsic::dbg_declare: {
@@ -419,7 +419,10 @@ bool FastISel::SelectCall(User *I) {
if (SI == StaticAllocaMap.end()) break; // VLAs.
int FI = SI->second;
- DW->RecordVariable(cast<MDNode>(Variable), FI);
+ // Determine the debug globalvariable.
+ GlobalValue *GV = cast<GlobalVariable>(Variable);
+
+ DW->RecordVariable(cast<GlobalVariable>(GV), FI);
return true;
}
case Intrinsic::eh_exception: {
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 8016d7bb6b..10f7b3206b 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1593,9 +1593,9 @@ SDValue SelectionDAGLegalize::ExpandDBG_STOPPOINT(SDNode* Node) {
bool useLABEL = TLI.isOperationLegalOrCustom(ISD::DBG_LABEL, MVT::Other);
const DbgStopPointSDNode *DSP = cast<DbgStopPointSDNode>(Node);
- MDNode *CU_Node = DSP->getCompileUnit();
- if (DW && (useDEBUG_LOC || useLABEL)) {
- DICompileUnit CU(CU_Node);
+ GlobalVariable *CU_GV = cast<GlobalVariable>(DSP->getCompileUnit());
+ if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) {
+ DICompileUnit CU(cast<GlobalVariable>(DSP->getCompileUnit()));
unsigned Line = DSP->getLine();
unsigned Col = DSP->getColumn();
@@ -1607,7 +1607,7 @@ SDValue SelectionDAGLegalize::ExpandDBG_STOPPOINT(SDNode* Node) {
return DAG.getNode(ISD::DEBUG_LOC, dl, MVT::Other, Node->getOperand(0),
DAG.getConstant(Line, MVT::i32),
DAG.getConstant(Col, MVT::i32),
- DAG.getSrcValue(CU.getNode()));
+ DAG.getSrcValue(CU.getGV()));
} else {
unsigned ID = DW->RecordSourceLine(Line, Col, CU);
return DAG.getLabel(ISD::DBG_LABEL, dl, Node->getOperand(0), ID);
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 11f12c9475..ee58d2effd 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1286,7 +1286,7 @@ SDValue SelectionDAG::getRegister(unsigned RegNo, EVT VT) {
SDValue SelectionDAG::getDbgStopPoint(DebugLoc DL, SDValue Root,
unsigned Line, unsigned Col,
- MDNode *CU) {
+ Value *CU) {
SDNode *N = NodeAllocator.Allocate<DbgStopPointSDNode>();
new (N) DbgStopPointSDNode(Root, Line, Col, CU);
N->setDebugLoc(DL);
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 0a161d0dca..a4cd009bd9 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -3876,7 +3876,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
if (isValidDebugInfoIntrinsic(RSI, OptLevel) && DW
&& DW->ShouldEmitDwarfDebug()) {
unsigned LabelID =
- DW->RecordRegionStart(RSI.getContext());
+ DW->RecordRegionStart(cast<GlobalVariable>(RSI.getContext()));
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
getRoot(), LabelID));
}
@@ -3891,7 +3891,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
return 0;
MachineFunction &MF = DAG.getMachineFunction();
- DISubprogram Subprogram(REI.getContext());
+ DISubprogram Subprogram(cast<GlobalVariable>(REI.getContext()));
if (isInlinedFnEnd(REI, MF.getFunction())) {
// This is end of inlined function. Debugging information for inlined
@@ -3910,7 +3910,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
}
unsigned LabelID =
- DW->RecordRegionEnd(REI.getContext());
+ DW->RecordRegionEnd(cast<GlobalVariable>(REI.getContext()));
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
getRoot(), LabelID));
return 0;
@@ -3942,7 +3942,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
if (!DW || !DW->ShouldEmitDwarfDebug())
return 0;
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
- DISubprogram SP(FSI.getSubprogram());
+ DISubprogram SP(cast<GlobalVariable>(FSI.getSubprogram()));
DICompileUnit CU(PrevLocTpl.CompileUnit);
unsigned LabelID = DW->RecordInlinedFnStart(SP, CU,
PrevLocTpl.Line,
@@ -3958,7 +3958,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
if (!DW || !DW->ShouldEmitDwarfDebug())
return 0;
// llvm.dbg.func_start also defines beginning of function scope.
- DW->RecordRegionStart(FSI.getSubprogram());
+ DW->RecordRegionStart(cast<GlobalVariable>(FSI.getSubprogram()));
return 0;
}
case Intrinsic::dbg_declare: {
@@ -3981,7 +3981,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
if (!AI)
return 0;
int FI = FuncInfo.StaticAllocaMap[AI];
- DW->RecordVariable(cast<MDNode>(Variable), FI);
+ DW->RecordVariable(cast<GlobalVariable>(Variable), FI);
return 0;
}
case Intrinsic::eh_exception: {