summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-10-01 01:03:26 +0000
committerDevang Patel <dpatel@apple.com>2009-10-01 01:03:26 +0000
commit4dbca6dfd4d76d070c7d43337e74c8d532c5ac53 (patch)
treee7cd9b26aad8e1a10254ec523b63596fc64f5fc7 /llvm/lib/CodeGen/SelectionDAG
parenta6c56bb849e99c1539eae5960f5b1a2404b971d4 (diff)
downloadbcm5719-llvm-4dbca6dfd4d76d070c7d43337e74c8d532c5ac53.tar.gz
bcm5719-llvm-4dbca6dfd4d76d070c7d43337e74c8d532c5ac53.zip
If location info is attached with an instruction then keep track of alloca slots used by a variable. This info will be used by AsmPrinter to emit debug info for variables.
llvm-svn: 83189
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 54544a4d149..0bec2cf9b1f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -407,7 +407,6 @@ bool FastISel::SelectCall(User *I) {
|| !DW->ShouldEmitDwarfDebug())
return true;
- Value *Variable = DI->getVariable();
Value *Address = DI->getAddress();
if (BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
Address = BCI->getOperand(0);
@@ -418,8 +417,15 @@ bool FastISel::SelectCall(User *I) {
StaticAllocaMap.find(AI);
if (SI == StaticAllocaMap.end()) break; // VLAs.
int FI = SI->second;
-
- DW->RecordVariable(cast<MDNode>(Variable), FI);
+ if (MMI) {
+ MetadataContext &TheMetadata = AI->getContext().getMetadata();
+ unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
+ MDNode *AllocaLocation =
+ dyn_cast_or_null<MDNode>(TheMetadata.getMD(MDDbgKind, AI));
+ if (AllocaLocation)
+ MMI->setVariableDbgInfo(DI->getVariable(), AllocaLocation, FI);
+ }
+ DW->RecordVariable(DI->getVariable(), FI);
return true;
}
case Intrinsic::eh_exception: {
OpenPOWER on IntegriCloud