diff options
Diffstat (limited to 'llvm/docs/tutorial/LangImpl03.rst')
-rw-r--r-- | llvm/docs/tutorial/LangImpl03.rst | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/docs/tutorial/LangImpl03.rst b/llvm/docs/tutorial/LangImpl03.rst index 2bb3a300026..1dfe10175c7 100644 --- a/llvm/docs/tutorial/LangImpl03.rst +++ b/llvm/docs/tutorial/LangImpl03.rst @@ -122,7 +122,7 @@ First we'll do numeric literals: .. code-block:: c++ Value *NumberExprAST::codegen() { - return ConstantFP::get(LLVMContext, APFloat(Val)); + return ConstantFP::get(TheContext, APFloat(Val)); } In the LLVM IR, numeric constants are represented with the @@ -171,7 +171,7 @@ variables <LangImpl7.html#user-defined-local-variables>`_. case '<': L = Builder.CreateFCmpULT(L, R, "cmptmp"); // Convert bool 0/1 to double 0.0 or 1.0 - return Builder.CreateUIToFP(L, Type::getDoubleTy(LLVMContext), + return Builder.CreateUIToFP(L, Type::getDoubleTy(TheContext), "booltmp"); default: return LogErrorV("invalid binary operator"); @@ -270,9 +270,9 @@ with: Function *PrototypeAST::codegen() { // Make the function type: double(double,double) etc. std::vector<Type*> Doubles(Args.size(), - Type::getDoubleTy(LLVMContext)); + Type::getDoubleTy(TheContext)); FunctionType *FT = - FunctionType::get(Type::getDoubleTy(LLVMContext), Doubles, false); + FunctionType::get(Type::getDoubleTy(TheContext), Doubles, false); Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); @@ -346,7 +346,7 @@ assert that the function is empty (i.e. has no body yet) before we start. .. code-block:: c++ // Create a new basic block to start insertion into. - BasicBlock *BB = BasicBlock::Create(LLVMContext, "entry", TheFunction); + BasicBlock *BB = BasicBlock::Create(TheContext, "entry", TheFunction); Builder.SetInsertPoint(BB); // Record the function arguments in the NamedValues map. @@ -533,7 +533,8 @@ This shows an extern for the libm "cos" function, and a call to it. ret double %calltmp } -When you quit the current demo, it dumps out the IR for the entire +When you quit the current demo (by sending an EOF via CTRL+D on Linux +or CTRL+Z and ENTER on Windows), it dumps out the IR for the entire module generated. Here you can see the big picture with all the functions referencing each other. |