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

Dan Gohman djg at cray.com
Mon Oct 22 15:05:07 PDT 2007


> "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.

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.

>   NumberExprAST(double val) : Val(val) {}

>   VariableExprAST(const std::string &name) : Name(name) {}

These miss explicit keywords.

>   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.

Dan

-- 
Dan Gohman, Cray Inc.



More information about the llvm-commits mailing list