[PATCH] D126628: [JITLink][AARCH64][NFC] Create isLoadStoreImm12 function by splitting getPageOffset12Shift

Sunho Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 29 23:51:33 PDT 2022


sunho created this revision.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
sunho requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Split getPageOffset12Shift function to get isLoadStoreImm12 util function which will be used for validating elf/aarch64 ldst relocation types.


https://reviews.llvm.org/D126628

Files:
  llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h


Index: llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
+++ llvm/include/llvm/ExecutionEngine/JITLink/aarch64.h
@@ -43,11 +43,15 @@
 /// only
 const char *getEdgeKindName(Edge::Kind K);
 
-inline unsigned getPageOffset12Shift(uint32_t Instr) {
+inline bool isLoadStoreImm12(uint32_t Instr) {
   constexpr uint32_t LoadStoreImm12Mask = 0x3b000000;
+  return (Instr & LoadStoreImm12Mask) == 0x39000000;
+}
+
+inline 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126628.432842.patch
Type: text/x-patch
Size: 844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220530/065571b6/attachment.bin>


More information about the llvm-commits mailing list