[PATCH] D104564: [AArch64][X86] Allow 64-bit label differences lower to IMAGE_REL_*_REL32

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 14:49:58 PDT 2021


MaskRay added a comment.

In D104564#2831690 <https://reviews.llvm.org/D104564#2831690>, @rnk wrote:

> I was going to say, I wonder if it would be better to find a way to put the extension in IR instead of in the assembler. For example, maybe the IR could look like (pseudo-IR):
> `zext i64 (trunc i32 (sub i64 (ptrtoint i64 @label2)), (ptrtoint i64 @label1))))`
> So that would slot into the constant inititalizer, and the backend would know to emit that pattern as:
>
>   .long 0
>   .long label2 - label1
>
> Now that I've written it out, it seems worse and more complex. Let's go with .quad I guess.

Thanks!

The IR approach would mean every new relative metadata usage needs to be different for COFF and non-COFF.
Label differences are probably not that common today but may get more uses in the future, e.g. https://lists.llvm.org/pipermail/llvm-dev/2021-June/151198.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104564



More information about the llvm-commits mailing list