mirror of https://git.wuffs.org/MWCC
265 lines
5.0 KiB
C
265 lines
5.0 KiB
C
|
#ifndef COMPILER_ENODE_H
|
||
|
#define COMPILER_ENODE_H
|
||
|
|
||
|
#include "compiler/common.h"
|
||
|
|
||
|
#ifdef __MWERKS__
|
||
|
#pragma options align=mac68k
|
||
|
#endif
|
||
|
|
||
|
typedef enum ENodeType {
|
||
|
EPOSTINC,
|
||
|
EPOSTDEC,
|
||
|
EPREINC,
|
||
|
EPREDEC,
|
||
|
EINDIRECT,
|
||
|
EMONMIN,
|
||
|
EBINNOT,
|
||
|
ELOGNOT,
|
||
|
EFORCELOAD,
|
||
|
EMUL,
|
||
|
EMULV,
|
||
|
EDIV,
|
||
|
EMODULO,
|
||
|
EADDV,
|
||
|
ESUBV,
|
||
|
EADD,
|
||
|
ESUB,
|
||
|
ESHL,
|
||
|
ESHR,
|
||
|
ELESS,
|
||
|
EGREATER,
|
||
|
ELESSEQU,
|
||
|
EGREATEREQU,
|
||
|
EEQU,
|
||
|
ENOTEQU,
|
||
|
EAND,
|
||
|
EXOR,
|
||
|
EOR,
|
||
|
ELAND,
|
||
|
ELOR,
|
||
|
EASS,
|
||
|
EMULASS,
|
||
|
EDIVASS,
|
||
|
EMODASS,
|
||
|
EADDASS,
|
||
|
ESUBASS,
|
||
|
ESHLASS,
|
||
|
ESHRASS,
|
||
|
EANDASS,
|
||
|
EXORASS,
|
||
|
EORASS,
|
||
|
ECOMMA,
|
||
|
EPMODULO,
|
||
|
EROTL,
|
||
|
EROTR,
|
||
|
EBCLR,
|
||
|
EBTST,
|
||
|
EBSET,
|
||
|
ETYPCON,
|
||
|
EBITFIELD,
|
||
|
EINTCONST,
|
||
|
EFLOATCONST,
|
||
|
ESTRINGCONST,
|
||
|
ECOND,
|
||
|
EFUNCCALL,
|
||
|
EFUNCCALLP,
|
||
|
EOBJREF,
|
||
|
EMFPOINTER,
|
||
|
ENULLCHECK,
|
||
|
EPRECOMP,
|
||
|
ETEMP,
|
||
|
EARGOBJ,
|
||
|
ELOCOBJ,
|
||
|
ELABEL,
|
||
|
ESETCONST,
|
||
|
ENEWEXCEPTION,
|
||
|
ENEWEXCEPTIONARRAY,
|
||
|
EOBJLIST,
|
||
|
EMEMBER,
|
||
|
ETEMPLDEP,
|
||
|
EINSTRUCTION,
|
||
|
EDEFINE,
|
||
|
EREUSE,
|
||
|
EASSBLK,
|
||
|
EVECTOR128CONST,
|
||
|
ECONDASS,
|
||
|
MAXEXPR
|
||
|
} ENodeType;
|
||
|
|
||
|
|
||
|
struct ENodeList {
|
||
|
ENodeList *next;
|
||
|
ENode *node;
|
||
|
};
|
||
|
|
||
|
|
||
|
typedef union ENodeUnion {
|
||
|
CInt64 intval;
|
||
|
Float floatval;
|
||
|
SInt32 longval;
|
||
|
ENode *monadic;
|
||
|
Object *objref;
|
||
|
CLabel *label;
|
||
|
MWVector128 vector128val;
|
||
|
struct {
|
||
|
ENode *left;
|
||
|
ENode *right;
|
||
|
} diadic;
|
||
|
struct {
|
||
|
ENode *cond;
|
||
|
ENode *expr1;
|
||
|
ENode *expr2;
|
||
|
} cond;
|
||
|
struct {
|
||
|
ENode *funcref;
|
||
|
ENodeList *args;
|
||
|
TypeFunc *functype;
|
||
|
} funccall;
|
||
|
ObjAccess objaccess;
|
||
|
struct {
|
||
|
ENode *accessnode;
|
||
|
ENode *mfpointer;
|
||
|
} mfpointer;
|
||
|
struct {
|
||
|
ENode *nullcheckexpr;
|
||
|
ENode *condexpr;
|
||
|
SInt32 precompid;
|
||
|
} nullcheck;
|
||
|
SInt32 precompid;
|
||
|
struct {
|
||
|
Type *type;
|
||
|
SInt32 uniqueid;
|
||
|
Boolean needs_dtor;
|
||
|
} temp;
|
||
|
struct {
|
||
|
SInt32 size;
|
||
|
char *data;
|
||
|
SInt32 segnum;
|
||
|
char ispascal;
|
||
|
char ispacked;
|
||
|
} string;
|
||
|
struct {
|
||
|
SInt32 size;
|
||
|
char *data;
|
||
|
} set;
|
||
|
struct {
|
||
|
ENode *initexpr;
|
||
|
ENode *tryexpr;
|
||
|
Object *pointertemp;
|
||
|
Object *deletefunc;
|
||
|
} newexception;
|
||
|
struct {
|
||
|
ENode *initexpr;
|
||
|
ENode *tryexpr;
|
||
|
ENode *catchexpr;
|
||
|
ENode *result;
|
||
|
} itc;
|
||
|
struct {
|
||
|
Object *objref;
|
||
|
SInt32 offset;
|
||
|
} addr;
|
||
|
void *inst;
|
||
|
MemInitializer *ctorinit;
|
||
|
Statement *stmt;
|
||
|
struct {
|
||
|
union {
|
||
|
TemplParamID pid;
|
||
|
struct {
|
||
|
union {
|
||
|
Type *type;
|
||
|
ENode *expr;
|
||
|
} u;
|
||
|
TEFuncSel sel;
|
||
|
Boolean is_expr;
|
||
|
} typeexpr;
|
||
|
struct {
|
||
|
ENodeList *args;
|
||
|
Type *type;
|
||
|
UInt32 qual;
|
||
|
} cast;
|
||
|
struct {
|
||
|
TypeTemplDep *type;
|
||
|
HashNameNode *name;
|
||
|
} qual;
|
||
|
struct {
|
||
|
TypeTemplDep *type;
|
||
|
HashNameNode *name;
|
||
|
TemplArg *args;
|
||
|
} qualtempl;
|
||
|
ObjAccess objaccess;
|
||
|
struct {
|
||
|
ENode *expr;
|
||
|
TStreamElement *token;
|
||
|
} sourceref;
|
||
|
ENode *monadic;
|
||
|
struct {
|
||
|
ENode *expr;
|
||
|
ENodeList *args;
|
||
|
} funccall;
|
||
|
struct {
|
||
|
Type *type;
|
||
|
UInt32 qual;
|
||
|
ENode *arraydim;
|
||
|
ENodeList *placement;
|
||
|
ENodeList *initlist;
|
||
|
Boolean is_global;
|
||
|
Boolean has_init;
|
||
|
} nw;
|
||
|
struct {
|
||
|
ENode *expr;
|
||
|
Boolean is_global;
|
||
|
Boolean is_array;
|
||
|
} del;
|
||
|
struct {
|
||
|
ENode *left;
|
||
|
ENode *right;
|
||
|
} dyadic;
|
||
|
struct {
|
||
|
ENode *expr;
|
||
|
Type *type;
|
||
|
UInt32 qual;
|
||
|
} newcast;
|
||
|
struct {
|
||
|
ENode *expr;
|
||
|
DepName *dname;
|
||
|
Boolean is_pointer;
|
||
|
} member;
|
||
|
struct {
|
||
|
Object *object;
|
||
|
Object *info;
|
||
|
} exinit;
|
||
|
struct {
|
||
|
Object *obj;
|
||
|
Initializer *init;
|
||
|
} varinit;
|
||
|
Object *obj;
|
||
|
} u;
|
||
|
TemplDepSubType subtype;
|
||
|
} templdep;
|
||
|
} ENodeUnion;
|
||
|
|
||
|
struct ENode {
|
||
|
ENodeType type;
|
||
|
UInt8 cost;
|
||
|
UInt16 flags; // &1, &2 correspond to quals
|
||
|
Boolean ignored;
|
||
|
Boolean hascall;
|
||
|
// void *loc; - might not be in pro7?
|
||
|
Type *rtype;
|
||
|
PointsToFunction *pointsTo;
|
||
|
ENodeUnion data;
|
||
|
};
|
||
|
|
||
|
enum {
|
||
|
ENODE_FLAG_CONST = Q_CONST,
|
||
|
ENODE_FLAG_VOLATILE = Q_VOLATILE,
|
||
|
ENODE_FLAG_QUALS = Q_CONST | Q_VOLATILE
|
||
|
};
|
||
|
|
||
|
#ifdef __MWERKS__
|
||
|
#pragma options align=reset
|
||
|
#endif
|
||
|
|
||
|
#endif
|