[llvm-commits] [llvm] r43246 - in /llvm/trunk/docs/tutorial: LangImpl4.html index.html

Chris Lattner sabre at nondot.org
Mon Oct 22 23:27:55 PDT 2007


Author: lattner
Date: Tue Oct 23 01:27:55 2007
New Revision: 43246

URL: http://llvm.org/viewvc/llvm-project?rev=43246&view=rev
Log:
add a skeleton for part 4

Added:
    llvm/trunk/docs/tutorial/LangImpl4.html
Modified:
    llvm/trunk/docs/tutorial/index.html

Added: llvm/trunk/docs/tutorial/LangImpl4.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl4.html?rev=43246&view=auto

==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl4.html (added)
+++ llvm/trunk/docs/tutorial/LangImpl4.html Tue Oct 23 01:27:55 2007
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                      "http://www.w3.org/TR/html4/strict.dtd">
+
+<html>
+<head>
+  <title>Kaleidoscope: Adding JIT and Optimizer Support</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <meta name="author" content="Chris Lattner">
+  <link rel="stylesheet" href="../llvm.css" type="text/css">
+</head>
+
+<body>
+
+<div class="doc_title">Kaleidoscope: Adding JIT and Optimizer Support</div>
+
+<div class="doc_author">
+  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
+</div>
+
+<!-- *********************************************************************** -->
+<div class="doc_section"><a name="intro">Part 4 Introduction</a></div>
+<!-- *********************************************************************** -->
+
+<div class="doc_text">
+
+<p>Welcome to part 4 of the "<a href="index.html">Implementing a language with
+LLVM</a>" tutorial.</p>
+
+</div>
+
+<!-- *********************************************************************** -->
+<div class="doc_section"><a name="basics">Code Generation setup</a></div>
+<!-- *********************************************************************** -->
+
+<div class="doc_text">
+
+<p>
+In order to generate LLVM IR, we want some simple setup to get started.  First,
+we define virtual codegen methods in each AST class:</p>
+
+<div class="doc_code">
+<pre>
+/// ExprAST - Base class for all expression nodes.
+class ExprAST {
+public:
+  virtual ~ExprAST() {}
+  virtual Value *Codegen() = 0;
+};
+
+/// NumberExprAST - Expression class for numeric literals like "1.0".
+class NumberExprAST : public ExprAST {
+  double Val;
+public:
+  explicit NumberExprAST(double val) : Val(val) {}
+  virtual Value *Codegen();
+};
+...
+</pre>
+</div>
+
+
+
+</div>
+
+<!-- *********************************************************************** -->
+<hr>
+<address>
+  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
+  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
+  <a href="http://validator.w3.org/check/referer"><img
+  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a>
+
+  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
+  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
+  Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $
+</address>
+</body>
+</html>

Modified: llvm/trunk/docs/tutorial/index.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43246&r1=43245&r2=43246&view=diff

==============================================================================
--- llvm/trunk/docs/tutorial/index.html (original)
+++ llvm/trunk/docs/tutorial/index.html Tue Oct 23 01:27:55 2007
@@ -29,8 +29,8 @@
   <ol>
     <li><a href="LangImpl1.html">The basic language, with its lexer</a></li>
     <li><a href="LangImpl2.html">Implementing a Parser and AST</a></li>
-    <li><a href="LangImpl3.html">Implementing code generation to LLVM IR</a></li>
-    <li>Adding JIT codegen support</li>
+    <li><a href="LangImpl3.html">Implementing Code Generation to LLVM IR</a></li>
+    <li><a href="LangImpl4.html">Adding JIT and Optimizer Support</a></li>
     <li>Extending the language: if/then/else</li>
     <li>Extending the language: operator overloading</li>
     <li>Extending the language: mutable variables</li>
@@ -38,7 +38,8 @@
   </ol></li>
   <li>Advanced Topics
   <ol>
-    <li><a href="http://llvm.org/pubs/2004-09-22-LCPCLLVMTutorial.html">Writing an Optimization for LLVM</a></li>
+    <li><a href="http://llvm.org/pubs/2004-09-22-LCPCLLVMTutorial.html">Writing
+        an Optimization for LLVM</a></li>
   </ol></li>
 </ol>
 





More information about the llvm-commits mailing list