summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorVictor Leschuk <vleschuk@accesssoftek.com>2017-08-04 04:51:15 +0000
committerVictor Leschuk <vleschuk@accesssoftek.com>2017-08-04 04:51:15 +0000
commit56b03d0dd6872f37d796ac55e8e5912a78cd310f (patch)
tree896388ba96e36b2c377ae9b151f2353124bde4be /llvm/lib/IR/DIBuilder.cpp
parent21713ebfb147d15f397fda9dbb78013fc6515b09 (diff)
downloadbcm5719-llvm-56b03d0dd6872f37d796ac55e8e5912a78cd310f.tar.gz
bcm5719-llvm-56b03d0dd6872f37d796ac55e8e5912a78cd310f.zip
Un-revert r310014: false revert, it wasn't the cause of build break
llvm-svn: 310021
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 972b6a22324..f4702b377f9 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -668,10 +668,31 @@ DIExpression *DIBuilder::createExpression(ArrayRef<int64_t> Signed) {
return createExpression(Addr);
}
-DIExpression *DIBuilder::createFragmentExpression(unsigned OffsetInBytes,
- unsigned SizeInBytes) {
- uint64_t Addr[] = {dwarf::DW_OP_LLVM_fragment, OffsetInBytes, SizeInBytes};
- return DIExpression::get(VMContext, Addr);
+DIExpression *DIBuilder::createFragmentExpression(unsigned OffsetInBits,
+ unsigned SizeInBits,
+ const DIExpression *Expr) {
+ SmallVector<uint64_t, 8> Ops;
+ // Copy over the expression, but leave off any trailing DW_OP_LLVM_fragment.
+ if (Expr) {
+ for (auto Op : Expr->expr_ops()) {
+ if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
+ // Make the new offset point into the existing fragment.
+ uint64_t FragmentOffsetInBits = Op.getArg(0);
+ uint64_t FragmentSizeInBits = Op.getArg(1);
+ assert((OffsetInBits + SizeInBits <= FragmentSizeInBits) &&
+ "new fragment outside of original fragment");
+ OffsetInBits += FragmentOffsetInBits;
+ break;
+ }
+ Ops.push_back(Op.getOp());
+ for (unsigned I = 0; I < Op.getNumArgs(); ++I)
+ Ops.push_back(Op.getArg(I));
+ }
+ }
+ Ops.push_back(dwarf::DW_OP_LLVM_fragment);
+ Ops.push_back(OffsetInBits);
+ Ops.push_back(SizeInBits);
+ return DIExpression::get(VMContext, Ops);
}
template <class... Ts>
OpenPOWER on IntegriCloud