[PATCH] D107032: [llvm-objdump][CallGraphInfo][NFC] Introduce FunctionKind enum
Necip Fazil Yildiran via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 21:52:12 PDT 2021
necipfazil created this revision.
Herald added a subscriber: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
necipfazil requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Add FunctionKind enumeration for mapping function kinds to values from
.callgraph section.
This will be used in the upcoming patches where the .callgraph section is
parsed.
Patch 5/6: Extract call graph information from binary
Original RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-June/151044.html
Updated RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-July/151739.html
Repository:
rG LLVM Github Monorepo
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,23 @@
static bool QuietDisasm;
+// Enumeration of function kinds, and their mapping to function kind values
+// from call graph section (.callgraph).
+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;
using DirectCallSite = std::pair<uint64_t /*CallSite*/, uint64_t /*Callee*/>;
SmallVector<DirectCallSite> DirectCallSites;
@@ -1383,6 +1398,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.362629.patch
Type: text/x-patch
Size: 1386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210729/9334c6d9/attachment.bin>
More information about the llvm-commits
mailing list