[llvm-commits] [llvm] r43237 - in /llvm/trunk/docs/tutorial: LangImpl2.html LangImpl3.html

Chris Lattner sabre at nondot.org
Mon Oct 22 21:27:45 PDT 2007


Author: lattner
Date: Mon Oct 22 23:27:44 2007
New Revision: 43237

URL: http://llvm.org/viewvc/llvm-project?rev=43237&view=rev
Log:
several improvements suggested by Dan, thanks!

Modified:
    llvm/trunk/docs/tutorial/LangImpl2.html
    llvm/trunk/docs/tutorial/LangImpl3.html

Modified: llvm/trunk/docs/tutorial/LangImpl2.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl2.html?rev=43237&r1=43236&r2=43237&view=diff

==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl2.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl2.html Mon Oct 22 23:27:44 2007
@@ -65,7 +65,7 @@
 class NumberExprAST : public ExprAST {
   double Val;
 public:
-  NumberExprAST(double val) : Val(val) {}
+  explicit NumberExprAST(double val) : Val(val) {}
 };
 </pre>
 </div>
@@ -87,7 +87,7 @@
 class VariableExprAST : public ExprAST {
   std::string Name;
 public:
-  VariableExprAST(const std::string &name) : Name(name) {}
+  explicit VariableExprAST(const std::string &name) : Name(name) {}
 };
 
 /// BinaryExprAST - Expression class for a binary operator.
@@ -850,14 +850,14 @@
 class NumberExprAST : public ExprAST {
   double Val;
 public:
-  NumberExprAST(double val) : Val(val) {}
+  explicit NumberExprAST(double val) : Val(val) {}
 };
 
 /// VariableExprAST - Expression class for referencing a variable, like "a".
 class VariableExprAST : public ExprAST {
   std::string Name;
 public:
-  VariableExprAST(const std::string &name) : Name(name) {}
+  explicit VariableExprAST(const std::string &name) : Name(name) {}
 };
 
 /// BinaryExprAST - Expression class for a binary operator.

Modified: llvm/trunk/docs/tutorial/LangImpl3.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.html?rev=43237&r1=43236&r2=43237&view=diff

==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl3.html (original)
+++ llvm/trunk/docs/tutorial/LangImpl3.html Mon Oct 22 23:27:44 2007
@@ -56,15 +56,26 @@
 class NumberExprAST : public ExprAST {
   double Val;
 public:
-  NumberExprAST(double val) : Val(val) {}
+  explicit NumberExprAST(double val) : Val(val) {}
   virtual Value *Codegen();
 };
 ...
 </pre>
 </div>
 
-<p>"Value" is the class used to represent a "register" in LLVM.  The Codegen()
-method says to emit IR for that AST node and all things it depends on.  The
+<p>The Codegen() method says to emit IR for that AST node and all things it
+depends on, and they all return an LLVM Value object. 
+"Value" is the class used to represent a "<a 
+href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Static Single
+Assignment (SSA)</a> register" or "SSA value" in LLVM.  The most distinct aspect
+of SSA values is that their value is computed as the related instruction
+executes, and it does not get a new value until (and if) the instruction
+re-executes.  In order words, there is no way to "change" an SSA value.  For
+more information, please read up on <a 
+href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Static Single
+Assignment</a> - the concepts are really quite natural once you grok them.</p>
+
+<p>The
 second thing we want is an "Error" method like we used for parser, which will
 be used to report errors found during code generation (for example, use of an
 undeclared parameter):</p>
@@ -299,7 +310,7 @@
 class NumberExprAST : public ExprAST {
   double Val;
 public:
-  NumberExprAST(double val) : Val(val) {}
+  explicit NumberExprAST(double val) : Val(val) {}
   virtual Value *Codegen();
 };
 
@@ -307,7 +318,7 @@
 class VariableExprAST : public ExprAST {
   std::string Name;
 public:
-  VariableExprAST(const std::string &name) : Name(name) {}
+  explicit VariableExprAST(const std::string &name) : Name(name) {}
   virtual Value *Codegen();
 };
 





More information about the llvm-commits mailing list