[NFC][ORC][AArch64] use isInt<N> to replace fitsRangeSignedInt on aarch64

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

Differential Revision: https://reviews.llvm.org/D118231
This commit is contained in:
dongAxis 2022-01-26 23:22:09 +08:00
parent 63daea8b35
commit df597bf000
1 changed files with 2 additions and 5 deletions

View File

@ -16,6 +16,7 @@
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/ExecutionEngine/JITLink/aarch64.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Support/MathExtras.h"
#define DEBUG_TYPE "jitlink"
@ -51,7 +52,7 @@ private:
if (static_cast<uint64_t>(Value) & 0x3)
return make_error<JITLinkError>("Call target is not 32-bit aligned");
if (!fitsRangeSignedInt<27>(Value))
if (!isInt<28>(Value))
return makeTargetOutOfRangeError(G, B, E);
uint32_t RawInstr = *(little32_t *)FixupPtr;
@ -65,10 +66,6 @@ private:
}
return Error::success();
}
template <uint8_t Bits> static bool fitsRangeSignedInt(int64_t Value) {
return Value >= -(1ll << Bits) && Value < (1ll << Bits);
}
};
template <typename ELFT>