[LLVMdev] New Type System Questions

Garrison Venn gvenn.cfe.dev at gmail.com
Mon Jul 25 09:04:34 PDT 2011


On Jul 25, 2011, at 11:52, Talin wrote:

> On Mon, Jul 25, 2011 at 6:35 AM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote:
> Hi Talin,
> 
> On Jul 25, 2011, at 1:59, Talin wrote:
> 
> > 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.
> >
> > I do have a few comments / questions:
> >
> > -- 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.
> >
> 
> From an implementation perspective at least:
> 
> The named struct types are stored in the context. As soon as you create a new
> StructType with the same name it will instead name your new "StructType" to new name
> as above. I believe you instead need to pull the "old" named struct type from the
> context, and then set the body or just reference it. Since your modules are sharing
> the the same context, your issue is manifesting itself.
> 
> 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.

Ah, I see the issue. Interesting.

> 
> 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.

I hope my responses have not in addition shadowed your other questions from the list.

> 
> Garrison
> 
> [snip]
> 
> > --
> > -- Talin
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 
> 
> 
> -- 
> -- Talin

Garrison

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


More information about the llvm-dev mailing list