[LLVMdev] Simplifying a front-end project

Chris Lattner clattner at apple.com
Tue Aug 25 21:28:34 PDT 2009


On Aug 25, 2009, at 4:06 PM, Jeffrey Yasskin wrote:
>> Otherwise, is there any other way they can write their translator  
>> that
>> is easier than learning the LLVM APIs for building up the IR?
>
> Are you using TypeBuilder
> (http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/include/llvm/Support/TypeBuilder.h?view=markup 
> ,
> new in 2.6) and IRBuilder, or trying to use the individual type and
> value classes directly? I recommend the builders when they support
> what you need. I don't think they'll ever completely replace the
> individual classes, but in Unladen Swallow we haven't had to fall back
> to the full API very often.

I will reiterate this.  LLVM APIs have made a lot of progress over the  
last couple years.  They shouldn't be writing "new FooInst()" at all  
in their code, the IRBuilder and new TypeBuilder stuff are  
dramatically easier to use and generally just "do the right thing".

Generating text will work but will have tons of other logistical  
problems that are not really any easier to solve, and it seems bad to  
say "I'm teaching you something that is definitely not best practice  
but will make it easier to get going".

-Chris



More information about the llvm-dev mailing list