[PATCH] D55303: [RISCV, WIP] Add lowering of addressing sequences for PIC

Lewis Revill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 13 01:33:19 PST 2018


lewis-revill marked an inline comment as done.
lewis-revill added inline comments.


================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:353
+template <class NodeTy>
+SDValue RISCVTargetLowering::getAddrPIC(NodeTy *N, SelectionDAG &DAG,
+                                        bool UseGOT, unsigned Flags) const {
----------------
jrtc27 wrote:
> Can we combine this with `getAddr`, pushing the common `isPositionIndependent()` check inside `getAddr`? Then the `UseGOT` flag becomes `NonLocal` or similar (or alternatively invert it and make it an `IsLocal` flag), and happens to only influence code generation for PIC. This should simplify all its uses.
I'm not sure this is a good idea? We'd still have to check in `lowerGlobalAddress` for GOT, and I feel leaving `getAddr` to check `isPositionIndependent` seems misleading, and the other option is to end up checking `isPositionIndependent` twice for this path, and gaining nothing in the process. It's certainly doable though, if people think it is clearer.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55303/new/

https://reviews.llvm.org/D55303





More information about the llvm-commits mailing list