Add an index for Module Metadata record in the bitcode

Summary:
This index record the position for each metadata record in
the bitcode, so that the reader will be able to lazy-load
on demand each individual record.

We also make sure that every abbrev is emitted upfront so
that the block can be skipped while reading.

I don't plan to commit this before having the reader
counterpart, but I figured this can be reviewed mostly
independently.

Reviewers: pcc, tejohnson

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D28083

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290684 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mehdi Amini
2016-12-28 19:44:19 +00:00
parent 25a09f14f3
commit a0ca6ae2d3
9 changed files with 133 additions and 8 deletions
@@ -17,6 +17,10 @@
; CHECK-NEXT: <DISTINCT_NODE op0=1 op1=3 op2=2/>
!4 = distinct !{!1, !3, !2}
; Before the named records we emit the index containing the position of the
; previously emitted records
; CHECK-NEXT: <INDEX {{.*}} (offset match)
; Note: named metadata nodes are not cannot reference null so their operands
; are numbered off-by-one.
; CHECK-NEXT: <NAME
@@ -22,6 +22,10 @@
; CHECK-NEXT: <NODE op0=2/>
!3 = !{!2}
; Before the named records we emit the index containing the position of the
; previously emitted records
; CHECK-NEXT: <INDEX {{.*}} (offset match)
; Note: named metadata nodes are not cannot reference null so their operands
; are numbered off-by-one.
; CHECK-NEXT: <NAME
@@ -11,6 +11,10 @@
; CHECK-NEXT: <NODE op0=1/>
!2 = !{!1}
; Before the named records we emit the index containing the position of the
; previously emitted records
; CHECK-NEXT: <INDEX {{.*}} (offset match)
; Note: named metadata nodes are not cannot reference null so their operands
; are numbered off-by-one.
; CHECK-NEXT: <NAME
+7
View File
@@ -15,6 +15,9 @@
; CHECK-NEXT: 'leaf
; CHECK-NEXT: }
; Before the records we emit an offset to the index for the block
; CHECK-NEXT: <INDEX_OFFSET
; The leafs should come first (in either order).
; CHECK-NEXT: <NODE op0=1/>
; CHECK-NEXT: <NODE op0=2/>
@@ -27,6 +30,10 @@
; CHECK-NEXT: <NODE op0=3 op1=5 op2=4/>
!6 = !{!3, !5, !4}
; Before the named records we emit the index containing the position of the
; previously emitted records
; CHECK-NEXT: <INDEX {{.*}} (offset match)
; Note: named metadata nodes are not cannot reference null so their operands
; are numbered off-by-one.
; CHECK-NEXT: <NAME
+3
View File
@@ -19,6 +19,9 @@
; Each node gets a new number. Bottom-up traversal of nodes.
!named = !{!6}
; Before the records we emit an offset to the index for the block
; CHECK-NEXT: <INDEX_OFFSET
; CHECK-NEXT: <NODE op0=1/>
!4 = !{!"named"}