[llvm-dev] [GlobalISel] A Proposal for global instruction selection
David Chisnall via llvm-dev
llvm-dev at lists.llvm.org
Fri Jan 8 01:34:12 PST 2016
On 7 Jan 2016, at 19:47, Quentin Colombet <qcolombet at apple.com> wrote:
>
> Indeed, you said that inttoptr instruction is not a no-op on your architecture, whereas the language reference says:
> “The ‘inttoptr‘ instruction converts value to type ty2 by applying either a zero extension or a truncation depending on the size of the integer value. If value is larger than the size of a pointer then a truncation is done. If value is smaller than the size of a pointer then a zero extension is done. If they are the same size, nothing is done (no-op cast).”
>
> The bottom line is that IMHO, if you rely on inttoptr/ptrtoint instructions to do the conversion from fat pointers to plain integers you are abusing the IR.
>
I believe that this is somewhere where the IR specification needs to evolve. Currently, we have no in-tree architectures where pointers are not integers and so that definition is appropriate. Adding a new pair of IR instructions for integer-to-pointer and pointer-to-integer conversions and not calling them inttoptr / ptrtoint is likely to be far more confusing.
David
More information about the llvm-dev
mailing list