Pekka Nikander
2010-Oct-05 07:59 UTC
[LLVMdev] Associating types directly with debug metadata?
>>> I thought about that more, and I think the "right" way would be to have a syntax like >>> >>> !21 = metadata !{ typeval %struct.T, metadata !11 } >>> >>> to avoid the problem with the keyword 'type'. >>> > > 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.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. --Pekka -------------- next part -------------- A non-text attachment was scrubbed... Name: TypeValue.diff Type: application/octet-stream Size: 16812 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101005/93446e93/attachment.obj>
Nick Lewycky
2010-Oct-06 06:23 UTC
[LLVMdev] Associating types directly with debug metadata?
Pekka Nikander wrote:>>>> I thought about that more, and I think the "right" way would be to have a syntax like >>>> >>>> !21 = metadata !{ typeval %struct.T, metadata !11 } >>>> >>>> to avoid the problem with the keyword 'type'. >>>> >> >> 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. > > 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. Nick
Chris Lattner
2010-Oct-06 06:42 UTC
[LLVMdev] Associating types directly with debug metadata?
On Oct 5, 2010, at 11:23 PM, Nick Lewycky wrote:>> >> 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. -Chris
Apparently Analagous Threads
- [LLVMdev] Associating types directly with debug metadata?
- [LLVMdev] Associating types directly with debug metadata?
- [LLVMdev] Associating types directly with debug metadata?
- [LLVMdev] Associating types directly with debug metadata?
- [LLVMdev] Associating types directly with debug metadata?