X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2Ftutorial%2FLangImpl3.html;h=2acd3ddb5314aedaf4995981abaec8d698196016;hb=befc9c16fae1719cafe9f54ab2b67219db44dc11;hp=47e178397a876a9a086e08ab86fa38d57f26f5db;hpb=6c4be9c23bbe2512a264d2d4f890d6655b96139b;p=oota-llvm.git diff --git a/docs/tutorial/LangImpl3.html b/docs/tutorial/LangImpl3.html index 47e178397a8..2acd3ddb531 100644 --- a/docs/tutorial/LangImpl3.html +++ b/docs/tutorial/LangImpl3.html @@ -48,7 +48,11 @@ parser than it is to generate LLVM IR code. :)
Please note: the code in this chapter and later require LLVM 2.2 or -LLVM SVN to work. LLVM 2.1 and before will not work with it.
+later. LLVM 2.1 and before will not work with it. Also note that you need +to use a version of this tutorial that matches your LLVM release: If you are +using an official LLVM release, use the version of the documentation included +with your release or on the llvm.org +releases page. @@ -155,7 +159,7 @@ we'll do numeric literals:Value *NumberExprAST::Codegen() { - return ConstantFP::get(Type::DoubleTy, APFloat(Val)); + return ConstantFP::get(APFloat(Val)); }
@@ -306,7 +310,7 @@ Function *PrototypeAST::Codegen() { std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy); FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false); - Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule); + Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
The final line above actually creates the function that the prototype will correspond to. This indicates the type, linkage and name to use, as well as which -module to insert into. "external linkage" +module to insert into. "external linkage" means that the function may be defined outside the current module and/or that it is callable by functions outside the module. The Name passed in is the name the user specified: since "TheModule" is specified, this name is registered @@ -435,7 +439,7 @@ is an LLVM Function object that is ready to go for us.
// Create a new basic block to start insertion into. - BasicBlock *BB = new BasicBlock("entry", TheFunction); + BasicBlock *BB = BasicBlock::Create("entry", TheFunction); Builder.SetInsertPoint(BB); if (Value *RetVal = Body->Codegen()) { @@ -1029,7 +1033,7 @@ static std::map<std::string, Value*> NamedValues; Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return ConstantFP::get(Type::DoubleTy, APFloat(Val)); + return ConstantFP::get(APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1079,7 +1083,7 @@ Function *PrototypeAST::Codegen() { std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy); FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false); - Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule); + Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); // If F conflicted, there was already something named 'Name'. If it has a // body, don't allow redefinition or reextern. @@ -1122,7 +1126,7 @@ Function *FunctionAST::Codegen() { return 0; // Create a new basic block to start insertion into. - BasicBlock *BB = new BasicBlock("entry", TheFunction); + BasicBlock *BB = BasicBlock::Create("entry", TheFunction); Builder.SetInsertPoint(BB); if (Value *RetVal = Body->Codegen()) {