[PATCH] D54143: [WIP, RISCV] Generate address sequences suitable for mcmodel=medium

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 6 16:57:01 PST 2018


jrtc27 added a comment.

In D54143#1322247 <https://reviews.llvm.org/D54143#1322247>, @lewis-revill wrote:

> In D54143#1322155 <https://reviews.llvm.org/D54143#1322155>, @jrtc27 wrote:
>
> > In D54143#1321605 <https://reviews.llvm.org/D54143#1321605>, @lewis-revill wrote:
> >
> > > So my problem is that (if we expand `PseudoLLA` in codegen in the same way as we do in `RISCVAsmParser`) then we lose some flexibility for later addressing uses. Currently I can use the wrapper to do `(WrapperPCRel %pcrel_hi(sym))`, `(WrapperPCRel %got_pcrel_hi(sym))`, `(WrapperPCRel %tls_ie_pcrel_hi(sym))` and `(WrapperPCRel %tls_gd_pcrel_hi(sym))`, whereas with `PseudoLLA` I am limited to just `%pcrel_hi` addressing. The addition of `PseudoLA` would help greatly, but only for PIC, not for TLS, meaning another wrapper would be required anyway. Maybe this is an acceptable approach to use `PseudoLLA` and `PseudoLA` where it fits then add a wrapper later?
> >
> >
> > For TLS you'd then use the yet-to-be-implemented `PseudoLA_TLS_GD` and `PseudoLA_TLS_IE` (or whatever they end up being called) representing the `la.tls.gd` and `la.tls.ie` macros/pseudo-instructions. Anything you could want to use `WrapperPCRel` will need a corresponding `PseudoFOO` to exist for the assembly parser, so I still fail to see why we would need this extra wrapper. I really like having the exact correspondence between what CodeGen produces and what the equivalent hand-written assembly would be parsed to.
>
>
> Thanks, this clears things up for me. I understand why that would be the better approach now. I did see that those pseudo instructions are what GCC produces but since they weren't part of the RISCV specifications I didn't think about using them in LLVM. I'll try to make these changes and add patches where necessary.


Glad things are clear and we're now in agreement! They're specified in the psABI document, but not the assembly manual; go figure. I may try and tidy things up a bit tomorrow on the documentation front...


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54143





More information about the llvm-commits mailing list