[PATCH] D113629: Add path to lower addrspacecasts in constant exprs for __ptr32/__ptr64.

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 11:22:03 PST 2021


akhuang planned changes to this revision.
akhuang added inline comments.


================
Comment at: llvm/lib/Target/X86/X86AsmPrinter.cpp:138
+  if ((SrcAS == 0 || SrcAS == X86AS::PTR32_UPTR) && DstAS == X86AS::PTR64) {
+    // For zero extension, emit a zero constant. This doesn't handle cases when
+    // sign extension is specified.
----------------
JohnReagan wrote:
> What would the sign-extended form look like?  Is it much harder to add? I thought I remember you have both signed and zero extended in other places?  (I'm biased since OpenVMS wants sign-extended behavior)
I think I'll have to add some code in the frontend to avoid making these constant exprs for some or all of these addrspacecasts....


================
Comment at: llvm/lib/Target/X86/X86AsmPrinter.cpp:145
+    // For trunc, just remove the addrspacecast.
+    AsmPrinter::emitGlobalConstant(DL, Op);
+  } else {
----------------
arsenm wrote:
> Would it be easier to just add a new callback to handle addrspacecast instead of having to reproduce some of the generic logic and call into the default implementation
Yeah, that'd be better; I think the version in this patch is missing a bunch of logic as well.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113629



More information about the llvm-commits mailing list