From e6819aeee0ccd91d71397c7872aa86b228b6db84 Mon Sep 17 00:00:00 2001
From: Chris Lattner
At this point, you are probably starting to think "on no! this means my +
At this point, you are probably starting to think "oh no! this means my simple and elegant front-end will have to start generating SSA form in order to use LLVM!". Fortunately, this is not the case, and we strongly advise not implementing an SSA construction algorithm in your front-end @@ -679,8 +679,8 @@ loop: ; preds = %loop, %entry %nextvar = add double %i, 1.000000e+00 ; termination test - %multmp = fcmp ult double %i, %n - %booltmp = uitofp i1 %multmp to double + %cmptmp = fcmp ult double %i, %n + %booltmp = uitofp i1 %cmptmp to double %loopcond = fcmp one double %booltmp, 0.000000e+00 br i1 %loopcond, label %loop, label %afterloop @@ -871,7 +871,8 @@ that is what we return from ForExprAST::Codegen.
the tutorial. We added two control flow constructs, and used them to motivate a couple of aspects of the LLVM IR that are important for front-end implementors to know. In the next chapter of our saga, we will get a bit crazier and add -operator overloading to our poor innocent language. +user-defined operators to our poor innocent +language. @@ -1378,7 +1379,7 @@ Value *BinaryExprAST::Codegen() { case '-': return Builder.CreateSub(L, R, "subtmp"); case '*': return Builder.CreateMul(L, R, "multmp"); case '<': - L = Builder.CreateFCmpULT(L, R, "multmp"); + L = Builder.CreateFCmpULT(L, R, "cmptmp"); // Convert bool 0/1 to double 0.0 or 1.0 return Builder.CreateUIToFP(L, Type::DoubleTy, "booltmp"); default: return ErrorV("invalid binary operator"); -- cgit v1.2.3