/* 
   Copyright 1994-2003 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  

   You may contact the author at:

   mailto::camille@bluegrass.net

   or by snail mail at:

   David Lindauer
   850 Washburn Ave Apt 99
   Louisville, KY 40222
*/
/*
 * iexpr.h
 *
 * ICODE structures
 */

#define F_ADDR 1
#define F_NOVALUE 2
#define F_VOL 4

/* icode innstruction opcodes */
enum i_ops { i_line, i_passthrough,
	i_label, i_goto, i_gosub, i_trap, i_int,i_ret, i_rett,
	i_add, i_sub, i_udiv, i_umod, i_sdiv, i_smod, i_umul, i_smul,
	i_lsl, i_lsr, i_asl, i_asr,
   i_neg, i_not, i_and, i_or, i_eor, 
   i_setne, i_sete, i_setc, i_seta, i_setnc, i_setbe,
   i_setl, i_setg, i_setle, i_setge, 
	i_assn, i_genword, i_coswitch, i_dc, i_assnblock,
	i_jc,i_ja,i_je,i_jnc,i_jbe,i_jne,i_jl,i_jg,i_jle,i_jge,
	i_parm, i_parmadj, i_parmblock, i_cppini, i_block, i_livein,
   i_icon, i_fcon,
	/* Dag- specific stuff */
	i_var, i_const, i_ptr, i_labcon,
};

/* icode address modes annd special regs */
enum i_adr { i_none, i_immed, i_direct,	i_ind, i_bf, 
/* special named nodes come AFTER rsp for no bugs */
		i_rsp, i_rret, i_rlink,
		i_rstruct, i_rstructstar };
/*
 * structure for startup/rundown records (used in #pragma ) 
 */
typedef struct _startup {
	struct _startup *link;
	char *name;	/* name */
	int val;	/* prio */
} STARTUP;

/*
 * address mode
 */
typedef struct _imode_{
        enum i_adr      mode;     	/* mode */
        int useindx ;
	char 		size;		/* size */
	char		startbit,bits;	/* bit width  for i_Bf*/
	char 		vol;		/* TRUE if is a node for a volatile var */
        struct enode    *offset;	/* offset */
} IMODE;

#define IM_LIVELEFT 1
#define IM_LIVERIGHT 2
/*
 * icode node
 * this is also used for dag nodes
 */
typedef struct quad {
	struct _basic_dag {
		enum i_ops opcode;	/* opcode */
		IMODE *left;	/* ans = left opcode right */
			/* for a i_label node, left is the label nnumber cast
			 * to a imode* */
		IMODE *right;
		struct ival {		/* values for constant nodes */
			long i;
			double f;
		} v;
		long	label;	/* aux values used by i_coswitch */
	} dc;
	char	livein;
	struct quad *fwd, *back;	/* linnkages */
	IMODE *ans;
   int definition ;
   int available ;
   int sourceindx ;
   int copy ;
} QUAD;

#define DAGCOMPARE sizeof(struct _basic_dag)
#define DAGSIZE 1023

#include "iexpr.p"	