Add initial support for PCRelative addressing to get block address instead of using TOC.
Details
Details
- Reviewers
hfinkel nemanjai stefanp lei power-llvm-team - Group Reviewers
Restricted Project - Commits
- rGa60ca4b4e9b1: [PowerPC][Future] Initial support for PCRel addressing to get block address
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
2953 | I think it would be good if we can put a comment above briefly saying what happens when we have PC relative mem ops. |
Comment Actions
LGTM aside from some nits that should be easily addressable on the commit.
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
2601 | This is starting to get unnecessary. There is no reason to have all the different bool variables. bool ValidPCRelNode = false; #define VALIDATE_PCREL_NODE(TYPE) \ { \ TYPE *PCRelCand = dyn_cast<TYPE>(N); \ if (PCRelCand && PCRelCand->getTargetFlags() == PPCII::MO_PCREL_FLAG) \ ValidPCRelNode = true; \ } VALIDATE_PCREL_NODE(ConstantPoolSDNode); VALIDATE_PCREL_NODE(GlobalAddressSDNode); VALIDATE_PCREL_NODE(JumpTableSDNode); VALIDATE_PCREL_NODE(BlockAddressSDNode); if (ValidPCRelNode) { Base = N; return true; } return false; #undef VALIDATE_PCREL_NODE Or define a template such as: template <typename Ty> static bool isValidPCRelNode(SDValue N) { Ty *PCRelCand = dyn_cast<Ty>(N); return PCRelCand && PCRelCand->getTargetFlags() == PPCII::MO_PCREL_FLAG; } And then this function is just: if (isValidPCRelNode<ConstantPoolSDNode>(N) || isValidPCRelNode<GlobalAddressSDNode>(N) || isValidPCRelNode<JumpTableSDNode>(N) || isValidPCRelNode<BlockAddressSDNode>(N)) { Base = N; return true; } return false; My preference being for the latter. | |
2953 | Remove this from the AIX block as there is no PC-Rel on AIX. |
This is starting to get unnecessary. There is no reason to have all the different bool variables.
Something like this might be more readable:
Or define a template such as:
And then this function is just:
My preference being for the latter.