Files
BlitzNext/compiler/node.hpp
T

57 lines
1.5 KiB
C++
Raw Normal View History

2014-01-31 08:23:00 +13:00
#ifndef NODE_H
#define NODE_H
2019-01-18 17:04:57 +01:00
#include "codegen.hpp"
#include "environ.hpp"
2019-01-18 15:55:51 +01:00
#include "ex.hpp"
#include "toker.hpp"
2014-01-31 08:23:00 +13:00
struct VarNode;
struct ConstNode;
2019-01-18 17:04:57 +01:00
struct Node {
virtual ~Node() {}
2014-01-31 08:23:00 +13:00
//used user funcs...
static set<string> usedfuncs;
//helper funcs
static void ex();
2019-01-18 17:04:57 +01:00
static void ex(const string& e);
static void ex(const string& e, int pos);
static void ex(const string& e, int pos, const string& f);
static string genLabel();
static VarNode* genLocal(Environ* e, Type* ty);
static TNode* compare(int op, TNode* l, TNode* r, Type* ty);
static ConstNode* constValue(Type* ty);
static int enumVars(Environ* e);
static Type* tagType(const string& s, Environ* e);
static TNode* createVars(Environ* e);
static TNode* deleteVars(Environ* e);
static TNode* seq(TNode* l, TNode* r);
static TNode* move(TNode* src, TNode* dest);
static TNode* global(const string& s);
static TNode* local(int offset);
static TNode* arg(int offset);
static TNode* mem(TNode* ref);
static TNode* add(TNode* l, TNode* r);
static TNode* mul(TNode* l, TNode* r);
static TNode* iconst(int n);
static TNode* ret();
static TNode* jsr(const string& s);
static TNode* jump(const string& s);
static TNode* jumpt(TNode* cond, const string& s);
static TNode* jumpf(TNode* cond, const string& s);
static TNode* jumpge(TNode* l, TNode* r, const string& s);
static TNode* call(const string& func, TNode* a0 = 0, TNode* a1 = 0, TNode* a2 = 0);
static TNode* fcall(const string& func, TNode* a0 = 0, TNode* a1 = 0, TNode* a2 = 0);
2014-01-31 08:23:00 +13:00
};
#endif