[BPF] Generate BTF DebugInfo under BPF target
authorYonghong Song <yhs@fb.com>
Wed, 19 Dec 2018 16:40:25 +0000 (16:40 +0000)
committerYonghong Song <yhs@fb.com>
Wed, 19 Dec 2018 16:40:25 +0000 (16:40 +0000)
commit7b410ac352bea299441a34f3b899e728bae460a7
treebc17e744edff0a02e91472f79f9d88c39f657223
parent8d221b40a7963caf19eaedf29f0512f6a09cd994
[BPF] Generate BTF DebugInfo under BPF target

This patch implements BTF (BPF Type Format).
The BTF is the debug info format for BPF, introduced
in the below linux patch:
  https://github.com/torvalds/linux/commit/69b693f0aefa0ed521e8bd02260523b5ae446ad7#diff-06fb1c8825f653d7e539058b72c83332
and further extended several times, e.g.,
  https://www.spinics.net/lists/netdev/msg534640.html
  https://www.spinics.net/lists/netdev/msg538464.html
  https://www.spinics.net/lists/netdev/msg540246.html

The main advantage of implementing in LLVM is:
   . better integration/deployment as no extra tools are needed.
   . bpf JIT based compilation (like bcc, bpftrace, etc.) can get
     BTF without much extra effort.
   . BTF line_info needs selective source codes, which can be
     easily retrieved when inside the compiler.

This patch implemented BTF generation by registering a BPF
specific DebugHandler in BPFAsmPrinter.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D55752

llvm-svn: 349640
43 files changed:
llvm/lib/Target/BPF/BPFAsmPrinter.cpp
llvm/lib/Target/BPF/BTF.def [new file with mode: 0644]
llvm/lib/Target/BPF/BTF.h [new file with mode: 0644]
llvm/lib/Target/BPF/BTFDebug.cpp [new file with mode: 0644]
llvm/lib/Target/BPF/BTFDebug.h [new file with mode: 0644]
llvm/lib/Target/BPF/CMakeLists.txt
llvm/test/CodeGen/BPF/BTF/array-1d-char.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/array-1d-int.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/array-2d-int.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/array-size-0.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/array-typedef.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/binary-format.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/char.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/enum-basic.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/func-non-void.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/func-source.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/func-typedef.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/func-void.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/fwd-no-define.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/fwd-with-define.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/int.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/longlong.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-const-void.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-func-1.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-func-2.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-func-3.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-int.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-void.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-volatile-const-void.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ptr-volatile-void.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/restrict-ptr.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/short.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/struct-anon.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/struct-basic.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/struct-bitfield-typedef.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/struct-enum.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/uchar.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/uint.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ulonglong.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/union-array-typedef.ll [new file with mode: 0644]
llvm/test/CodeGen/BPF/BTF/ushort.ll [new file with mode: 0644]