348 lines
5.8 KiB
C
348 lines
5.8 KiB
C
|
#ifndef h_tree
|
||
|
#define h_tree
|
||
|
/******************************************************************************
|
||
|
*
|
||
|
* Definition of a compiler TREE
|
||
|
*
|
||
|
* Module %M% Version %I% Date %H%
|
||
|
*
|
||
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
||
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
||
|
* The copyright notice above does not evidence any actual or intented
|
||
|
* publication of such source code.
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
*
|
||
|
* Maintenence log - insert most recent change descriptions at top
|
||
|
*
|
||
|
* Date.... GTAR# WHO Description.........................................
|
||
|
* 10/14/98 23801 SAP Change copyrights.
|
||
|
* 05/11/94 13836 RM Add iso to TRop
|
||
|
* 03/08/94 12297 JSW Add TRonerror
|
||
|
* 12/23/93 12408 SHK Additional change for 7.3.2 port to DEC AXP
|
||
|
* 10/20/93 12408 SHK Port 7.3.2 to DEC AXP
|
||
|
* 08/02/93 10978 SHK Port to DEC AXP
|
||
|
* 08/18/92 7571 JWT Wide 0 support for boolean tests
|
||
|
* 08/04/92 9630 JWT fix evalmove case where matrix element was both a
|
||
|
* source operand and the destination of an operator. The
|
||
|
* evaluation of the Omatrix_load operation is forced to
|
||
|
* be the last operand evaluated, to avoid a possible
|
||
|
* conflict with another operand overwritting the expected
|
||
|
* destination address register. New node type TRdelaymat
|
||
|
* is used to mark the node for delayed evaluation.
|
||
|
* 10/25/91 8806 RM Support for transaction management
|
||
|
* 08/22/90 7385 JWT NBASIC CONTINUE statement
|
||
|
* 08/14/90 7258 JWT merge INPUT syntaxes
|
||
|
* 10/06/89 4820 JWT add missing declaration
|
||
|
* 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10.
|
||
|
*
|
||
|
*****************************************************************************/
|
||
|
|
||
|
#ifndef TREE
|
||
|
|
||
|
#define resolve( x ) fix_address( x )
|
||
|
#define fix_goto( x ) fix_address( x )
|
||
|
|
||
|
|
||
|
#define T_OP struct t_op
|
||
|
#define T_REF struct t_ref
|
||
|
#define T_REGR struct t_regr
|
||
|
#define T_INFO struct t_info
|
||
|
#define T_MOVE struct t_move
|
||
|
#define T_MOVE2 struct t_move2
|
||
|
#define T_MOVE3 struct t_move3
|
||
|
#define T_COND struct t_cond
|
||
|
#define T_TEST struct t_test
|
||
|
#define T_TEXP struct t_texp
|
||
|
#define T_JUMP struct t_jump
|
||
|
#define T_LOOP struct t_loop
|
||
|
#define T_FOR struct t_for
|
||
|
#define T_CALL struct t_call
|
||
|
#define T_ARR struct t_arr
|
||
|
#define T_TRAP struct t_trap
|
||
|
#define T_INAT struct t_inat
|
||
|
#define T_INFM struct t_infm
|
||
|
#define TREEDAT union treedat
|
||
|
#define TREE struct tree
|
||
|
|
||
|
#define TRop 1
|
||
|
#define TRref 2
|
||
|
#define TRlabel 3
|
||
|
#define TRlist 4
|
||
|
#define TRif 5
|
||
|
#define TRnum 6
|
||
|
#define TRint 7
|
||
|
#define TRstr 8
|
||
|
#define TRcond 9
|
||
|
#define TRstmt 10
|
||
|
#define TRclist 11
|
||
|
#define TRlock 12
|
||
|
#define TRifexp 13
|
||
|
#define TRmove 14
|
||
|
#define TRjump 15
|
||
|
#define TRloop 16
|
||
|
#define TRfor 17
|
||
|
#define TRkstr 18
|
||
|
#define TRcall 19
|
||
|
#define TRrw 20
|
||
|
#define TRmove2 21
|
||
|
#define TRmove3 22
|
||
|
#define TRarr 23
|
||
|
#define TRtrap 24
|
||
|
#define TRreg 26
|
||
|
#define TRinfo 27
|
||
|
#define TRmat 28
|
||
|
#define TRexit 29
|
||
|
#define TRinat 30
|
||
|
#define TRinfm 31
|
||
|
#define TRcont 32
|
||
|
#define TRtrans 33
|
||
|
#define TRdelaymat 34
|
||
|
#define TRonerror 35
|
||
|
|
||
|
#define CONDwhile 1
|
||
|
#define CONDuntil 2
|
||
|
#define CONDcase 3
|
||
|
#define CONDxwhl 4
|
||
|
#define CONDxntl 5
|
||
|
#define CONDtrans 6
|
||
|
|
||
|
|
||
|
struct t_ref
|
||
|
{
|
||
|
int symnum;
|
||
|
int offset;
|
||
|
};
|
||
|
|
||
|
struct t_regr
|
||
|
{
|
||
|
int regnum;
|
||
|
};
|
||
|
|
||
|
struct t_info
|
||
|
{
|
||
|
short flags;
|
||
|
};
|
||
|
|
||
|
struct t_op
|
||
|
{
|
||
|
short opcode;
|
||
|
short count;
|
||
|
TREE *child;
|
||
|
TREE *last;
|
||
|
short iso;
|
||
|
};
|
||
|
|
||
|
struct t_move
|
||
|
{
|
||
|
TREE *srce;
|
||
|
TREE *dest;
|
||
|
};
|
||
|
|
||
|
struct t_move2
|
||
|
{
|
||
|
TREE *srce;
|
||
|
TREE *dest1;
|
||
|
TREE *dest2;
|
||
|
};
|
||
|
|
||
|
struct t_move3
|
||
|
{
|
||
|
TREE *srce;
|
||
|
TREE *dest1;
|
||
|
TREE *dest2;
|
||
|
TREE *dest3;
|
||
|
};
|
||
|
|
||
|
struct t_cond
|
||
|
{
|
||
|
int type;
|
||
|
TREE *expr;
|
||
|
TREE *stmt;
|
||
|
int widez;
|
||
|
};
|
||
|
|
||
|
struct t_test
|
||
|
{
|
||
|
TREE *expr;
|
||
|
TREE *lstmt;
|
||
|
TREE *tstmt;
|
||
|
TREE *estmt;
|
||
|
int widez;
|
||
|
};
|
||
|
|
||
|
struct t_texp
|
||
|
{
|
||
|
TREE *cexpr;
|
||
|
TREE *texpr;
|
||
|
TREE *eexpr;
|
||
|
int widez;
|
||
|
};
|
||
|
|
||
|
struct t_jump
|
||
|
{
|
||
|
int opcode;
|
||
|
TREE *expr;
|
||
|
TREE *list;
|
||
|
};
|
||
|
|
||
|
struct t_loop
|
||
|
{
|
||
|
TREE *ctrl;
|
||
|
TREE *stmt;
|
||
|
TREE *cstmt;
|
||
|
int widez;
|
||
|
};
|
||
|
|
||
|
struct t_for
|
||
|
{
|
||
|
TREE *var;
|
||
|
TREE *init;
|
||
|
TREE *lim;
|
||
|
TREE *step;
|
||
|
short opcode;
|
||
|
};
|
||
|
|
||
|
struct t_call
|
||
|
{
|
||
|
short opcode;
|
||
|
TREE *name;
|
||
|
TREE *args;
|
||
|
};
|
||
|
|
||
|
struct t_arr
|
||
|
{
|
||
|
TREE *var;
|
||
|
TREE *x;
|
||
|
TREE *y;
|
||
|
};
|
||
|
|
||
|
struct t_trap
|
||
|
{
|
||
|
int opcode;
|
||
|
TREE *arg;
|
||
|
TREE *stmt;
|
||
|
};
|
||
|
|
||
|
struct t_inat
|
||
|
{ TREE *xpos;
|
||
|
TREE *ypos;
|
||
|
int flag;
|
||
|
};
|
||
|
|
||
|
struct t_infm
|
||
|
{ TREE *len;
|
||
|
TREE *fmt;
|
||
|
short cflag;
|
||
|
short uflag;
|
||
|
};
|
||
|
|
||
|
union treedat
|
||
|
{
|
||
|
T_REF ref;
|
||
|
T_REGR regr;
|
||
|
T_INFO info;
|
||
|
T_OP op;
|
||
|
UVADDR symbol;
|
||
|
T_OP list;
|
||
|
double number;
|
||
|
int integer;
|
||
|
STRING string;
|
||
|
T_MOVE move;
|
||
|
T_MOVE2 move2;
|
||
|
T_MOVE3 move3;
|
||
|
T_COND cond;
|
||
|
T_TEST test;
|
||
|
T_TEXP texp;
|
||
|
T_JUMP jump;
|
||
|
T_LOOP loop;
|
||
|
T_FOR four;
|
||
|
T_CALL call;
|
||
|
T_ARR arr;
|
||
|
T_TRAP trap;
|
||
|
T_INAT inat;
|
||
|
T_INFM infm;
|
||
|
};
|
||
|
|
||
|
struct tree
|
||
|
{
|
||
|
int type;
|
||
|
TREEDAT data;
|
||
|
TREE *link;
|
||
|
int line;
|
||
|
};
|
||
|
|
||
|
/***********************************************************************/
|
||
|
|
||
|
typedef union
|
||
|
{
|
||
|
int none;
|
||
|
int count;
|
||
|
int symbol;
|
||
|
int pc;
|
||
|
int flag;
|
||
|
int integer;
|
||
|
TREE *tree;
|
||
|
double number;
|
||
|
STRING string;
|
||
|
} YYSTYPE;
|
||
|
|
||
|
EXTERN int pc;
|
||
|
|
||
|
EXTERN void TR_free(),
|
||
|
pTR_free(),
|
||
|
fix_address();
|
||
|
|
||
|
EXTERN TREE *exitnode(),
|
||
|
*LtoS(),
|
||
|
*Ltrim(),
|
||
|
*arrnode(),
|
||
|
*callnode(),
|
||
|
*trapnode(),
|
||
|
*concatnode(),
|
||
|
*cond(),
|
||
|
*ifexpr(),
|
||
|
*ifnode(),
|
||
|
*inatnode(),
|
||
|
*infmnode(),
|
||
|
*intnode(),
|
||
|
*labelnode(),
|
||
|
*listadd(),
|
||
|
*listnode(),
|
||
|
*locknode(),
|
||
|
*move(),
|
||
|
*move2(),
|
||
|
*move3(),
|
||
|
*numnode(),
|
||
|
*opnode(),
|
||
|
*refnode(),
|
||
|
*regnode(),
|
||
|
*infonode(),
|
||
|
*stmt(),
|
||
|
*fornode(),
|
||
|
*loopnode(),
|
||
|
*jmpnode(),
|
||
|
*kstrnode(),
|
||
|
*vgcode(),
|
||
|
*ccode(),
|
||
|
*rwnode(),
|
||
|
*strnode(),
|
||
|
*trblock(),
|
||
|
*onnode();
|
||
|
|
||
|
|
||
|
EXTERN int code(),
|
||
|
forward(),
|
||
|
gcode(),
|
||
|
get_num(),
|
||
|
jcode(),
|
||
|
l_ref(),
|
||
|
leval(),
|
||
|
new_register(),
|
||
|
pcode(),
|
||
|
vcode();
|
||
|
|
||
|
#endif
|
||
|
|
||
|
#endif /* end of tree.h */
|