[LLVMdev] Associating types directly with debug metadata?

Pekka Nikander pekka.nikander at nomadiclab.com
Wed Oct 6 00:20:51 PDT 2010


>>> Here is another version of the patch.  This one includes also a small patch to llvm-gcc so that it generates the type metadata for structures and classes.  This one also generates and parses correctly the metadata for .ll files.  No .bc support yet.  The biggest problem with this version is that it breaks when the compiler/linker performs type reductions, and I don't understand why.
>> 
>> Please don't do this. My objection to the type value is on the grounds 
>> that it is not a value. It does not match the conceptual meaning of a 
>> value, that is, something you could put in a machine register on some 
>> machine.
>> 
>> If you need to name an LLVM type in your MDNode, just create an undef 
>> value of that type.
> 
> I agree completely.

Ok, I will try using undefs, but do they work for aggregate types?  Well, I'll see.

However, I don't understand what is so different in my design from MDNode and MDString being values?  Sure, I could make the TypeValue a subclass of MDNode, name it something like MDType, and use a tag different form "typeval", something like "metatype".  Would that be better?  Or should it still be a direct subclass of Value, like both MDNode and MDString are?

I tried to carefully model my code after MDNode and MDString, wherever possible.  My intention is to use these from metadata only, after all.

--Pekka





More information about the llvm-dev mailing list