[llvm-commits] [llvm] r43221 - in /llvm/trunk/docs/tutorial: LangImpl3.html index.html

Chris Lattner clattner at apple.com
Mon Oct 22 21:29:04 PDT 2007


On Oct 22, 2007, at 3:05 PM, Dan Gohman wrote:

>> "Value" is the class used to represent a "register" in LLVM. The  
>> Codegen() method says to emit IR for that AST
>
> It would be good to mention that the "registers" here cannot be  
> reassigned,
> as the word "register" might seem to imply.

Good idea.

> I don't know much you want to say about SSA at this point in the  
> tutorial,
> or if you want to go into using entry-block Allocas and mem2reg to  
> avoid
> having to compute SSA in a front-end here, but it's something that  
> should
> be mentioned somewhere.

I plan to unveil it slowly: in the if/then/else chapter, I'll talk  
about phi nodes.  In the "mutable variables" chapter, I'll talk about  
the alloca trick.

>>   NumberExprAST(double val) : Val(val) {}
>
>>   VariableExprAST(const std::string &name) : Name(name) {}
>
> These miss explicit keywords.

*grumble* explicit should be the default *grumble* :)

>>   case '+': return Builder.CreateAdd(L, R, "addtmp");
>>   case '-': return Builder.CreateSub(L, R, "subtmp");
>>   case '*': return Builder.CreateMul(L, R, "multmp");
>
> You might mention that the names "addtmp" and so on are automatically
> make unique by LLVM in case there's more than one add in the program,
> for example.

will do!

-Chris



More information about the llvm-commits mailing list