forked from blitz-research/blitz3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
varnode.h
67 lines (55 loc) · 1.57 KB
/
varnode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef VARNODE_H
#define VARNODE_H
#include "varnode.h"
struct VarNode : public Node{
Type *sem_type;
//get set var
TNode *load( Codegen *g );
virtual TNode *store( Codegen *g,TNode *n );
virtual bool isObjParam();
//addr of var
virtual void semant( Environ *e )=0;
virtual TNode *translate( Codegen *g )=0;
};
#include "decl.h"
struct DeclVarNode : public VarNode{
Decl *sem_decl;
DeclVarNode( Decl *d=0 ):sem_decl(d){ if( d ) sem_type=d->type; }
void semant( Environ *e );
TNode *translate( Codegen *g );
virtual TNode *store( Codegen *g,TNode *n );
bool isObjParam();
};
struct IdentVarNode : public DeclVarNode{
string ident,tag;
IdentVarNode( const string &i,const string &t ):ident(i),tag(t){}
void semant( Environ *e );
};
struct ArrayVarNode : public VarNode{
string ident,tag;
ExprSeqNode *exprs;
Decl *sem_decl;
ArrayVarNode( const string &i,const string &t,ExprSeqNode *e ):ident(i),tag(t),exprs(e){}
~ArrayVarNode(){ delete exprs; }
void semant( Environ *e );
TNode *translate( Codegen *g );
};
struct FieldVarNode : public VarNode{
ExprNode *expr;
string ident,tag;
Decl *sem_field;
FieldVarNode( ExprNode *e,const string &i,const string &t ):expr(e),ident(i),tag(t){}
~FieldVarNode(){ delete expr; }
void semant( Environ *e );
TNode *translate( Codegen *g );
};
struct VectorVarNode : public VarNode{
ExprNode *expr;
ExprSeqNode *exprs;
VectorType *vec_type;
VectorVarNode( ExprNode *e,ExprSeqNode *es ):expr(e),exprs(es){}
~VectorVarNode(){ delete expr;delete exprs; }
void semant( Environ *e );
TNode *translate( Codegen *g );
};
#endif