Last active
September 25, 2023 06:22
-
-
Save katrinafyi/c33f6f9ccaad4420f76f84e6cb219fe0 to your computer and use it in GitHub Desktop.
patch for https://github.com/avast/retdec for use with https://github.com/UQ-PAC/llvm-translator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d5b64b718f2a14669f2a95dbbf3b456528f7084a Mon Sep 17 00:00:00 2001 | |
From: Kait Lam <k@rina.fyi> | |
Date: Sat, 2 Sep 2023 10:14:29 +1000 | |
Subject: [PATCH] emit names for capstone intrinsics. | |
--- | |
src/capstone2llvmir/capstone2llvmir_impl.cpp | 13 +++++++------ | |
1 file changed, 7 insertions(+), 6 deletions(-) | |
diff --git a/src/capstone2llvmir/capstone2llvmir_impl.cpp b/src/capstone2llvmir/capstone2llvmir_impl.cpp | |
index 02ecca26..ba814d2a 100644 | |
--- a/src/capstone2llvmir/capstone2llvmir_impl.cpp | |
+++ b/src/capstone2llvmir/capstone2llvmir_impl.cpp | |
@@ -781,7 +781,8 @@ void Capstone2LlvmIrTranslator_impl<CInsn, CInsnOp>::generateSpecialAsm2LlvmMapG | |
t, | |
false, // isConstant | |
lt, | |
- initializer); | |
+ initializer, | |
+ "capstone_asm2llvm"); | |
} | |
template <typename CInsn, typename CInsnOp> | |
@@ -806,7 +807,7 @@ void Capstone2LlvmIrTranslator_impl<CInsn, CInsnOp>::generateCallFunction() | |
_callFunction = llvm::Function::Create( | |
ft, | |
llvm::GlobalValue::LinkageTypes::ExternalLinkage, | |
- "", | |
+ "capstone_call", | |
_module); | |
} | |
@@ -846,7 +847,7 @@ void Capstone2LlvmIrTranslator_impl<CInsn, CInsnOp>::generateReturnFunction() | |
_returnFunction = llvm::Function::Create( | |
ft, | |
llvm::GlobalValue::LinkageTypes::ExternalLinkage, | |
- "", | |
+ "capstone_return", | |
_module); | |
} | |
@@ -886,7 +887,7 @@ void Capstone2LlvmIrTranslator_impl<CInsn, CInsnOp>::generateBranchFunction() | |
_branchFunction = llvm::Function::Create( | |
ft, | |
llvm::GlobalValue::LinkageTypes::ExternalLinkage, | |
- "", | |
+ "capstone_branch", | |
_module); | |
} | |
@@ -914,7 +915,7 @@ void Capstone2LlvmIrTranslator_impl<CInsn, CInsnOp>::generateCondBranchFunction( | |
_condBranchFunction = llvm::Function::Create( | |
ft, | |
llvm::GlobalValue::LinkageTypes::ExternalLinkage, | |
- "", | |
+ "capstone_branch_cond", | |
_module); | |
} | |
@@ -1572,7 +1573,7 @@ llvm::Function* Capstone2LlvmIrTranslator_impl<CInsn, CInsnOp>::getPseudoAsmFunc | |
auto* fnc = llvm::Function::Create( | |
type, | |
llvm::GlobalValue::LinkageTypes::ExternalLinkage, | |
- n, | |
+ "capstone_pseudo_asm_ " + n, | |
_module); | |
_insn2asmFunctions[p] = fnc; | |
_asmFunctions.insert(fnc); | |
-- | |
2.42.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment