Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/asmjit/asmjit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkobalicek <kobalicek.petr@gmail.com>2022-03-21 00:40:31 +0300
committerkobalicek <kobalicek.petr@gmail.com>2022-03-21 00:40:31 +0300
commit21a31b8a338da3341d2b423f85913597b8ec3d63 (patch)
tree5872845a1928b0edae5af598d0e97f6e3476f6d6
parentd754de58c20ae6d0e3f7c3994b977fc8b79a6a80 (diff)
[Bug] Fixed incorrect control flow information of 'b' instruction (AArch64) (Fixes #358)
-rw-r--r--src/asmjit/arm/a64rapass.cpp6
-rw-r--r--src/asmjit/core/inst.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/asmjit/arm/a64rapass.cpp b/src/asmjit/arm/a64rapass.cpp
index ad78369..597ae5c 100644
--- a/src/asmjit/arm/a64rapass.cpp
+++ b/src/asmjit/arm/a64rapass.cpp
@@ -102,7 +102,7 @@ public:
// TODO: [ARM] This is just a workaround...
static InstControlFlow getControlFlowType(InstId instId) noexcept {
- switch (instId) {
+ switch (BaseInst::extractRealId(instId)) {
case Inst::kIdB:
case Inst::kIdBr:
if (BaseInst::extractARMCondCode(instId) == CondCode::kAL)
@@ -127,8 +127,8 @@ static InstControlFlow getControlFlowType(InstId instId) noexcept {
Error RACFGBuilder::onInst(InstNode* inst, InstControlFlow& controlType, RAInstBuilder& ib) noexcept {
InstRWInfo rwInfo;
- InstId instId = inst->id();
- if (Inst::isDefinedId(instId)) {
+ if (Inst::isDefinedId(inst->realId())) {
+ InstId instId = inst->id();
uint32_t opCount = inst->opCount();
const Operand* opArray = inst->operands();
ASMJIT_PROPAGATE(InstInternal::queryRWInfo(_arch, inst->baseInst(), opArray, opCount, &rwInfo));
diff --git a/src/asmjit/core/inst.h b/src/asmjit/core/inst.h
index 2310631..919fe92 100644
--- a/src/asmjit/core/inst.h
+++ b/src/asmjit/core/inst.h
@@ -312,6 +312,10 @@ public:
return id | (uint32_t(cc) << Support::ConstCTZ<uint32_t(InstIdParts::kARM_Cond)>::value);
}
+ static inline constexpr InstId extractRealId(uint32_t id) noexcept {
+ return id & uint32_t(InstIdParts::kRealId);
+ }
+
static inline constexpr arm::CondCode extractARMCondCode(uint32_t id) noexcept {
return (arm::CondCode)((uint32_t(id) & uint32_t(InstIdParts::kARM_Cond)) >> Support::ConstCTZ<uint32_t(InstIdParts::kARM_Cond)>::value);
}