brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 2bd3901 Raw
88 lines · plain
1# REQUIRES: aarch64-registered-target2# UNSUPPORTED: system-windows3 4# Merge a binary file (e.g., a linked executable) having concatenated cgdata (__llvm_outline)5 6RUN: split-file %s %t7 8# Synthesize two sets of raw cgdata without the header (32 byte) from the indexed cgdata.9# Concatenate them in merge-concat.ll10RUN: llvm-cgdata --convert --format binary %t/raw-1.cgtext -o %t/raw-1.cgdata11RUN: echo -n "s/<RAW_1_BYTES>/" > %t/raw-1-sed.txt12RUN: od -t x1 -j 32 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' >> %t/raw-1-sed.txt13RUN: echo "/g" >> %t/raw-1-sed.txt14RUN: sed -f %t/raw-1-sed.txt %t/merge-concat-template.ll > %t/merge-concat-template-2.ll15RUN: llvm-cgdata --convert --format binary %t/raw-2.cgtext -o %t/raw-2.cgdata16RUN: echo -n "s/<RAW_2_BYTES>/" > %t/raw-2-sed.txt17RUN: od -t x1 -j 32 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' >> %t/raw-2-sed.txt18RUN: echo "/g" >> %t/raw-2-sed.txt19RUN: sed -f %t/raw-2-sed.txt %t/merge-concat-template-2.ll > %t/merge-concat.ll20 21RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-concat.ll -o %t/merge-concat.o22RUN: llvm-cgdata --merge %t/merge-concat.o -o %t/merge-concat.cgdata23RUN: llvm-cgdata --show %t/merge-concat.cgdata | FileCheck %s24CHECK: Outlined hash tree:25CHECK-NEXT:  Total Node Count: 426CHECK-NEXT:  Terminal Node Count: 227CHECK-NEXT:  Depth: 228 29RUN: llvm-cgdata --convert %t/merge-concat.cgdata | FileCheck %s --check-prefix=TREE30TREE: # Outlined stable hash tree31TREE-NEXT: :outlined_hash_tree32TREE-NEXT: ---33TREE-NEXT: 0:34TREE-NEXT:   Hash:            0x035TREE-NEXT:   Terminals:       036TREE-NEXT:   SuccessorIds:    [ 1 ]37TREE-NEXT: 1:38TREE-NEXT:   Hash:            0x139TREE-NEXT:   Terminals:       040TREE-NEXT:   SuccessorIds:    [ 2, 3 ]41TREE-NEXT: 2:42TREE-NEXT:   Hash:            0x343TREE-NEXT:   Terminals:       544TREE-NEXT:   SuccessorIds:    [  ]45TREE-NEXT: 3:46TREE-NEXT:   Hash:            0x247TREE-NEXT:   Terminals:       448TREE-NEXT:   SuccessorIds:    [  ]49TREE-NEXT: ...50 51;--- raw-1.cgtext52:outlined_hash_tree530:54  Hash:            0x055  Terminals:       056  SuccessorIds:    [ 1 ]571:58  Hash:            0x159  Terminals:       060  SuccessorIds:    [ 2 ]612:62  Hash:            0x263  Terminals:       464  SuccessorIds:    [  ]65...66 67;--- raw-2.cgtext68:outlined_hash_tree690:70  Hash:            0x071  Terminals:       072  SuccessorIds:    [ 1 ]731:74  Hash:            0x175  Terminals:       076  SuccessorIds:    [ 2 ]772:78  Hash:            0x379  Terminals:       580  SuccessorIds:    [  ]81...82 83;--- merge-concat-template.ll84 85; In an linked executable (as opposed to an object file), cgdata in __llvm_outline might be concatenated. Although this is not a typical workflow, we simply support this case to parse cgdata that is concatenated. In other words, the following two trees are encoded back-to-back in a binary format.86@.data1 = private unnamed_addr constant [72 x i8] c"<RAW_1_BYTES>", section "__DATA,__llvm_outline"87@.data2 = private unnamed_addr constant [72 x i8] c"<RAW_2_BYTES>", section "__DATA,__llvm_outline"88