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

Lewis Revill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 14:38:57 PST 2018


lewis-revill added a comment.

In D54143#1319641 <https://reviews.llvm.org/D54143#1319641>, @jrtc27 wrote:

> In D54143#1319494 <https://reviews.llvm.org/D54143#1319494>, @lewis-revill wrote:
>
> > I've tried re-using PseudoLLA, but I just cannot get around the problem of expanding it in the MC layer. If I try expanding it in `RISCVMCCodeEmitter` there is no way to get/create an appropriate expression to use for the `%pcrel_lo` relocation. It would be nice if it was possible to create a `<.text+offset>` expression for the AUIPC instruction but I just don't know how. Otherwise I have also tried splitting up the instruction earlier, but the AUIPC/ADDI get split up too often to make it feasible. Also there's no real benefit because `RISCVMergeBaseOffset` cannot work on the `%pcrel_lo` base symbols without a great deal of modification. @rogfer01 what do you do differently to this patch for the PC-relative case?
>
>
> Why can't it be expanded in `RISCVExpandPseudo`? If it works for a new `PseudoAddrPCRel`, it works if you instead use `PseudoLLA`. All you need is a find/replace of `PseudoAddrPCRel` with `PseudoLLA` (and of course removing all the definitions of `PseudoAddrPCRel`).


Ah I see now. What I thought was meant by reusing `PseudoLLA` was to deduplicate code with a single expansion of the instruction in the MC layer, rather than just to remove this extra pseudo. So if I understand correctly we'd have a `PseudoLLA` expansion in codegen (`RISCVExpandPseudo`) and an expansion in the MC layer (`RISCVAsmParser`)?

My only problem with that approach is that it seems wrong to expand `PseudoLLA` the same way I am expanding `PseudoAddrPCRel`, IE allowing the AUIPC operand to be decided by codegen.


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