[LLVMdev] Virtual methods (was: LLVMBuilder vs LLVMFoldingBuilder)

Chris Lattner sabre at nondot.org
Fri Apr 4 11:19:21 PDT 2008


On Fri, 4 Apr 2008, Joachim Durchholz wrote:
>> No, please don't do this.  The idea of llvmbuilder is that it is a
>> "free" wrapper around the other existing API calls.  Making the
>> methods virtual would make them much more expensive.
>
> Wouldn't the class of the objects be known at compile time in most
> cases? This is essentially just a case of precomputing constants, so I
> think this should be possible.
>
> If yes, the compiler can predetermine the type, hence the virtual method
> table that will be used, and can replace the virtual call with a static
> one.

Please verify that this actually happens in practice with llvm-gcc and 
gcc.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list