[llvm-dev] Manipulating global address inside GlobalAddress SDNode in (RISCV) LLVM backend
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Tue Jul 9 09:11:31 PDT 2019
On Tue, 9 Jul 2019 at 14:49, Reshabh Sharma via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> For a GlobalAddress node say i64 = GlobalAddress<0xHighLow> we want to convert it into i32 = GlobalAddress<0xLow>.
I think you'd have to convert it into a custom RISCVGlobalAddressLow
and RISCVGlobalAddressHigh pair because the type of GlobalAddress is
fixed to pointer type in TargetSelectionDAG.td (that's not 100% set in
stone, but I wouldn't violate it lightly). And that might well be
functionally equivalent to making an LUI/ADDI pair directly.
> If there is no direct way to do this, we plan to fall back on a backup plan to convert the GlobalAddress node into the required LUI and ADDI pair but that would require the addition of two new target flag in RISCVII namespace.
I don't think there's a real shortage of those, but I confess I'm not
sure why that's related. You'd need a representation for the LUI and
ADDI after instruction selection anyway.
Cheers.
Tim.
More information about the llvm-dev
mailing list