On Mon, Jul 25, 2011 at 6:35 AM, Garrison Venn <span dir="ltr"><<a href="mailto:gvenn.cfe.dev@gmail.com">gvenn.cfe.dev@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi Talin,<br>
<div class="im"><br>
On Jul 25, 2011, at 1:59, Talin wrote:<br>
<br>
> So far I'm really liking the new type system -- I've been able to simplify my code generator in a number of areas. And the IR is now vastly more readable, both in the debugger (using dump()) and when printing modules via llvm-dis. It's a tremendous improvement.<br>


><br>
> I do have a few comments / questions:<br>
><br>
> -- I think I may be misunderstanding how named structs are supposed to be combined in the linker. Say we have a type that is defined in two modules with the same name, however in one of the modules the type is abstract and in the other module it has a body. The behavior I would expect is that it would merge the two definitions, so that now you have one type with a body. However, instead what I am getting is a lot of renamed types - %tart.reflect.NameTable.3562 and so on. This is puzzling, as I shouldn't have any renamed types in my modules at all.<br>


><br>
<br>
</div>From an implementation perspective at least:<br>
<br>
The named struct types are stored in the context. As soon as you create a new<br>
StructType with the same name it will instead name your new "StructType" to new name<br>
as above. I believe you instead need to pull the "old" named struct type from the<br>
context, and then set the body or just reference it. Since your modules are sharing<br>
the the same context, your issue is manifesting itself.<br>
<br></blockquote><div>I guess I wasn't clear. I'm talking about two bitcode files which I then feed into llvm-ld. None of my code is involved at this point.</div><div><br></div><div>I should mention that I'm seeing these renamed types in the debugger - because of the other issue I mentioned (abort in BitReader) I haven't actually seen what the merged output looks like.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Garrison<br>
<br>
[snip]<br>
<br>
> --<br>
> -- Talin<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>