[llvm] 9f29916 - [JITLink][AArch64] Refactor isLoadStoreImm12 check out of getPageOffset12Shift.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 13:18:19 PDT 2022
Author: Sunho Kim
Date: 2022-06-07T13:18:12-07:00
New Revision: 9f29916169fab99bc26378a56bbcc80e88a9d678
URL: https://github.com/llvm/llvm-project/commit/9f29916169fab99bc26378a56bbcc80e88a9d678
DIFF: https://github.com/llvm/llvm-project/commit/9f29916169fab99bc26378a56bbcc80e88a9d678.diff
LOG: [JITLink][AArch64] Refactor isLoadStoreImm12 check out of getPageOffset12Shift.
The separate isLoadStoreImm12 predicate will be used for validating ELF/aarch64
ldst relocation types.
Reviewed By: lhames, sgraenitz
Differential Revision: https://reviews.llvm.org/D126628
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h b/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
index ef38a1690c9b2..5662c433d96a8 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
@@ -43,6 +43,8 @@ enum EdgeKind_aarch64 : Edge::Kind {
/// only
const char *getEdgeKindName(Edge::Kind K);
+bool isLoadStoreImm12(uint32_t Instr);
+
unsigned getPageOffset12Shift(uint32_t Instr);
Error applyFixup(LinkGraph &G, Block &B, const Edge &E);
diff --git a/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp b/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
index 5a1aaee512e55..a4878f38bb4bd 100644
--- a/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/aarch64.cpp
@@ -18,11 +18,15 @@ namespace llvm {
namespace jitlink {
namespace aarch64 {
-unsigned getPageOffset12Shift(uint32_t Instr) {
+bool isLoadStoreImm12(uint32_t Instr) {
constexpr uint32_t LoadStoreImm12Mask = 0x3b000000;
+ return (Instr & LoadStoreImm12Mask) == 0x39000000;
+}
+
+unsigned getPageOffset12Shift(uint32_t Instr) {
constexpr uint32_t Vec128Mask = 0x04800000;
- if ((Instr & LoadStoreImm12Mask) == 0x39000000) {
+ if (isLoadStoreImm12(Instr)) {
uint32_t ImplicitShift = Instr >> 30;
if (ImplicitShift == 0)
if ((Instr & Vec128Mask) == Vec128Mask)
More information about the llvm-commits
mailing list