[LLVMdev] [RFC] Proposal to make LLVM-IR endian agnostic

Villmow, Micah Micah.Villmow at amd.com
Tue Oct 4 11:08:05 PDT 2011



> -----Original Message-----
> From: Tom Prince [mailto:tom.prince at ualberta.net]
> Sent: Tuesday, October 04, 2011 10:59 AM
> To: Villmow, Micah; James Molloy; llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] [RFC] Proposal to make LLVM-IR endian agnostic
> 
> 
> I wonder if this could be handle specifying that certain address spaces
> have one or another endianness, which is not necessarily the same as
> the
> processor endianness.
> 
> Your main requirement seems to be that you need to access to banks of
> memory, with different endianess, and that you the first stage IR to be
> able to be run on either endianness processor, without change. I would
> assume that any given pointer points either to host memory, device
> memory, or private memory, and that these pointers never get mixed.
> This
> seems an ideal use of memory spaces.
[Villmow, Micah] This was brought up but breaks down when you have 
different endianness memory operations to the same pointer. For example,
the program wants a big endian load from offset 0x100 from pointer 'a' 
and a little endian load from offset 0x100 of pointer 'a' from the global 
address space. Since LLVM correctly stores the address space in the type, 
this would require multiple types for each pointer, duplicating information
and requiring casts between address spaces(which is illegal). The assumption
that device and host memory are unique is not always valid, as they are
both under the more general 'global' address space. Since the compiler does
not know which part of global memory maps to host and which part to device
unless the programmer makes it explicit, there is a need to specify it in the
instruction.
> 
>   Tom






More information about the llvm-dev mailing list