X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FIR%2FDIBuilder.cpp;h=a621f71a7f56b77c893f9fc6a921eebf6471c9a3;hb=7af88ec907537f9a5de343d439fbca1344f28a29;hp=04a3ea4ab7b3d9ea586140b59343c0d19d07f597;hpb=70626f555c5280f10e699c763ddefa89bfc23479;p=oota-llvm.git diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index 04a3ea4ab7b..a621f71a7f5 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -1100,6 +1100,28 @@ DIVariable DIBuilder::createComplexVariable(unsigned Tag, DIDescriptor Scope, return DIVariable(MDNode::get(VMContext, Elts)); } +/// createVariablePiece - Create a descriptor to describe one part +/// of aggregate variable that is fragmented across multiple Values. +DIVariable DIBuilder::createVariablePiece(DIVariable Variable, + unsigned OffsetInBytes, + unsigned SizeInBytes) { + assert(SizeInBytes > 0 && "zero-size piece"); + Value *Addr[] = { + ConstantInt::get(Type::getInt32Ty(VMContext), OpPiece), + ConstantInt::get(Type::getInt32Ty(VMContext), OffsetInBytes), + ConstantInt::get(Type::getInt32Ty(VMContext), SizeInBytes) + }; + + assert((Variable->getNumOperands() == 8 || Variable.isVariablePiece()) && + "variable already has a complex address"); + SmallVector Elts; + for (unsigned i = 0; i < 8; ++i) + Elts.push_back(Variable->getOperand(i)); + + Elts.push_back(MDNode::get(VMContext, Addr)); + return DIVariable(MDNode::get(VMContext, Elts)); +} + /// createFunction - Create a new descriptor for the specified function. /// FIXME: this is added for dragonegg. Once we update dragonegg /// to call resolve function, this will be removed.