aboutsummaryrefslogtreecommitdiff
path: root/docs/tutorial
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-23 04:27:44 +0000
committerChris Lattner <sabre@nondot.org>2007-10-23 04:27:44 +0000
commit28571edba87c76850fc5c4b7c7abb6390c0a642e (patch)
treefc1ec5326b139c15435f1314cfc9b7e52081a83b /docs/tutorial
parent4102eb57bbeecbbf5b5b5122ed1ecd4cd5487878 (diff)
several improvements suggested by Dan, thanks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/tutorial')
-rw-r--r--docs/tutorial/LangImpl2.html8
-rw-r--r--docs/tutorial/LangImpl3.html21
2 files changed, 20 insertions, 9 deletions
diff --git a/docs/tutorial/LangImpl2.html b/docs/tutorial/LangImpl2.html
index e6c53dafaa..1fdd442c65 100644
--- a/docs/tutorial/LangImpl2.html
+++ b/docs/tutorial/LangImpl2.html
@@ -65,7 +65,7 @@ public:
class NumberExprAST : public ExprAST {
double Val;
public:
- NumberExprAST(double val) : Val(val) {}
+ explicit NumberExprAST(double val) : Val(val) {}
};
</pre>
</div>
@@ -87,7 +87,7 @@ in the basic form of the Kaleidoscope language.
class VariableExprAST : public ExprAST {
std::string Name;
public:
- VariableExprAST(const std::string &amp;name) : Name(name) {}
+ explicit VariableExprAST(const std::string &amp;name) : Name(name) {}
};
/// BinaryExprAST - Expression class for a binary operator.
@@ -850,14 +850,14 @@ public:
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 &amp;name) : Name(name) {}
+ explicit VariableExprAST(const std::string &amp;name) : Name(name) {}
};
/// BinaryExprAST - Expression class for a binary operator.
diff --git a/docs/tutorial/LangImpl3.html b/docs/tutorial/LangImpl3.html
index 7d403d9621..b236f0bef0 100644
--- a/docs/tutorial/LangImpl3.html
+++ b/docs/tutorial/LangImpl3.html
@@ -56,15 +56,26 @@ public:
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 @@ public:
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 @@ public:
class VariableExprAST : public ExprAST {
std::string Name;
public:
- VariableExprAST(const std::string &amp;name) : Name(name) {}
+ explicit VariableExprAST(const std::string &amp;name) : Name(name) {}
virtual Value *Codegen();
};