[LLVMdev] Address space extension
Michele Scandale
michele.scandale at gmail.com
Fri Aug 9 09:18:36 PDT 2013
On 08/08/2013 10:29 PM, Eric Christopher wrote:
> On Thu, Aug 8, 2013 at 1:26 PM, Michele Scandale
> <michele.scandale at gmail.com> wrote:
>> On 08/08/2013 09:59 PM, Eric Christopher wrote:
>>>
>>> I don't believe so, no. Metadata should not be required for correct
>>> program behavior. It can be necessary for fast program behavior, but
>>> not for correct. The IR level handles the proper semantics of the
>>> program, metadata can provide extra optimization information. As an
>>> example see the TBAA work that was done.
>>>
>>> -eric
>>
>>
>> Perfectly fine with this. My question was ignoring the implementation detail
>> (the use of metadata to represent mapping infos).
>>
>> I think that the mapping should be a requirement for the correctness, so I
>> think we need another way to represent this...
>>
>> What is your opinion on this?
>>
>
> Wish I had one here. I completely defer to Chris for any IR design
> issues here. I just wanted to make sure that you didn't waste time
> going down the metadata for correctness path. :)
>
> -eric
>
The only solution I currently see without any modification to the type
system is to have something like the target datalayout string.
A verification pass will run at the begin of backend pipeline after
IRPasses and should check using target information if the mapping is
consistent. A mapping is consistent if no "illegal" address spaces
should be in the map. A physical address space is considered legal or
not querying target information.
If no information are provided in the module, by default the mapping
function is the identity. This will allow to implement raw numeric
address space (like address_space attribute in clang).
The verification pass delegate each target to check translated address
space validity. Indeed, being the verification explicit and
customizable, backends could implement their own policy and frontends
could customize the address space semantic without breaking backends
preconditions.
I know that using something similar to the datalayout string instead of
metadata is just a change of representation, but it will allow to keep
the fact that correctness should not depend on metadata.
Could it be a valid solution? What do you think about this?
Thanks in advance.
-Michele
More information about the llvm-dev
mailing list