[llvm] 0e7ff05 - [BPF][DebugInfo][NFC] Move BTF.h definitions from BPF target to DebugInfo

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 14:50:25 PDT 2023


Author: Eduard Zingerman
Date: 2023-07-10T14:50:21-07:00
New Revision: 0e7ff05fb35169addd970f55b2692382ad290b78

URL: https://github.com/llvm/llvm-project/commit/0e7ff05fb35169addd970f55b2692382ad290b78
DIFF: https://github.com/llvm/llvm-project/commit/0e7ff05fb35169addd970f55b2692382ad290b78.diff

LOG: [BPF][DebugInfo][NFC] Move BTF.h definitions from BPF target to DebugInfo

There are plans to add some BTF processing to tools like objdump and
readelf. This commit moves BTF.{h,def} files from BPF target specific
location to include/llvm/DebugInfo/* to avoid tools including headers
from lib/Target/*.

Reviewed By: yonghong-song, MaskRay

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

Added: 
    llvm/include/llvm/DebugInfo/BTF/BTF.def
    llvm/include/llvm/DebugInfo/BTF/BTF.h

Modified: 
    llvm/lib/Target/BPF/BTFDebug.cpp
    llvm/lib/Target/BPF/BTFDebug.h

Removed: 
    llvm/lib/Target/BPF/BTF.def
    llvm/lib/Target/BPF/BTF.h


################################################################################
diff  --git a/llvm/lib/Target/BPF/BTF.def b/llvm/include/llvm/DebugInfo/BTF/BTF.def
similarity index 100%
rename from llvm/lib/Target/BPF/BTF.def
rename to llvm/include/llvm/DebugInfo/BTF/BTF.def

diff  --git a/llvm/lib/Target/BPF/BTF.h b/llvm/include/llvm/DebugInfo/BTF/BTF.h
similarity index 94%
rename from llvm/lib/Target/BPF/BTF.h
rename to llvm/include/llvm/DebugInfo/BTF/BTF.h
index 89852be4a8c8fd..a4ba7c955dc8f1 100644
--- a/llvm/lib/Target/BPF/BTF.h
+++ b/llvm/include/llvm/DebugInfo/BTF/BTF.h
@@ -152,9 +152,9 @@ struct BTFEnum {
 /// The exact number of BTFEnum64 is stored in the vlen (of the
 /// info in "struct CommonType").
 struct BTFEnum64 {
-  uint32_t NameOff; ///< Enum name offset in the string table
-  uint32_t Val_Lo32;     ///< Enum member lo32 value
-  uint32_t Val_Hi32;     ///< Enum member hi32 value
+  uint32_t NameOff;  ///< Enum name offset in the string table
+  uint32_t Val_Lo32; ///< Enum member lo32 value
+  uint32_t Val_Hi32; ///< Enum member hi32 value
 };
 
 /// BTF_KIND_ARRAY is followed by one "struct BTFArray".
@@ -218,10 +218,10 @@ struct ExtHeader {
   uint8_t Flags;
   uint32_t HdrLen;
 
-  uint32_t FuncInfoOff;    ///< Offset of func info section
-  uint32_t FuncInfoLen;    ///< Length of func info section
-  uint32_t LineInfoOff;    ///< Offset of line info section
-  uint32_t LineInfoLen;    ///< Length of line info section
+  uint32_t FuncInfoOff;   ///< Offset of func info section
+  uint32_t FuncInfoLen;   ///< Length of func info section
+  uint32_t LineInfoOff;   ///< Offset of line info section
+  uint32_t LineInfoLen;   ///< Length of line info section
   uint32_t FieldRelocOff; ///< Offset of offset reloc section
   uint32_t FieldRelocLen; ///< Length of offset reloc section
 };
@@ -263,7 +263,7 @@ struct BPFFieldReloc {
 
 /// Specifying offset relocation's in one section.
 struct SecFieldReloc {
-  uint32_t SecNameOff;     ///< Section name index in the .BTF string table
+  uint32_t SecNameOff;    ///< Section name index in the .BTF string table
   uint32_t NumFieldReloc; ///< Number of offset reloc's in this section
 };
 

diff  --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index e1a3e08d95b63b..485ba88a4654b7 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -30,7 +30,7 @@ using namespace llvm;
 
 static const char *BTFKindStr[] = {
 #define HANDLE_BTF_KIND(ID, NAME) "BTF_KIND_" #NAME,
-#include "BTF.def"
+#include "llvm/DebugInfo/BTF/BTF.def"
 };
 
 /// Emit a BTF common type.

diff  --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h
index f0b42232f4d559..7536006ed21ccd 100644
--- a/llvm/lib/Target/BPF/BTFDebug.h
+++ b/llvm/lib/Target/BPF/BTFDebug.h
@@ -16,11 +16,11 @@
 
 #include "llvm/ADT/StringMap.h"
 #include "llvm/CodeGen/DebugHandlerBase.h"
+#include "llvm/DebugInfo/BTF/BTF.h"
 #include <cstdint>
 #include <map>
 #include <set>
 #include <unordered_map>
-#include "BTF.h"
 
 namespace llvm {
 


        


More information about the llvm-commits mailing list