This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC][Future] Add initial support for PC Relative addressing to get jump table base address
ClosedPublic

Authored by NeHuang on Mar 10 2020, 9:34 AM.

Details

Summary

Add initial support for PCRelative addressing to get jump table base address instead of using TOC.

Diff Detail

Event Timeline

NeHuang created this revision.Mar 10 2020, 9:34 AM
NeHuang updated this revision to Diff 250805.Mar 17 2020, 9:43 AM
amyk added a subscriber: amyk.Mar 21 2020, 3:31 PM
amyk added inline comments.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
2856

I think it would be good if we can put a comment above briefly saying what happens when we have PC relative mem ops.

nemanjai accepted this revision.Mar 23 2020, 12:48 PM

LGTM aside from a couple of nits. Feel free to address those on the commit.

llvm/test/CodeGen/PowerPC/jump-table.ll
13

I think it would be useful to show how the base address is used as well. Please add checks for at least all the instructions until the bctr

This revision is now accepted and ready to land.Mar 23 2020, 12:48 PM
nemanjai added inline comments.Mar 23 2020, 12:50 PM
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
2856

Also, remove this from the AIX block as there is no PC-Rel on AIX.

anil9 added a subscriber: anil9.Apr 4 2020, 7:30 PM
anil9 added inline comments.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
2554

The naming of the SDNodes is not consistent

ConstPoolNode/ GSDN / JT

NeHuang marked 3 inline comments as done.Apr 8 2020, 12:47 PM
NeHuang marked an inline comment as done.Apr 13 2020, 8:41 AM
NeHuang added inline comments.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
2554

SDNodes GSDN and JT were following the same name convention in "PPCTargetLowering::LowerGlobalAddress" and "PPCTargetLowering::LowerJumpTable", however "ConstPoolNode" is different from the name in "LowerConstantPool"

As the code design here has been updated based on nemanja's suggestion in https://reviews.llvm.org/D76294, we can either change the naming for "ConstPoolNode" or apply similar new design here.

NeHuang marked an inline comment as done.Apr 13 2020, 8:41 AM
NeHuang updated this revision to Diff 258161.Apr 16 2020, 1:37 PM

Addressed review comment.

This revision was automatically updated to reflect the committed changes.