diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-09-14 20:22:03 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-09-14 20:22:03 +0000 |
commit | 23f06e53d8c2febb80192f6ff93bce78a6af011d (patch) | |
tree | afb1f3697ae9d2d39ce72b47eb495fa16ff6dc5e /llvm/test/Object/stackmap-dump.test | |
parent | 3caf155bd3fc22b4d0c0e0dbe540290422ee085b (diff) | |
download | bcm5719-llvm-23f06e53d8c2febb80192f6ff93bce78a6af011d.tar.gz bcm5719-llvm-23f06e53d8c2febb80192f6ff93bce78a6af011d.zip |
[Stackmap] Added callsite counts to emitted function information.
Summary:
It was previously not possible for tools to use solely the stackmap
information emitted to reconstruct the return addresses of callsites in
the map, which is necessary to use the information to walk a stack. This
patch adds per-function callsite counts when emitting the stackmap
section in order to resolve the problem. Note that this slightly alters
the stackmap format, so external tools parsing these maps will need to
be updated.
**Problem Details:**
Records only store their offset from the beginning of the function they
belong to. While these records and the functions are output in program
order, it is not possible to determine where the end of one function's
records are without the callsite count when processing the records to
compute return addresses.
Patch by Kavon Farvardin!
Reviewers: atrick, ributzka, sanjoy
Subscribers: nemanjai
Differential Revision: https://reviews.llvm.org/D23487
llvm-svn: 281532
Diffstat (limited to 'llvm/test/Object/stackmap-dump.test')
-rw-r--r-- | llvm/test/Object/stackmap-dump.test | 182 |
1 files changed, 170 insertions, 12 deletions
diff --git a/llvm/test/Object/stackmap-dump.test b/llvm/test/Object/stackmap-dump.test index 71710fb6194..5d7d8ccbb67 100644 --- a/llvm/test/Object/stackmap-dump.test +++ b/llvm/test/Object/stackmap-dump.test @@ -1,16 +1,174 @@ RUN: llvm-readobj -stackmap %p/Inputs/stackmap-test.macho-x86-64 | FileCheck %s -CHECK: LLVM StackMap Version: 1 -CHECK-NEXT: Num Functions: 1 -CHECK-NEXT: Function address: 0, stack size: 16 -CHECK-NEXT: Num Constants: 1 -CHECK-NEXT: #1: 10000000000 -CHECK-NEXT: Num Records: 1 -CHECK-NEXT: Record ID: 2, instruction offset: 1 -CHECK-NEXT: 5 locations: +; Note: the macho object file in this test was generated in the following way: +; llc -mtriple=x86_64-apple-darwin %p/test/CodeGen/X86/stackmap.ll -o stackmap.s +; clang -c stackmap.s -o %p/test/Object/Inputs/stackmap-test.macho-x86-64 + +CHECK: LLVM StackMap Version: 2 +CHECK-NEXT: Num Functions: 16 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 24, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 56, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 56, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 56, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 56, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 56, callsite record count: 2 +CHECK-NEXT: Function address: 0, stack size: 8, callsite record count: 4 +CHECK-NEXT: Function address: 0, stack size: 56, callsite record count: 1 +CHECK-NEXT: Function address: 0, stack size: 18446744073709551615, callsite record count: 1 +CHECK-NEXT: Num Constants: 3 +CHECK-NEXT: #1: 2147483648 +CHECK-NEXT: #2: 4294967295 +CHECK-NEXT: #3: 4294967296 +CHECK-NEXT: Num Records: 20 +CHECK-NEXT: Record ID: 1, instruction offset: 4 +CHECK-NEXT: 12 locations: +CHECK-NEXT: #1: Constant 4294967295 +CHECK-NEXT: #2: Constant 4294967295 +CHECK-NEXT: #3: Constant 65536 +CHECK-NEXT: #4: Constant 2000000000 +CHECK-NEXT: #5: Constant 2147483647 +CHECK-NEXT: #6: Constant 4294967295 +CHECK-NEXT: #7: Constant 4294967295 +CHECK-NEXT: #8: Constant 0 +CHECK-NEXT: #9: ConstantIndex #0 (2147483648) +CHECK-NEXT: #10: ConstantIndex #1 (4294967295) +CHECK-NEXT: #11: ConstantIndex #2 (4294967296) +CHECK-NEXT: #12: Constant 4294967295 +CHECK-NEXT: 1 live-outs: [ R#7 (8-bytes) ] + +CHECK: Record ID: 3, instruction offset: 22 +CHECK-NEXT: 2 locations: +CHECK-NEXT: #1: Register R#3 +CHECK-NEXT: #2: Register R#14 +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 4, instruction offset: 10 +CHECK-NEXT: 2 locations: CHECK-NEXT: #1: Register R#5 -CHECK-NEXT: #2: Constant 10 -CHECK-NEXT: #3: ConstantIndex #0 (10000000000) -CHECK-NEXT: #4: Direct R#4 + -8 -CHECK-NEXT: #5: Indirect [R#6 + -16] +CHECK-NEXT: #2: Register R#4 +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 5, instruction offset: 4 +CHECK-NEXT: 2 locations: +CHECK-NEXT: #1: Register R#0 +CHECK-NEXT: #2: Register R#5 +CHECK-NEXT: 2 live-outs: [ R#0 (8-bytes) R#7 (8-bytes) ] + +CHECK: Record ID: 6, instruction offset: 4 +CHECK-NEXT: 2 locations: +CHECK-NEXT: #1: Register R#4 +CHECK-NEXT: #2: Register R#2 CHECK-NEXT: 1 live-outs: [ R#7 (8-bytes) ] + +CHECK: Record ID: 7, instruction offset: 10 +CHECK-NEXT: 2 locations: +CHECK-NEXT: #1: Register R#2 +CHECK-NEXT: #2: Register R#8 +CHECK-NEXT: 1 live-outs: [ R#7 (8-bytes) ] + +CHECK: Record ID: 8, instruction offset: 10 +CHECK-NEXT: 2 locations: +CHECK-NEXT: #1: Register R#2 +CHECK-NEXT: #2: Register R#8 +CHECK-NEXT: 2 live-outs: [ R#0 (8-bytes) R#7 (8-bytes) ] + +CHECK: Record ID: 11, instruction offset: 42 +CHECK-NEXT: 17 locations: +CHECK-NEXT: #1: Register R#9 +CHECK-NEXT: #2: Register R#14 +CHECK-NEXT: #3: Register R#10 +CHECK-NEXT: #4: Register R#3 +CHECK-NEXT: #5: Register R#0 +CHECK-NEXT: #6: Register R#13 +CHECK-NEXT: #7: Register R#12 +CHECK-NEXT: #8: Register R#15 +CHECK-NEXT: #9: Indirect [R#6 + 72] +CHECK-NEXT: #10: Indirect [R#6 + 80] +CHECK-NEXT: #11: Indirect [R#6 + 88] +CHECK-NEXT: #12: Indirect [R#6 + 96] +CHECK-NEXT: #13: Indirect [R#6 + 104] +CHECK-NEXT: #14: Indirect [R#6 + 112] +CHECK-NEXT: #15: Indirect [R#6 + 120] +CHECK-NEXT: #16: Indirect [R#6 + 128] +CHECK-NEXT: #17: Indirect [R#6 + 136] +CHECK-NEXT: 1 live-outs: [ R#7 (8-bytes) ] + +CHECK: Record ID: 12, instruction offset: 62 +CHECK-NEXT: 17 locations: +CHECK-NEXT: #1: Register R#0 +CHECK-NEXT: #2: Register R#14 +CHECK-NEXT: #3: Register R#10 +CHECK-NEXT: #4: Register R#9 +CHECK-NEXT: #5: Register R#8 +CHECK-NEXT: #6: Register R#4 +CHECK-NEXT: #7: Register R#1 +CHECK-NEXT: #8: Register R#2 +CHECK-NEXT: #9: Register R#5 +CHECK-NEXT: #10: Register R#3 +CHECK-NEXT: #11: Register R#13 +CHECK-NEXT: #12: Register R#12 +CHECK-NEXT: #13: Register R#15 +CHECK-NEXT: #14: Indirect [R#6 + 112] +CHECK-NEXT: #15: Indirect [R#6 + 120] +CHECK-NEXT: #16: Indirect [R#6 + 128] +CHECK-NEXT: #17: Indirect [R#6 + 136] +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 13, instruction offset: 50 +CHECK-NEXT: 1 locations: +CHECK-NEXT: #1: Indirect [R#6 + -48] +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 14, instruction offset: 24 +CHECK-NEXT: 2 locations: +CHECK-NEXT: #1: Register R#0 +CHECK-NEXT: #2: Register R#3 +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 15, instruction offset: 4 +CHECK-NEXT: 1 locations: +CHECK-NEXT: #1: Constant 33 +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 16, instruction offset: 32 +CHECK-NEXT: 1 locations: +CHECK-NEXT: #1: Direct R#6 + -32 +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 17, instruction offset: 32 +CHECK-NEXT: 2 locations: +CHECK-NEXT: #1: Direct R#6 + -8 +CHECK-NEXT: #2: Direct R#6 + -40 +CHECK-NEXT: 1 live-outs: [ R#7 (8-bytes) ] + +CHECK: Record ID: 4294967295, instruction offset: 4 +CHECK-NEXT: 0 locations: +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 4294967296, instruction offset: 4 +CHECK-NEXT: 0 locations: +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 9223372036854775807, instruction offset: 4 +CHECK-NEXT: 0 locations: +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 18446744073709551615, instruction offset: 4 +CHECK-NEXT: 0 locations: +CHECK-NEXT: 1 live-outs: [ R#7 (8-bytes) ] + +CHECK: Record ID: 16, instruction offset: 18 +CHECK-NEXT: 1 locations: +CHECK-NEXT: #1: Indirect [R#6 + -44] +CHECK-NEXT: 0 live-outs: [ ] + +CHECK: Record ID: 0, instruction offset: 26 +CHECK-NEXT: 0 locations: +CHECK-NEXT: 0 live-outs: [ ] |