aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorPrabhu Rajasekaran <prabhukr@google.com>2025-07-31 07:34:46 -0700
committerGitHub <noreply@github.com>2025-07-31 07:34:46 -0700
commit9e0dc4f7377b9614944de0fc40638451d0cfd8da (patch)
tree85409d6871773a5414c78dccd4836069bc614a9a /llvm/lib/CodeGen/MachineFunction.cpp
parent77f8a9115e73e1d32f121a362eb5340c180c620d (diff)
downloadllvm-9e0dc4f7377b9614944de0fc40638451d0cfd8da.zip
llvm-9e0dc4f7377b9614944de0fc40638451d0cfd8da.tar.gz
llvm-9e0dc4f7377b9614944de0fc40638451d0cfd8da.tar.bz2
[MachineFunction] Move CallSiteInfo constructor out of header (#151520)
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 60d42e0..ec40f6a 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -698,6 +698,26 @@ bool MachineFunction::needsFrameMoves() const {
!F.getParent()->debug_compile_units().empty();
}
+MachineFunction::CallSiteInfo::CallSiteInfo(const CallBase &CB) {
+ // Numeric callee_type ids are only for indirect calls.
+ if (!CB.isIndirectCall())
+ return;
+
+ MDNode *CalleeTypeList = CB.getMetadata(LLVMContext::MD_callee_type);
+ if (!CalleeTypeList)
+ return;
+
+ for (const MDOperand &Op : CalleeTypeList->operands()) {
+ MDNode *TypeMD = cast<MDNode>(Op);
+ MDString *TypeIdStr = cast<MDString>(TypeMD->getOperand(1));
+ // Compute numeric type id from generalized type id string
+ uint64_t TypeIdVal = MD5Hash(TypeIdStr->getString());
+ IntegerType *Int64Ty = Type::getInt64Ty(CB.getContext());
+ CalleeTypeIds.push_back(
+ ConstantInt::get(Int64Ty, TypeIdVal, /*IsSigned=*/false));
+ }
+}
+
namespace llvm {
template<>