summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugInfoMetadata.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2017-06-13 16:54:44 +0000
committerFlorian Hahn <florian.hahn@arm.com>2017-06-13 16:54:44 +0000
commitc9c403c0d471f7305c713760285666aa2407c5e0 (patch)
tree7ea772199c450372e9fcaaedee48180fd8d3dc88 /llvm/lib/IR/DebugInfoMetadata.cpp
parent4c73b40dca42c802babc565430bd50c7edb48cef (diff)
downloadbcm5719-llvm-c9c403c0d471f7305c713760285666aa2407c5e0.tar.gz
bcm5719-llvm-c9c403c0d471f7305c713760285666aa2407c5e0.zip
Align definition of DW_OP_plus with DWARF spec [1/3]
Summary: This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things. The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack. This is done in three stages: • The first patch (LLVM) adds support for DW_OP_plus_uconst. • The second patch (Clang) contains changes all its uses from DW_OP_plus to DW_OP_plus_uconst. • The third patch (LLVM) changes the semantics of DW_OP_plus and DW_OP_minus to be in line with its DWARF meaning. This patch includes the bitcode upgrade from legacy DIExpressions. Patch by Sander de Smalen. Reviewers: pcc, echristo, aprantl Reviewed By: aprantl Subscribers: fhahn, aprantl, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D33892 llvm-svn: 305304
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index e6c49cad072..a34f8d9eac1 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -599,6 +599,7 @@ unsigned DIExpression::ExprOperand::getSize() const {
return 3;
case dwarf::DW_OP_constu:
case dwarf::DW_OP_plus:
+ case dwarf::DW_OP_plus_uconst:
case dwarf::DW_OP_minus:
return 2;
default:
@@ -641,6 +642,7 @@ bool DIExpression::isValid() const {
break;
}
case dwarf::DW_OP_constu:
+ case dwarf::DW_OP_plus_uconst:
case dwarf::DW_OP_plus:
case dwarf::DW_OP_minus:
case dwarf::DW_OP_deref:
@@ -679,7 +681,8 @@ bool DIExpression::extractIfOffset(int64_t &Offset) const {
}
if (getNumElements() != 2)
return false;
- if (Elements[0] == dwarf::DW_OP_plus) {
+ if (Elements[0] == dwarf::DW_OP_plus ||
+ Elements[0] == dwarf::DW_OP_plus_uconst) {
Offset = Elements[1];
return true;
}
OpenPOWER on IntegriCloud