[LLVMdev] Associating types directly with debug metadata?

Alexander Herz alexander.herz at mytum.de
Wed Oct 6 05:37:27 PDT 2010


I'd really be interested in getting full support for this.
We're doing abstract interpretation on c++  code (lowered to c code via 
llvm).
I restrained from adding a direct mapping from type to type name because 
it appears to be somewhat
involved (having to change the IT etc) but it would be very helpful for 
us to have this.

Alex

P.S.: To Devang : I'll submit the other patch for debug info asap..I 
just didn't have the time yet..



On 09/30/2010 07:28 PM, Pekka Nikander wrote:
>>>>> We want to avoid any Type class modification. Instead you can use pair in named metadata to match metadata with type.
>>>>>
>>>>>            
>>> I thought about that more, and I think the "right" way would be to have a syntax like
>>>
>>> !21 = metadata !{ type %struct.T, metadata !11 }
>>>
>>> or perhaps
>>>
>>> !21 = metadata !{ typeval %struct.T, metadata !11 }
>>>
>>> to avoid the problem with the keyword 'type'.
>>>
>>> Would that be worth doing?  Apparently we can fake with our need, and use a null pointer instead.  Technically, that would be wrong, but would work with the current code without any modifications:
>>>
>>> !21 = metadata !{ %struct.T *null, metadata !11 }
>>>        
>> I would recommend this approach.
>>      
> But that would have a hacky feeling :-)
>
> Anyway, I already implemented an early patch for making Types representable as Values.  For that I created a new class, TypeValue, which represents a type as a value.  An early patch for that enclosed.  Works when reading or writing textual representations; no BC representation yet.  And no test case yet.
>
> This works well enough for our purposes; I don't have any incentive to go further unless someone else needs a similar kind of functionality.
>
> --Pekka
>
>    
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101006/4ab3d349/attachment.html>


More information about the llvm-dev mailing list