[llvm] 3e7cd5e - [JITLink][AArch32] Fixes for initial AArch32 backend
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 04:10:50 PDT 2023
Author: Eymen Ünay
Date: 2023-09-06T13:10:14+02:00
New Revision: 3e7cd5ea1e9bab4fb4fba6c1a31349505a371fde
URL: https://github.com/llvm/llvm-project/commit/3e7cd5ea1e9bab4fb4fba6c1a31349505a371fde
DIFF: https://github.com/llvm/llvm-project/commit/3e7cd5ea1e9bab4fb4fba6c1a31349505a371fde.diff
LOG: [JITLink][AArch32] Fixes for initial AArch32 backend
Fix masking error in Thumb_Jump24
Fix halfword comparisons in asserts
Add Data_Pointer32 to getEdgeKindName
Reviewed By: sgraenitz
Differential Revision: https://reviews.llvm.org/D157540
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h
llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h b/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h
index c05c7ab2ad83185..b21c9e2a1cd8260 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/aarch32.h
@@ -149,7 +149,6 @@ template <> struct FixupInfo<Thumb_Jump24> {
static constexpr HalfWords Opcode{0xf000, 0x8000};
static constexpr HalfWords OpcodeMask{0xf800, 0x8000};
static constexpr HalfWords ImmMask{0x07ff, 0x2fff};
- static constexpr uint16_t LoBitConditional = 0x1000;
};
template <> struct FixupInfo<Thumb_Call> {
diff --git a/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp b/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
index 83829dde0508a8e..e9221a898ff63da 100644
--- a/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
@@ -175,7 +175,7 @@ bool checkRegister(const ThumbRelocation &R, HalfWords Reg) {
template <EdgeKind_aarch32 Kind>
void writeRegister(WritableThumbRelocation &R, HalfWords Reg) {
static constexpr HalfWords Mask = FixupInfo<Kind>::RegMask;
- assert((Mask.Hi & Reg.Hi) == Reg.Hi && (Mask.Hi & Reg.Hi) == Reg.Hi &&
+ assert((Mask.Hi & Reg.Hi) == Reg.Hi && (Mask.Lo & Reg.Lo) == Reg.Lo &&
"Value bits exceed bit range of given mask");
R.Hi = (R.Hi & ~Mask.Hi) | Reg.Hi;
R.Lo = (R.Lo & ~Mask.Lo) | Reg.Lo;
@@ -184,7 +184,7 @@ void writeRegister(WritableThumbRelocation &R, HalfWords Reg) {
template <EdgeKind_aarch32 Kind>
void writeImmediate(WritableThumbRelocation &R, HalfWords Imm) {
static constexpr HalfWords Mask = FixupInfo<Kind>::ImmMask;
- assert((Mask.Hi & Imm.Hi) == Imm.Hi && (Mask.Hi & Imm.Hi) == Imm.Hi &&
+ assert((Mask.Hi & Imm.Hi) == Imm.Hi && (Mask.Lo & Imm.Lo) == Imm.Lo &&
"Value bits exceed bit range of given mask");
R.Hi = (R.Hi & ~Mask.Hi) | Imm.Hi;
R.Lo = (R.Lo & ~Mask.Lo) | Imm.Lo;
@@ -242,10 +242,6 @@ Expected<int64_t> readAddendThumb(LinkGraph &G, Block &B, const Edge &E,
case Thumb_Jump24:
if (!checkOpcode<Thumb_Jump24>(R))
return makeUnexpectedOpcodeError(G, R, Kind);
- if (R.Lo & FixupInfo<Thumb_Jump24>::LoBitConditional)
- return make_error<JITLinkError>("Relocation expects an unconditional "
- "B.W branch instruction: " +
- StringRef(G.getEdgeKindName(Kind)));
return LLVM_LIKELY(ArmCfg.J1J2BranchEncoding)
? decodeImmBT4BlT1BlxT2_J1J2(R.Hi, R.Lo)
: decodeImmBT4BlT1BlxT2(R.Hi, R.Lo);
@@ -352,10 +348,6 @@ Error applyFixupThumb(LinkGraph &G, Block &B, const Edge &E,
case Thumb_Jump24: {
if (!checkOpcode<Thumb_Jump24>(R))
return makeUnexpectedOpcodeError(G, R, Kind);
- if (R.Lo & FixupInfo<Thumb_Jump24>::LoBitConditional)
- return make_error<JITLinkError>("Relocation expects an unconditional "
- "B.W branch instruction: " +
- StringRef(G.getEdgeKindName(Kind)));
if (!(TargetSymbol.hasTargetFlags(ThumbSymbol)))
return make_error<JITLinkError>("Branch relocation needs interworking "
"stub when bridging to ARM: " +
@@ -471,6 +463,7 @@ const char *getEdgeKindName(Edge::Kind K) {
switch (K) {
KIND_NAME_CASE(Data_Delta32)
+ KIND_NAME_CASE(Data_Pointer32)
KIND_NAME_CASE(Arm_Call)
KIND_NAME_CASE(Thumb_Call)
KIND_NAME_CASE(Thumb_Jump24)
More information about the llvm-commits
mailing list