diff options
author | Reid Kleckner <rnk@google.com> | 2017-05-09 19:59:29 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-05-09 19:59:29 +0000 |
commit | b5fced732416c1d9a2ffa1980ca1af88c06edd83 (patch) | |
tree | be7f854f4fcb5399e43b0ae77e0a09b625dfbb66 /llvm/lib/CodeGen/AsmPrinter | |
parent | dfa7f613ed7ca025d6d4d2ea85073f6ddaa9f712 (diff) | |
download | bcm5719-llvm-b5fced732416c1d9a2ffa1980ca1af88c06edd83.tar.gz bcm5719-llvm-b5fced732416c1d9a2ffa1980ca1af88c06edd83.zip |
[codeview] Check for a DIExpression offset for local variables
Fixes inalloca parameters, which previously all pointed to the same
offset. Extend the test to use llvm-readobj so that we can test the
offset in a readable way.
llvm-svn: 302578
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 87b45c001de..9d60fff3bcc 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -888,13 +888,21 @@ void CodeViewDebug::collectVariableInfoFromMFTable( if (!Scope) continue; + // If the variable has an attached offset expression, extract it. + // FIXME: Try to handle DW_OP_deref as well. + int64_t ExprOffset = 0; + if (VI.Expr) + if (!VI.Expr->extractIfOffset(ExprOffset)) + continue; + // Get the frame register used and the offset. unsigned FrameReg = 0; int FrameOffset = TFI->getFrameIndexReference(*Asm->MF, VI.Slot, FrameReg); uint16_t CVReg = TRI->getCodeViewRegNum(FrameReg); // Calculate the label ranges. - LocalVarDefRange DefRange = createDefRangeMem(CVReg, FrameOffset); + LocalVarDefRange DefRange = + createDefRangeMem(CVReg, FrameOffset + ExprOffset); for (const InsnRange &Range : Scope->getRanges()) { const MCSymbol *Begin = getLabelBeforeInsn(Range.first); const MCSymbol *End = getLabelAfterInsn(Range.second); |