[LLVMdev] Naming of types by DragonEgg vs. LLVM-GCC

Duncan Sands baldrick at free.fr
Thu Apr 28 07:11:34 PDT 2011

Hi Teemu,

> I used to use llvm-g++ to transform C++ source to LLVM IR. Now I am trying to
> switch to using DragonEgg, but I faced some problems because of the way DragonEgg
> is naming types in the resulting IR file. An example:
> %"struct.Vector<ARPResponder::Entry>" = type { %"struct.ARPResponder::Entry"*, i32, i32 }
> %"struct.Vector<String>" = type { %struct.String*, i32, i32 }
> %"struct.Vector<int>" = type { i32*, i32, i32 }
> DragonEgg:
> %struct.Vector = type { %struct.Entry*, i32, i32 }
> %2 = type { %struct.String*, i32, i32 }
> %3 = type { i32*, i32, i32 }
> With the LLVM-GCC version I could easily get type for "struct.Vector<String>". With the
> DragonEgg version I would need another mapping from that name to "2". The same problem
> can be seen with the "struct.ARPResponder::Entry" becoming just "struct.Entry".
> Is there a way to make DragonEgg name the types the same way LLVM-GCC does, preserving
> C++ naming a bit more?

no, it is not possible.  Modern gcc's have a special pass that destroys all
language specific information, thus ensuring that the middle end is only
using generic information and not accidentally using language specific stuff
(this matters for link time optimization).  The extra detail in type names
produced by llvm-gcc comes from language specific data and has been destroyed
in gcc-4.5 before reaching the dragonegg plugin.  I suggest you use debug info

Ciao, Duncan.

More information about the llvm-dev mailing list