diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-10-01 20:26:08 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-10-01 20:26:08 +0000 |
commit | 611afb229c05509d17ba262ab8f1e30c3f9d902b (patch) | |
tree | 1113f711cf5c2aa1d55893adcc12ec2e460ee547 /llvm/lib | |
parent | 22c9073ada45da68a870ef136d2000c174c6c00e (diff) | |
download | bcm5719-llvm-611afb229c05509d17ba262ab8f1e30c3f9d902b.tar.gz bcm5719-llvm-611afb229c05509d17ba262ab8f1e30c3f9d902b.zip |
DIBuilder: Encapsulate DIExpression's element type
`DIExpression`'s elements are 64-bit integers that are stored as
`ConstantInt`. The accessors already encapsulate the storage. This
commit updates the `DIBuilder` API to also encapsulate that.
llvm-svn: 218797
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 1ab52523d73..f1d4a21bb73 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -1045,10 +1045,14 @@ DIVariable DIBuilder::createLocalVariable(unsigned Tag, DIDescriptor Scope, /// createExpression - Create a new descriptor for the specified /// variable which has a complex address expression for its address. /// @param Addr An array of complex address operations. -DIExpression DIBuilder::createExpression(ArrayRef<Value *> Addr) { +DIExpression DIBuilder::createExpression(ArrayRef<int64_t> Addr) { SmallVector<llvm::Value *, 16> Elts; Elts.push_back(GetTagConstant(VMContext, DW_TAG_expression)); - Elts.insert(Elts.end(), Addr.begin(), Addr.end()); + + llvm::Type *Int64Ty = Type::getInt64Ty(VMContext); + for (int64_t I : Addr) + Elts.push_back(ConstantInt::get(Int64Ty, I)); + return DIExpression(MDNode::get(VMContext, Elts)); } diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 69c9346c027..ecbe94a7e39 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1115,14 +1115,13 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, // "deref" operation to a list of address elements, as new llvm.dbg.declare // will take a value storing address of the memory for variable, not // alloca itself. - Type *Int64Ty = Type::getInt64Ty(AI->getContext()); - SmallVector<Value *, 4> NewDIExpr; + SmallVector<int64_t, 4> NewDIExpr; if (DIExpr) { for (unsigned i = 0, n = DIExpr.getNumElements(); i < n; ++i) { - NewDIExpr.push_back(ConstantInt::get(Int64Ty, DIExpr.getElement(i))); + NewDIExpr.push_back(DIExpr.getElement(i)); } } - NewDIExpr.push_back(ConstantInt::get(Int64Ty, dwarf::DW_OP_deref)); + NewDIExpr.push_back(dwarf::DW_OP_deref); // Insert llvm.dbg.declare in the same basic block as the original alloca, // and remove old llvm.dbg.declare. |