From c0b42e95587b06e7494ad62350c1b7ceae99dc69 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 23 Oct 2007 06:27:55 +0000 Subject: [PATCH] add a skeleton for part 4 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43246 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/tutorial/LangImpl4.html | 78 ++++++++++++++++++++++++++++++++++++++++++++ docs/tutorial/index.html | 7 ++-- 2 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 docs/tutorial/LangImpl4.html diff --git a/docs/tutorial/LangImpl4.html b/docs/tutorial/LangImpl4.html new file mode 100644 index 00000000000..358ec69ad17 --- /dev/null +++ b/docs/tutorial/LangImpl4.html @@ -0,0 +1,78 @@ + + + + + Kaleidoscope: Adding JIT and Optimizer Support + + + + + + + +
Kaleidoscope: Adding JIT and Optimizer Support
+ +
+

Written by Chris Lattner

+
+ + +
Part 4 Introduction
+ + +
+ +

Welcome to part 4 of the "Implementing a language with +LLVM" tutorial.

+ +
+ + +
Code Generation setup
+ + +
+ +

+In order to generate LLVM IR, we want some simple setup to get started. First, +we define virtual codegen methods in each AST class:

+ +
+
+/// 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();
+};
+...
+
+
+ + + +
+ + +
+
+ Valid CSS! + Valid HTML 4.01! + + Chris Lattner
+ The LLVM Compiler Infrastructure
+ Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $ +
+ + diff --git a/docs/tutorial/index.html b/docs/tutorial/index.html index 56d9dd2b8ca..99278fae89a 100644 --- a/docs/tutorial/index.html +++ b/docs/tutorial/index.html @@ -29,8 +29,8 @@
  1. The basic language, with its lexer
  2. Implementing a Parser and AST
  3. -
  4. Implementing code generation to LLVM IR
  5. -
  6. Adding JIT codegen support
  7. +
  8. Implementing Code Generation to LLVM IR
  9. +
  10. Adding JIT and Optimizer Support
  11. Extending the language: if/then/else
  12. Extending the language: operator overloading
  13. Extending the language: mutable variables
  14. @@ -38,7 +38,8 @@
  • Advanced Topics
      -
    1. Writing an Optimization for LLVM
    2. +
    3. Writing + an Optimization for LLVM
  • -- 2.11.0