[PATCH] D38343: [X86] Provide the LSDA pointer with RIP relative addressing if necessary

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 23:01:20 PDT 2017


mstorsjo added inline comments.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:20108
                                             Twine(MF.getFunctionNumber()));
-    return DAG.getNode(X86ISD::Wrapper, dl, VT, DAG.getMCSymbol(S, PtrVT));
+    // getGlobalWrapperKind isn't usable here.
+    return DAG.getNode(Subtarget.isPICStyleRIPRel() ? X86ISD::WrapperRIP
----------------
compnerd wrote:
> Im not particularly fond of this comment.  Adding a comment that `getGlobalWrapperKind` is not suitable here is fine.  But please explain //why// it is unsuitable.  Also, it took me a moment to figure out that this is not actually dependent on the PIC mode of compilation, but rather to ensure that the generated code is PIC.  A comment to that effect would be nice.
So, something like this?
```
// getGlobalWrapperKind can't be used here since we're in a static function and that requires an instance of X86TargetLowering.
// If we can use RIPRel addressing, prefer that since it doesn't cost anything extra, even if the build isn't required to be PIC.
```


https://reviews.llvm.org/D38343





More information about the llvm-commits mailing list