mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-07 12:30:44 +00:00
d33fbe4f07
Add a new method, DICompositeType::buildODRType, that will create or mutate the DICompositeType for a given ODR identifier, and use it in LLParser and BitcodeReader instead of DICompositeType::getODRType. The logic is as follows: - If there's no node, create one with the given arguments. - Else, if the current node is a forward declaration and the new arguments would create a definition, mutate the node to match the new arguments. - Else, return the old node. This adds a missing feature supported by the current DITypeIdentifierMap (which I'm slowly making redudant). The only remaining difference is that the DITypeIdentifierMap has a "the-last-one-wins" rule, whereas DICompositeType::buildODRType has a "the-first-one-wins" rule. For now I'm leaving behind DICompositeType::getODRType since it has obvious, low-level semantics that are convenient for unit testing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266786 91177308-0d34-0410-b5e6-96231b3b80d8
66 lines
3.3 KiB
LLVM
66 lines
3.3 KiB
LLVM
; RUN: llvm-link -S -o - %s %S/Inputs/dicompositetype-unique.ll \
|
|
; RUN: | FileCheck %s -check-prefix CHECK -check-prefix FORWARD
|
|
; RUN: llvm-link -S -o - %S/Inputs/dicompositetype-unique.ll %s \
|
|
; RUN: | FileCheck %s -check-prefix CHECK -check-prefix REVERSE
|
|
; RUN: llvm-link -disable-debug-info-type-map -S -o - %s %S/Inputs/dicompositetype-unique.ll \
|
|
; RUN: | FileCheck %s -check-prefix NOMAP
|
|
|
|
; Check that the bitcode reader handles this too.
|
|
; RUN: llvm-as -o %t1.bc <%s
|
|
; RUN: llvm-as -o %t2.bc <%S/Inputs/dicompositetype-unique.ll
|
|
; RUN: llvm-link -S -o - %t1.bc %t2.bc \
|
|
; RUN: | FileCheck %s -check-prefix CHECK -check-prefix FORWARD
|
|
; RUN: llvm-link -S -o - %t2.bc %t1.bc \
|
|
; RUN: | FileCheck %s -check-prefix CHECK -check-prefix REVERSE
|
|
; RUN: llvm-link -disable-debug-info-type-map -S -o - %t1.bc %t2.bc \
|
|
; RUN: | FileCheck %s -check-prefix NOMAP
|
|
|
|
; Check that the type map will unique two DICompositeTypes.
|
|
|
|
; CHECK: !named = !{!0, !1, !2, !3, !0, !1, !2, !3}
|
|
; NOMAP: !named = !{!0, !1, !2, !3, !0, !4, !5, !6}
|
|
!named = !{!0, !1, !2, !3}
|
|
|
|
; Check both directions.
|
|
; CHECK: !1 = distinct !DICompositeType(
|
|
; FORWARD-SAME: name: "T1"
|
|
; REVERSE-SAME: name: "T2"
|
|
; CHECK-SAME: identifier: "T"
|
|
; CHECK-NOT: identifier: "T"
|
|
; CHECK: !2 = distinct !DICompositeType(
|
|
; CHECK-SAME: name: "FwdTDef"
|
|
; CHECK-SAME: identifier: "FwdT"
|
|
; CHECK-NOT: identifier: "FwdT"
|
|
; CHECK: !3 = distinct !DICompositeType(
|
|
; FORWARD-SAME: name: "BothFwdT1"
|
|
; REVERSE-SAME: name: "BothFwdT2"
|
|
; CHECK-SAME: identifier: "BothFwdT"
|
|
; CHECK-NOT: identifier: "BothFwdT"
|
|
|
|
; These types are different, so we should get both copies when there is no map.
|
|
; NOMAP: !1 = !DICompositeType(
|
|
; NOMAP-SAME: name: "T1"
|
|
; NOMAP-SAME: identifier: "T"
|
|
; NOMAP: !2 = !DICompositeType(
|
|
; NOMAP-SAME: name: "FwdTFwd"
|
|
; NOMAP-SAME: identifier: "FwdT"
|
|
; NOMAP: !3 = !DICompositeType(
|
|
; NOMAP-SAME: name: "BothFwdT1"
|
|
; NOMAP-SAME: identifier: "BothFwdT"
|
|
; NOMAP: !4 = !DICompositeType(
|
|
; NOMAP-SAME: name: "T2"
|
|
; NOMAP-SAME: identifier: "T"
|
|
; NOMAP-NOT: identifier: "T"
|
|
; NOMAP: !5 = !DICompositeType(
|
|
; NOMAP-SAME: name: "FwdTDef"
|
|
; NOMAP-SAME: identifier: "FwdT"
|
|
; NOMAP-NOT: identifier: "FwdT"
|
|
; NOMAP: !6 = !DICompositeType(
|
|
; NOMAP-SAME: name: "BothFwdT2"
|
|
; NOMAP-SAME: identifier: "BothFwdT"
|
|
; NOMAP-NOT: identifier: "BothFwdT"
|
|
!0 = !DIFile(filename: "abc", directory: "/path/to")
|
|
!1 = !DICompositeType(tag: DW_TAG_class_type, name: "T1", identifier: "T", file: !0)
|
|
!2 = !DICompositeType(tag: DW_TAG_class_type, flags: DIFlagFwdDecl, name: "FwdTFwd", identifier: "FwdT", file: !0)
|
|
!3 = !DICompositeType(tag: DW_TAG_class_type, flags: DIFlagFwdDecl, name: "BothFwdT1", identifier: "BothFwdT", file: !0)
|