[LLVMdev] C++ type erasure in llvm-g++

Luke Dalessandro luked at cs.rochester.edu
Tue Mar 24 08:40:55 PDT 2009


I'm curious about the type erasure that goes on when llvm-g++ compiles 
C++ code. Is this a consequence of it just being the easiest way to do 
things based on the design of gcc and how LLVM is plugged into it?

Can someone more familiar with the llvm-gcc infrastructure comment on 
the difficulty of generating more strongly typed virtual function tables 
rather than just having them all be variable length arrays of pointers 
of unknown type and casting to the "known" type before the call?

I understand that there's some issue with structural type equivalence 
that can merge identical looking table types, but I feel like it would 
help me with alias analysis to determine possible targets for indirect 
calls/invokes, or for debug related purposes. What I'd really like would 
be a vcall/vinvoke instruction, but I get LL part of LLVM.

I guess my main complaint is that I'd like to use the LLVM 
infrastructure to do some higher-level (semantics-wise) manipulation of 
code without waiting for clang to handle C++. Any other suggestions 
would be appreciated.

Thanks,
Luke



More information about the llvm-dev mailing list