+static bool reloc_call(tcg_insn_unit *src_rw, const tcg_insn_unit *target)
+{
+ const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw);
+ intptr_t offset = (intptr_t)target - (intptr_t)src_rx;
+ int32_t lo = sextreg(offset, 0, 12);
+ int32_t hi = offset - lo;
+
+ tcg_debug_assert((offset & 2) == 0);
+ if (offset == hi + lo) {
+ hi >>= 12;
+ src_rw[0] |= (hi << 5) & 0x1ffffe0; /* pcaddu12i's Sj20 imm */
+ lo >>= 2;
+ src_rw[1] |= (lo << 10) & 0x3fffc00; /* jirl's Sk16 imm */
+ return true;
+ }
+
+ return false;
+}