[Stackmap] Added callsite counts to emitted function information.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 14 Sep 2016 20:22:03 +0000 (20:22 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 14 Sep 2016 20:22:03 +0000 (20:22 +0000)
commit23f06e53d8c2febb80192f6ff93bce78a6af011d
treeafb1f3697ae9d2d39ce72b47eb495fa16ff6dc5e
parent3caf155bd3fc22b4d0c0e0dbe540290422ee085b
[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
23 files changed:
llvm/docs/StackMaps.rst
llvm/include/llvm/CodeGen/StackMaps.h
llvm/include/llvm/Object/StackMapParser.h
llvm/lib/CodeGen/StackMaps.cpp
llvm/test/CodeGen/AArch64/arm64-anyregcc.ll
llvm/test/CodeGen/AArch64/arm64-stackmap.ll
llvm/test/CodeGen/AArch64/stackmap-liveness.ll
llvm/test/CodeGen/PowerPC/ppc64-anyregcc.ll
llvm/test/CodeGen/PowerPC/ppc64-stackmap.ll
llvm/test/CodeGen/X86/anyregcc.ll
llvm/test/CodeGen/X86/patchpoint-invoke.ll
llvm/test/CodeGen/X86/stackmap-fast-isel.ll
llvm/test/CodeGen/X86/stackmap-large-constants.ll
llvm/test/CodeGen/X86/stackmap-liveness.ll
llvm/test/CodeGen/X86/stackmap.ll
llvm/test/CodeGen/X86/statepoint-allocas.ll
llvm/test/CodeGen/X86/statepoint-stackmap-format.ll
llvm/test/Object/Inputs/stackmap-test.macho-x86-64
llvm/test/Object/stackmap-dump.test
llvm/tools/llvm-readobj/COFFDumper.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/tools/llvm-readobj/MachODumper.cpp
llvm/tools/llvm-readobj/StackMapPrinter.h