[LLVMdev] New Type System Questions

Garrison Venn gvenn.cfe.dev at gmail.com
Mon Jul 25 06:35:28 PDT 2011

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.



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

More information about the llvm-dev mailing list