- SmallVector<Value *, 15> Elts;
- Elts.push_back(GetTagConstant(VMContext, Tag));
- Elts.push_back(getNonCompileUnitScope(Scope)),
- Elts.push_back(MDString::get(VMContext, Name));
- Elts.push_back(F);
- Elts.push_back(ConstantInt::get(Type::getInt32Ty(VMContext),
- (LineNo | (ArgNo << 24))));
- Elts.push_back(Ty);
- Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
- Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
- Elts.append(Addr.begin(), Addr.end());
+ assert(Addr.size() > 0 && "complex address is empty");
+ Value *Elts[] = {
+ GetTagConstant(VMContext, Tag),
+ getNonCompileUnitScope(Scope),
+ MDString::get(VMContext, Name),
+ F,
+ ConstantInt::get(Type::getInt32Ty(VMContext),
+ (LineNo | (ArgNo << 24))),
+ Ty,
+ Constant::getNullValue(Type::getInt32Ty(VMContext)),
+ Constant::getNullValue(Type::getInt32Ty(VMContext)),
+ MDNode::get(VMContext, Addr)
+ };
+ 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<Value *, 9> Elts;
+ for (unsigned i = 0; i < 8; ++i)
+ Elts.push_back(Variable->getOperand(i));