}
/// createSubroutineType - Create subroutine type.
-DICompositeType DIBuilder::createSubroutineType(DIFile File,
- DIArray ParameterTypes,
- unsigned Flags) {
+DISubroutineType DIBuilder::createSubroutineType(DIFile File,
+ DITypeArray ParameterTypes,
+ unsigned Flags) {
// TAG_subroutine_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_subroutine_type),
nullptr,
nullptr // Type Identifer
};
- return DICompositeType(MDNode::get(VMContext, Elts));
+ return DISubroutineType(MDNode::get(VMContext, Elts));
}
/// createEnumerationType - Create debugging information entry for an
/// createUnspecifiedParameter - Create unspeicified type descriptor
/// for the subroutine type.
-DIDescriptor DIBuilder::createUnspecifiedParameter() {
- Value *Elts[] = {
- GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_parameters)
- };
- return DIDescriptor(MDNode::get(VMContext, Elts));
+DIBasicType DIBuilder::createUnspecifiedParameter() {
+ return DIBasicType();
}
/// createForwardDecl - Create a temporary forward-declared type that
return DIArray(MDNode::get(VMContext, Elements));
}
+/// getOrCreateTypeArray - Get a DITypeArray, create one if required.
+DITypeArray DIBuilder::getOrCreateTypeArray(ArrayRef<Value *> Elements) {
+ SmallVector<llvm::Value *, 16> Elts;
+ for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
+ if (Elements[i] && isa<MDNode>(Elements[i]))
+ Elts.push_back(DIType(cast<MDNode>(Elements[i])).getRef());
+ else
+ Elts.push_back(Elements[i]);
+ }
+ return DITypeArray(MDNode::get(VMContext, Elts));
+}
+
/// getOrCreateSubrange - Create a descriptor for a value range. This
/// implicitly uniques the values returned.
DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
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));
+
+ 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.
/// createLexicalBlockFile - This creates a new MDNode that encapsulates
/// an existing scope with a new filename.
DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
- DIFile File) {
+ DIFile File,
+ unsigned Discriminator) {
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
File.getFileNode(),
- Scope
+ Scope,
+ ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator),
};
DILexicalBlockFile R(MDNode::get(VMContext, Elts));
assert(
}
DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
- unsigned Line, unsigned Col,
- unsigned Discriminator) {
+ unsigned Line, unsigned Col) {
// FIXME: This isn't thread safe nor the right way to defeat MDNode uniquing.
// I believe the right way is to have a self-referential element in the node.
// Also: why do we bother with line/column - they're not used and the
getNonCompileUnitScope(Scope),
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
ConstantInt::get(Type::getInt32Ty(VMContext), Col),
- ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator),
ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++)
};
DILexicalBlock R(MDNode::get(VMContext, Elts));