Index: llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h =================================================================== --- llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h +++ llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h @@ -43,6 +43,8 @@ /// 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); Index: llvm/lib/ExecutionEngine/JITLink/aarch64.cpp =================================================================== --- llvm/lib/ExecutionEngine/JITLink/aarch64.cpp +++ llvm/lib/ExecutionEngine/JITLink/aarch64.cpp @@ -18,11 +18,15 @@ 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) @@ -30,8 +34,6 @@ return ImplicitShift; } - - return 0; } Error applyFixup(LinkGraph &G, Block &B, const Edge &E) {