[PATCH] D84923: [ARM] Fix so immediates and pc relative checks

Simon Wallis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 05:17:37 PDT 2020


simonwallis2 added inline comments.


================
Comment at: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:287
+      case ARM::LEApcrel:
+        return 4;
+      case ARM::t2LEApcrel:
----------------
dmgreen wrote:
> simonwallis2 wrote:
> > dmgreen wrote:
> > > Why 4 and not 8? I think it's meant to be "2 instructions widths"
> > Value of 4 was determined empirically.
> You fill me with confidence. And would 8 empirically have problems too?
Values of 0 or 8 cause:  error: out of range pc-relative fixup value
A value of 4 did not cause failures.

Why 4 and not 8? 
It depends on where you start measuring.  I have not pinpointed where, 
but I believe that the base address from which the offset was calculated has already been adjusted by 4 bytes,
to take into account the width of the load instruction,
that is to say that it points to the address of the instruction after the load, rather than the load itself.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84923/new/

https://reviews.llvm.org/D84923



More information about the llvm-commits mailing list