[LLVMdev] Address space extension

David Chisnall David.Chisnall at cl.cam.ac.uk
Thu Aug 8 08:19:26 PDT 2013


On 8 Aug 2013, at 15:19, Michele Scandale <michele.scandale at gmail.com> wrote:

> Uhm... I read the discussion, probably I've not understood the problem well: the conclusion (it has been committed?) is that to handle address space conversion that imply a change in the size of pointers must be expressed as a pair ptrtoint/inttoptr. What if the address space conversione logically change also the value of the pointer?

We discussed this in detail at the DevMeeting in San Jose last year, and the consensus was that the required semantics were:

- Every cast between pointers in different address spaces should be an addrspacecast instruction
- Bitcasts between different address spaces are invalid.
- The semantics of inttoptr of inttoptr where the source and destination are in different address spaces are target-dependent and may be undefined for any given conversion

As this involves a change to the bitcode format, the auto-upgrader must transform bitcasts and ptrtoint-inttoptr sequences into addrspacecasts.
The verifier needed to be modified to reject the now-invalid operations.
SelectionDAG would need to grow an ADDRSPACECAST node to handle this correctly.

None of these steps was implemented.

The optimisers also needed correctly modifying so that they would not introduce the now-invalid sequences, but this would be easier once the verifier could reject them.  

David





More information about the llvm-dev mailing list