Added support for non-array references.
2 * Copyright (C) 2012 David Anderson
4 * This file is part of JITCraft.
6 * JITCraft is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option)
11 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * JITCraft. If not, see http://www.gnu.org/licenses/.
18 #ifndef _include_bytecode_compiler_h_
19 #define _include_bytecode_compiler_h_
22 #include "BytecodeEmitter.h"
29 class BytecodeCompiler : public AstVisitor
32 BytecodeEmitter emitter_;
40 BytecodeEmitter::Label *bk_;
41 BytecodeEmitter::Label *ct_;
46 LoopScope(Scope *scope, BytecodeEmitter::Label *bk, BytecodeEmitter::Label *ct,
62 BytecodeEmitter::Label *break_() {
65 BytecodeEmitter::Label *continue_() {
78 BytecodeCompiler *bc_;
82 AutoEnterScope(BytecodeCompiler *bc, Scope *scope)
95 void recordLifoSlot(Scope *scope);
96 void unwindTo(Scope *scope);
97 void visitForTest(Expression *expression, BytecodeEmitter::Label *label, bool onTrue);
98 Code *compileFunction(Module *module, FunctionStatement *fun);
99 void visitForALU(Type *needed, Expression *node);
102 BytecodeCompiler(ParseTree *tree, Module *module);
107 void visit(NameProxy *name);
108 void visit(Assignment *node);
109 void visit(BinaryExpression *node);
110 void visit(ReturnStatement *node);
111 void visit(ForStatement *node);
112 void visit(BlockStatement *node);
113 void visit(VariableDeclaration *node);
114 void visit(IntegerLiteral *node);
115 void visit(FloatLiteral *node);
116 void visit(ExpressionStatement *node);
117 void visit(FunctionStatement *node);
118 void visit(CallExpression *node);
119 void visit(IfStatement *node);
120 void visit(IndexExpression *node);
121 void visit(EnumStatement *node);
122 void visit(WhileStatement *node);
123 void visit(BreakStatement *node);
124 void visit(ContinueStatement *node);
129 #endif // _include_bytecode_generator_h_