[PATCH] D118231: [ORC][AArch64] use isInt<N> to replace fitsRangeSignedInt on aarch64

Yifeng Dong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 02:59:54 PST 2022


dongAxis1944 created this revision.
dongAxis1944 added a reviewer: sgraenitz.
Herald added subscribers: hiraditya, kristof.beyls.
dongAxis1944 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

summary

  This is the first path to support more relocation types on aarch64.
   The patch just uses the isInt<N> to replace fitsRangeSignedInt.

Test Plan:

  check-all


https://reviews.llvm.org/D118231

Files:
  llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp


Index: llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp
@@ -51,7 +51,7 @@
       if (static_cast<uint64_t>(Value) & 0x3)
         return make_error<JITLinkError>("Call target is not 32-bit aligned");
 
-      if (!fitsRangeSignedInt<27>(Value))
+      if (!isInt<27>(Value))
         return makeTargetOutOfRangeError(G, B, E);
 
       uint32_t RawInstr = *(little32_t *)FixupPtr;
@@ -65,10 +65,6 @@
     }
     return Error::success();
   }
-
-  template <uint8_t Bits> static bool fitsRangeSignedInt(int64_t Value) {
-    return Value >= -(1ll << Bits) && Value < (1ll << Bits);
-  }
 };
 
 template <typename ELFT>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118231.403189.patch
Type: text/x-patch
Size: 792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220126/e1d2a5a5/attachment.bin>


More information about the llvm-commits mailing list