This patch adds PC Relative support for global values that are known at link time.
If a global value requires access through the global offset table (GOT) it is not covered in this patch.
Details
- Reviewers
nemanjai lei hfinkel - Group Reviewers
Restricted Project - Commits
- rG18b605032412: [PowerPC][Future] Initial support for PC Relative addressing for global values
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/PowerPC/PPCInstrInfo.td | ||
---|---|---|
978 ↗ | (On Diff #249420) | Why is this code move needed? |
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
2591–2592 | Does it make sense to also add that it is a PC Relative address if it's marked with the PPCII::MO_PCREL_FLAG or if the node opcode is PPCISD::MAT_PCREL_ADDR? |
My comments are quite minor so feel free to address them on the commit. LGTM.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
2594 | The logic might be easier to follow if we do something like: Base = N; if (N.getOpcode() == PPCISD::MAT_PCREL_ADDR) return true; if (ConstantPoolSDNode *CPN = dyn_cast<ConstantPoolSDNode>(N) && (CPN->getTargetFlags() & PPCII::MO_PCREL_FLAG)) return true; if (GlobalAddressSDNode *GAN = dyn_cast<GlobalAddressSDNode>(N) && (GAN->getTargetFlags() & PPCII::MO_PCREL_FLAG)) return true; return false; | |
3053–3059 | Please remove this from the AIX block. There is no current plan to support PC-relative addressing on AIX. |
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
2594 | There is a slight change in logic with the above code. In the current implementation Base will not be set to N if the result is false, but with the code in the comment it will always be set to N. |
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
2595 | The naming convention is a bit inconsistent : GSDN / ConstPoolNode , this inconsistency is carried over this patch too. https://reviews.llvm.org/D75931 JumpTableSDNode *JT = dyn_cast<JumpTableSDNode>(N.getNode()); |
Does it make sense to also add that it is a PC Relative address if it's marked with the PPCII::MO_PCREL_FLAG or if the node opcode is PPCISD::MAT_PCREL_ADDR?