mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
IR: Change MDFile to directly store the filename/directory
In the old (well, current) schema, there are two types of file references: untagged and tagged (the latter references the former). !0 = !{!"filename", !"/directory"} !1 = !{!"0x29", !1} ; DW_TAG_file_type [filename] [/directory] The interface to `DIBuilder` universally takes the tagged version, described by `DIFile`. However, most `file:` references actually use the untagged version directly. In the new hierarchy, I'm merging this into a single node: `MDFile`. Originally I'd planned to keep the old schema unchanged until after I moved the new hierarchy into place. However, it turns out to be trivial to make `MDFile` match both nodes at the same time. - Anyone referencing !1 does so through `DIFile`, whose implementation I need to gut anyway (as I do the rest of the `DIDescriptor`s). - Anyone referencing !0 just references an `MDNode`, and expects a node with two `MDString` operands. This commit achieves that, and updates all the testcases for the parts of the new hierarchy that used the two-node schema (I've replaced the untagged nodes with `distinct !{}` to make the diff clear (otherwise the metadata all gets renumbered); it might be worthwhile to come back and delete those nodes and renumber the world, not sure). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230057 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5a81e14385
commit
99f12691dd
@ -754,25 +754,11 @@ public:
|
||||
|
||||
TempMDFile clone() const { return cloneImpl(); }
|
||||
|
||||
MDTuple *getFileNode() const { return cast<MDTuple>(getOperand(0)); }
|
||||
StringRef getFilename() const { return getStringOperand(0); }
|
||||
StringRef getDirectory() const { return getStringOperand(1); }
|
||||
|
||||
StringRef getFilename() const {
|
||||
if (auto *S = getRawFilename())
|
||||
return S->getString();
|
||||
return StringRef();
|
||||
}
|
||||
StringRef getDirectory() const {
|
||||
if (auto *S = getRawDirectory())
|
||||
return S->getString();
|
||||
return StringRef();
|
||||
}
|
||||
|
||||
MDString *getRawFilename() const {
|
||||
return cast_or_null<MDString>(getFileNode()->getOperand(0));
|
||||
}
|
||||
MDString *getRawDirectory() const {
|
||||
return cast_or_null<MDString>(getFileNode()->getOperand(1));
|
||||
}
|
||||
MDString *getRawFilename() const { return getOperandAs<MDString>(0); }
|
||||
MDString *getRawDirectory() const { return getOperandAs<MDString>(1); }
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
return MD->getMetadataID() == MDFileKind;
|
||||
|
@ -210,11 +210,8 @@ MDFile *MDFile::getImpl(LLVMContext &Context, MDString *Filename,
|
||||
assert(isCanonical(Filename) && "Expected canonical MDString");
|
||||
assert(isCanonical(Directory) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDFile, (getString(Filename), getString(Directory)));
|
||||
Metadata *NodeOps[] = {Filename, Directory};
|
||||
Metadata *Ops[] = {MDTuple::get(Context, NodeOps)};
|
||||
return storeImpl(new (ArrayRef<Metadata *>(Ops).size())
|
||||
MDFile(Context, Storage, Ops),
|
||||
Storage, Context.pImpl->MDFiles);
|
||||
Metadata *Ops[] = {Filename, Directory};
|
||||
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDFile, Ops);
|
||||
}
|
||||
|
||||
MDCompileUnit *MDCompileUnit::getImpl(
|
||||
|
@ -28,35 +28,35 @@
|
||||
!9 = !MDBasicType(tag: DW_TAG_base_type)
|
||||
!10 = !MDBasicType(tag: DW_TAG_base_type, name: "", size: 0, align: 0, encoding: 0)
|
||||
|
||||
; CHECK-NEXT: !9 = !{!"path/to/file", !"/path/to/dir"}
|
||||
; CHECK-NEXT: !9 = distinct !{}
|
||||
; CHECK-NEXT: !10 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
; CHECK-NEXT: !11 = !{null, null}
|
||||
; CHECK-NEXT: !11 = distinct !{}
|
||||
; CHECK-NEXT: !12 = !MDFile(filename: "", directory: "")
|
||||
!11 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!11 = distinct !{}
|
||||
!12 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!13 = !{null, null}
|
||||
!13 = distinct !{}
|
||||
!14 = !MDFile(filename: "", directory: "")
|
||||
|
||||
; CHECK-NEXT: !13 = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 32, align: 32)
|
||||
!15 = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32, align: 32)
|
||||
|
||||
; CHECK-NEXT: !14 = !MDCompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !9, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
; CHECK-NEXT: !15 = distinct !MDCompositeType(tag: DW_TAG_structure_type, name: "Base", file: !9, line: 3, scope: !14, size: 128, align: 32, offset: 64, flags: 3, elements: !16, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !14 = !MDCompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !10, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
; CHECK-NEXT: !15 = distinct !MDCompositeType(tag: DW_TAG_structure_type, name: "Base", file: !10, line: 3, scope: !14, size: 128, align: 32, offset: 64, flags: 3, elements: !16, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !16 = !{!17}
|
||||
; CHECK-NEXT: !17 = !MDDerivedType(tag: DW_TAG_member, name: "field", file: !9, line: 4, scope: !15, baseType: !6, size: 32, align: 32, offset: 32, flags: 3)
|
||||
; CHECK-NEXT: !17 = !MDDerivedType(tag: DW_TAG_member, name: "field", file: !10, line: 4, scope: !15, baseType: !6, size: 32, align: 32, offset: 32, flags: 3)
|
||||
; CHECK-NEXT: !18 = !{!6}
|
||||
; CHECK-NEXT: !19 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Derived", file: !9, line: 3, scope: !14, baseType: !15, size: 128, align: 32, offset: 64, flags: 3, elements: !20, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !19 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Derived", file: !10, line: 3, scope: !14, baseType: !15, size: 128, align: 32, offset: 64, flags: 3, elements: !20, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !20 = !{!21}
|
||||
; CHECK-NEXT: !21 = !MDDerivedType(tag: DW_TAG_inheritance, scope: !19, baseType: !15)
|
||||
; CHECK-NEXT: !22 = !MDDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, size: 32, align: 32, extraData: !15)
|
||||
; CHECK-NEXT: !23 = !MDCompositeType(tag: DW_TAG_structure_type)
|
||||
; CHECK-NEXT: !24 = !MDCompositeType(tag: DW_TAG_structure_type, runtimeLang: DW_LANG_Cobol85)
|
||||
!16 = !MDCompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !11, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
!17 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Base", file: !11, line: 3, scope: !16, size: 128, align: 32, offset: 64, flags: 3, elements: !18, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
!16 = !MDCompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !12, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
!17 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Base", file: !12, line: 3, scope: !16, size: 128, align: 32, offset: 64, flags: 3, elements: !18, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
!18 = !{!19}
|
||||
!19 = !MDDerivedType(tag: DW_TAG_member, name: "field", file: !11, line: 4, scope: !17, baseType: !7, size: 32, align: 32, offset: 32, flags: 3)
|
||||
!19 = !MDDerivedType(tag: DW_TAG_member, name: "field", file: !12, line: 4, scope: !17, baseType: !7, size: 32, align: 32, offset: 32, flags: 3)
|
||||
!20 = !{!7}
|
||||
!21 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Derived", file: !11, line: 3, scope: !16, baseType: !17, size: 128, align: 32, offset: 64, flags: 3, elements: !22, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
!21 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Derived", file: !12, line: 3, scope: !16, baseType: !17, size: 128, align: 32, offset: 64, flags: 3, elements: !22, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
!22 = !{!23}
|
||||
!23 = !MDDerivedType(tag: DW_TAG_inheritance, scope: !21, baseType: !17)
|
||||
!24 = !MDDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !7, size: 32, align: 32, extraData: !17)
|
||||
|
@ -4,7 +4,7 @@
|
||||
; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !7, !8, !8}
|
||||
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10}
|
||||
|
||||
!0 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!0 = distinct !{}
|
||||
!1 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!2 = distinct !{}
|
||||
!3 = distinct !{}
|
||||
|
@ -7,14 +7,14 @@
|
||||
!named = !{!0, !1, !2, !3, !4, !5, !6}
|
||||
|
||||
!0 = distinct !{}
|
||||
!1 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!1 = distinct !{}
|
||||
!2 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!3 = distinct !{}
|
||||
!4 = distinct !{}
|
||||
|
||||
; CHECK: !5 = !MDGlobalVariable(scope: !0, name: "foo", linkageName: "foo", file: !1, line: 7, type: !3, isLocal: true, isDefinition: false, variable: i32* @foo, declaration: !4)
|
||||
; CHECK: !5 = !MDGlobalVariable(scope: !0, name: "foo", linkageName: "foo", file: !2, line: 7, type: !3, isLocal: true, isDefinition: false, variable: i32* @foo, declaration: !4)
|
||||
!5 = !MDGlobalVariable(scope: !0, name: "foo", linkageName: "foo",
|
||||
file: !1, line: 7, type: !3, isLocal: true,
|
||||
file: !2, line: 7, type: !3, isLocal: true,
|
||||
isDefinition: false, variable: i32* @foo,
|
||||
declaration: !4)
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
|
||||
|
||||
!0 = distinct !{}
|
||||
!1 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!1 = distinct !{}
|
||||
!2 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
|
||||
; CHECK: !3 = !MDLexicalBlock(scope: !0, file: !2, line: 7, column: 35)
|
||||
|
@ -7,18 +7,18 @@
|
||||
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
|
||||
|
||||
!0 = distinct !{}
|
||||
!1 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!1 = distinct !{}
|
||||
!2 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!3 = distinct !{}
|
||||
!4 = distinct !{}
|
||||
|
||||
; CHECK: !5 = !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo", file: !1, line: 7, type: !3, arg: 3, flags: 8, inlinedAt: !4)
|
||||
; CHECK: !6 = !MDLocalVariable(tag: DW_TAG_auto_variable, scope: !0, name: "foo", file: !1, line: 7, type: !3, flags: 8, inlinedAt: !4)
|
||||
; CHECK: !5 = !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo", file: !2, line: 7, type: !3, arg: 3, flags: 8, inlinedAt: !4)
|
||||
; CHECK: !6 = !MDLocalVariable(tag: DW_TAG_auto_variable, scope: !0, name: "foo", file: !2, line: 7, type: !3, flags: 8, inlinedAt: !4)
|
||||
!5 = !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo",
|
||||
file: !1, line: 7, type: !3, arg: 3,
|
||||
file: !2, line: 7, type: !3, arg: 3,
|
||||
flags: 8, inlinedAt: !4)
|
||||
!6 = !MDLocalVariable(tag: DW_TAG_auto_variable, scope: !0, name: "foo",
|
||||
file: !1, line: 7, type: !3, flags: 8, inlinedAt: !4)
|
||||
file: !2, line: 7, type: !3, flags: 8, inlinedAt: !4)
|
||||
|
||||
; CHECK: !7 = !MDLocalVariable(tag: DW_TAG_arg_variable, scope: null, name: "", arg: 0)
|
||||
; CHECK: !8 = !MDLocalVariable(tag: DW_TAG_auto_variable, scope: null, name: "")
|
||||
|
@ -5,7 +5,7 @@
|
||||
!named = !{!0, !1, !2, !3, !4, !5}
|
||||
|
||||
!0 = distinct !{}
|
||||
!1 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!1 = distinct !{}
|
||||
!2 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
|
||||
; CHECK: !3 = !MDNamespace(scope: !0, file: !2, name: "Namespace", line: 7)
|
||||
|
@ -4,14 +4,14 @@
|
||||
; CHECK: !named = !{!0, !1, !2, !3, !4, !4}
|
||||
!named = !{!0, !1, !2, !3, !4, !5}
|
||||
|
||||
!0 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!0 = distinct !{}
|
||||
!1 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!2 = distinct !{}
|
||||
|
||||
|
||||
; CHECK: !2 = distinct !{}
|
||||
; CHECK-NEXT: !3 = !MDObjCProperty(name: "foo", file: !0, line: 7, setter: "setFoo", getter: "getFoo", attributes: 7, type: !2)
|
||||
!3 = !MDObjCProperty(name: "foo", file: !0, line: 7, setter: "setFoo",
|
||||
; CHECK-NEXT: !3 = !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo", getter: "getFoo", attributes: 7, type: !2)
|
||||
!3 = !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo",
|
||||
getter: "getFoo", attributes: 7, type: !2)
|
||||
|
||||
; CHECK-NEXT: !4 = !MDObjCProperty(name: "foo")
|
||||
|
@ -7,7 +7,7 @@ declare void @_Z3foov()
|
||||
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
|
||||
|
||||
!0 = distinct !{}
|
||||
!1 = !{!"path/to/file", !"/path/to/dir"}
|
||||
!1 = distinct !{}
|
||||
!2 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!3 = distinct !{}
|
||||
!4 = distinct !{}
|
||||
|
Loading…
Reference in New Issue
Block a user