summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEkaterina Romanova <katya_romanova@playstation.sony.com>2014-12-12 05:11:47 +0000
committerEkaterina Romanova <katya_romanova@playstation.sony.com>2014-12-12 05:11:47 +0000
commit90ff20d8f502b173f876b10034ea70ccb2629d6b (patch)
tree5d9e2747441c816d3fd114a1bed90141b8842f83 /llvm/lib
parent881916dea535690acf5be86766f490b84c163f8e (diff)
downloadbcm5719-llvm-90ff20d8f502b173f876b10034ea70ccb2629d6b.tar.gz
bcm5719-llvm-90ff20d8f502b173f876b10034ea70ccb2629d6b.zip
A fix for PR21176.
DW_OP_const <const> doesn't describe a constant value, but a value at a constant address. The proper way to describe a constant value is DW_OP_constu <const>, DW_OP_stack_value. Added DW_OP_stack_value to the stack. Marked incorrect-variable-debugloc1.ll to xfail for PowerPC64, while the the failure (PR21881) is being investigated. llvm-svn: 224098
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 230ea465182..b7e9d656e90 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1722,6 +1722,18 @@ void DwarfDebug::emitDebugLocValue(ByteStreamer &Streamer,
Streamer.EmitInt8(dwarf::DW_OP_constu, "DW_OP_constu");
Streamer.EmitULEB128(Value.getInt());
}
+ // The proper way to describe a constant value is
+ // DW_OP_constu <const>, DW_OP_stack_value.
+ // Unfortunately, DW_OP_stack_value was not available until DWARF-4,
+ // so we will continue to generate DW_OP_constu <const> for DWARF-2
+ // and DWARF-3. Technically, this is incorrect since DW_OP_const <const>
+ // actually describes a value at a constant addess, not a constant value.
+ // However, in the past there was no better way to describe a constant
+ // value, so the producers and consumers started to rely on heuristics
+ // to disambiguate the value vs. location status of the expression.
+ // See PR21176 for more details.
+ if (getDwarfVersion() >= 4)
+ Streamer.EmitInt8(dwarf::DW_OP_stack_value, "DW_OP_stack_value");
} else if (Value.isLocation()) {
MachineLocation Loc = Value.getLoc();
DIExpression Expr = Value.getExpression();
OpenPOWER on IntegriCloud