1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
6 <title>Kaleidoscope: Adding JIT and Optimizer Support</title>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
8 <meta name="author" content="Chris Lattner">
9 <link rel="stylesheet" href="../llvm.css" type="text/css">
14 <div class="doc_title">Kaleidoscope: Adding JIT and Optimizer Support</div>
16 <div class="doc_author">
17 <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></p>
20 <!-- *********************************************************************** -->
21 <div class="doc_section"><a name="intro">Part 4 Introduction</a></div>
22 <!-- *********************************************************************** -->
24 <div class="doc_text">
26 <p>Welcome to part 4 of the "<a href="index.html">Implementing a language with
27 LLVM</a>" tutorial.</p>
31 <!-- *********************************************************************** -->
32 <div class="doc_section"><a name="basics">Code Generation setup</a></div>
33 <!-- *********************************************************************** -->
35 <div class="doc_text">
38 In order to generate LLVM IR, we want some simple setup to get started. First,
39 we define virtual codegen methods in each AST class:</p>
41 <div class="doc_code">
43 /// ExprAST - Base class for all expression nodes.
47 virtual Value *Codegen() = 0;
50 /// NumberExprAST - Expression class for numeric literals like "1.0".
51 class NumberExprAST : public ExprAST {
54 explicit NumberExprAST(double val) : Val(val) {}
55 virtual Value *Codegen();
65 <!-- *********************************************************************** -->
68 <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
69 src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
70 <a href="http://validator.w3.org/check/referer"><img
71 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
73 <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
74 <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
75 Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $