[PATCH] D105528: [RuntimeDyldChecker] Support offset in decode_operand expr
Lang Hames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 03:33:07 PDT 2021
lhames added a comment.
In D105528#2861144 <https://reviews.llvm.org/D105528#2861144>, @jrtc27 wrote:
> Why can't you just add a label for the instruction you want to test?
Actually I really like the idea of allowing offsets here. Avoiding artificial labels has two benefits: improved readability, and clearer layout control on MachO where labels implicitly start new subsections.
> This is just (named_data - test_pcrel32) & 0xfff sign-extended from 12 to 64 bits. The + 0x800 for the HI is to compensate for the sign extension for the LO, feeding it back into the LO calculation is backwards and results in circular reasoning.
I don't know RISCV, so I defer to Jessica here.
Side note: Some comparisons may be easier to express with the bit-slicing operator. E.g. this example from MachO_arm64_relocations.s:
# jitlink-check: decode_operand(test_local_call, 0)[25:0] = (named_func - test_local_call)[27:2]
.globl test_local_call
.p2align 2
test_local_call:
bl named_func
Please address Jessica's feedback, but otherwise LGTM. Thanks Stephen!
================
Comment at: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp:240-247
+ case BinOpToken::Add:
+ case BinOpToken::Sub: {
+ EvalResult Number;
+ std::tie(Number, RemainingExpr) = evalNumberExpr(RemainingExpr);
+ Offset =
+ BinOp == BinOpToken::Add ? Number.getValue() : -Number.getValue();
+ break;
----------------
You should error out for the other binop tokens with an unexpected token error.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105528/new/
https://reviews.llvm.org/D105528
More information about the llvm-commits
mailing list