<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 3, 2015 at 9:46 AM David Chisnall <<a href="mailto:David.Chisnall@cl.cam.ac.uk">David.Chisnall@cl.cam.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 3 Nov 2015, at 17:26, Manuel Klimek via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> What are your arguments against implementing a type system on top of llvm IR (that lives on a similar level as debug info) that is not language specific per se, but allows frontends to model their language semantics and have pointers back to their AST? Do you believe such a type system would inherently be coupled to language semantics, and thus not possible to build in a generic enough (and still useful) way? Or are there other problems?<br>
<br>
I don’t think that there’s anything wrong with the *idea* of doing this, but the implementation is very hard.  The CIR (not going to call it CIL) would, intrinsically, only support transforms that supported the generic C semantics and would know enough to update all C-relevant data.  When you lower to LLVM IR, even if you’re tagging everything with an AST node, you’d need all passes to understand how to update this information. </blockquote><div><br></div><div>I'd like to understand why all passes would need to keep the information. Some most certainly would (because static analysis will benefit from some passes), but I'd expect many passes to lose the information without it being problematic.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Given how badly most of them (even SROA / mem2reg, without which most analyses would be largely useless) do with debug info, which is at a far lower fidelity than this sort of thing would need, it’s very hard for me to imagine getting it right for a C AST, let alone a C++AST.<br>
<br>
David<br>
<br>
</blockquote></div></div>