[PATCH] D107032: [llvm-objdump][CallGraphInfo][NFC] Introduce FunctionKind enum

Necip Fazil Yildiran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 16:00:22 PDT 2021


necipfazil updated this revision to Diff 362913.
necipfazil marked an inline comment as done.
necipfazil added a comment.

Fix docs


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107032/new/

https://reviews.llvm.org/D107032

Files:
  llvm/tools/llvm-objdump/llvm-objdump.cpp


Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -222,8 +222,24 @@
 
 static bool QuietDisasm = false;
 
+// Enumeration of function kinds, and their mapping to function kind values
+// from call graph section (.callgraph).
+// Must stay in sync with enum from llvm/include/llvm/CodeGen/AsmPrinter.h.
+enum FunctionKind {
+  // Function cannot be target to indirect calls.
+  NOT_INDIRECT_TARGET = 0,
+  // Function may be target to indirect calls but its type id is unknown.
+  INDIRECT_TARGET_UNKNOWN_TID = 1,
+  // Function may be target to indirect calls and its type id is known.
+  INDIRECT_TARGET_KNOWN_TID = 2,
+
+  // Available in the binary but not listed in the call graph section.
+  NOT_LISTED = -1,
+};
+
 struct FunctionInfo {
   std::string Name;
+  FunctionKind Kind;
 
   struct DirectCallSite {
     uint64_t CallSite;
@@ -1388,6 +1404,8 @@
         auto FuncPc = Symbols[SI].Addr;
         auto FuncName = Symbols[SI].Name.str();
         FuncInfo[FuncPc].Name = FuncName;
+        // Initalize to be later updated while parsing the call graph section.
+        FuncInfo[FuncPc].Kind = NOT_LISTED;
       }
       while (Index < End) {
         // ARM and AArch64 ELF binaries can interleave data and text in the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107032.362913.patch
Type: text/x-patch
Size: 1393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210729/46704168/attachment.bin>


More information about the llvm-commits mailing list