[LLVMdev] Address space extension

Michele Scandale michele.scandale at gmail.com
Sat Aug 10 05:30:17 PDT 2013


> [Micah Villmow] The backends won't understand your address space mapping. The backends should expose their address spaces that they support, their sizes and their overall semantics. It should be documented just like the calling convention is documented. It is then the job of the frontend to map whatever source language address spaces are used onto the correct address spaces for the target. For example, the AMDIL backend supports multiple address spaces. If your new language has more than 1 address space, then your frontend has to map them to the backend's address spaces at compile time based on the target triple.  If they don't map directly, then you will have to just use the default for all of them. As someone who has written three backends, it is entirely unrealistic to expect all of the backends to support any variable address space setup. It is quite annoying and messy to deal with, as I've done it. One, although hacky, way to work around it is to have the backend supp!
 ort a lang
uage specific option on how to interpret address spaces.

Probably I haven't understood your point or I haven't been able to make
my point clear.

What I am saying is the the frontend must generate the correct mapping
information: so the knowledge of physical address spaces must be
embedded also in the frontend (as property of the target description): a
given backend knows only its physical address spaces.
The frontend can emit logical address spaces in the IR to improve
optimizations in the middle end that may use knowledge related to the
language semantic. The mapping information would be used when
information about the physical location are required.
This would allow the frontend to use in the IR whatever custom address
space enconding to represent whatever abstract language address space,
but at the same time it should provide the correct mapping on the set of
address space for the destination target to ensure the correctness of
the target code generation.

The point is to being able to decouple logical and physical address
spaces. At the end physical address spaces must be used so I have to
explicit also the relationship between the two.

-Michele



More information about the llvm-dev mailing list