[LLVMdev] Casting between address spaces and address space semantics

Cédric Venet cedric.venet at laposte.net
Fri Jul 18 14:40:39 PDT 2008


Hi, 

> When this information is known, we can define a "any memory" address
> space, which is a superset of the specific address spaces. This will

The two uses I see for memory space have completely separate memory space
(even different instruction to access). You can't define an 'any memory
space', if your memory space is already mapped on a global memory, why
bother to use memory space  anyways...

[ the two use cas I see are:
 - on small µC, you have acces to the RAM and to the program Flash as a ROM
and sometimes to EEPROM, each with there own address (not event all the same
size) and own instructions for load/store.
 - on one embedded µC I use, the I/O port isn't mapped in the RAM space and
use different load/store instructions as RAM
]

> allow a function to be (temporarily) defined to work with any memory,
> while still properly propagating information about the different
> memories through the program (and preventing mixup, since you can cast
> to the "any memory" address space, but not back).

I think that what you want is a basic form of C++ template allowing a
function to take any address space. Like template, these function would be
codegened as many time as there is of different (used) combination of
address space in there parameter (since load and store are different for
each address space).


Regards,

-- 
Cédric





More information about the llvm-dev mailing list