[PATCH] D81517: Extend or truncate __ptr32/__ptr64 pointers when dereferenced.

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 17:09:36 PDT 2020


akhuang created this revision.
akhuang added reviewers: hans, arsenm, RKSimon.
Herald added subscribers: llvm-commits, hiraditya, wdng.
Herald added a project: LLVM.

A while ago I implemented the functionality to lower Microsoft __ptr32
and __ptr64 pointers, which are basically stored as 32-bit and 64-bit
pointers and are extended/truncated to the appropriate pointer size when
dereferenced. Apparently I never implemented this extend/truncate when
dereferencing part, so that is what this patch attempts to do.

For 32-bit pointers in 64-bit builds I put the sign/zero extend in
matchAddress in X86ISelDAGToDAG, but loading from 64-bit pointers in
32-bit builds fails in the legalizer before that point, which is why
this code is in two different places. Not sure if this is a good way of doing
this.

Bug: https://bugs.llvm.org/show_bug.cgi?id=42359


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81517

Files:
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/mixed-ptr-sizes.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81517.269700.patch
Type: text/x-patch
Size: 7272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200610/fee3d780/attachment.bin>


More information about the llvm-commits mailing list