⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genc30.h

📁 一款拥有一定历史的C语言编译器
💻 H
📖 第 1 页 / 共 3 页
字号:
struct flowlist{    ADDRESS *ap;#ifdef NO_MIX_WITH_FLOAT    ITYPE   type;#endif    FLOWLISTENTRY *next;};#define NIL_ADDRESS     ((ADDRESS *) 0)#define NIL_CODE        ((CODE *) 0)/* addressing mode structure */struct amode{    AMODE   mode;		/* addressing mode */    REG     preg, sreg;		/* register(s) used in addressing mode */    DEEP    deep;    union    {	EXPR   *offset;		/* expression used in addressing mode */	DEEP    sdeep;		/* deep for secondary register */    } u;};/* output code structure */struct ocode{    OPCODE  opcode;		/* opcode for this instruction       */    ITYPE   type;		/* float or integerinstruction       */    ADDRESS *src1;		/* first operand                     */    ADDRESS *src2;		/* second operand                    */    ADDRESS *dst;		/* third operand                     */    /* operands for parallel instructions */    ADDRESS *src21;		/* first  operand of 2nd instruction */    ADDRESS *src22;		/* second operand of 2nd instruction */    ADDRESS *dst2;		/* third  operand of 2nd instruction */#ifndef SAVE_MEMORY    PEEPINFO *info;		/* information for peephole optimizer */#endif    PEEPFLAGS flags;		/* flags for peephole optimizer      */    CODE   *fwd;		/* next instruction                  */    CODE   *back;		/* previous instruction              */};struct reglist{    int     number;		/* number of registers in the list */    REG    *reg;		/* register list */};/* *      The usage of registers is controlled by the information held *      within the following structure. */struct reg_use{    REGLIST *parameter;		/* Registers used to pass parameters */    REGLIST *save;		/* Registers saved by the function */    REGLIST *result;		/* Registers used to return results */};#define BRANCH_COUNT    2	/* abandon branch optimistaion if exceeded *//* *    defines for the peephole opimiser */#ifndef DEBUGtypedef unsigned int INSTR_INFO;#elsetypedef unsigned long INSTR_INFO;#endif#define DEST_MODIFY        ((INSTR_INFO)0x0001)#define DEST_OVERWRITE     ((INSTR_INFO)0x0002)#define SET_FLAGS          ((INSTR_INFO)0x0004)#define USE_FLAGS          ((INSTR_INFO)0x0008)#define SET_FLAGS_FOR_ALL  ((INSTR_INFO)0x0010)#define COMMUTATIVE_INSTR  ((INSTR_INFO)0x0020)#define PARALLEL_INSTR     ((INSTR_INFO)0x0040)#define HAS_OP3            ((INSTR_INFO)0x0080)#define OP_BRANCH          ((INSTR_INFO)0x0100)#define OP_JUMP            ((INSTR_INFO)0x0200)#define OP_RETURN          ((INSTR_INFO)0x0400)#define OP_LABEL           ((INSTR_INFO)0x0800)#define OP_CALL            ((INSTR_INFO)0x1000)#define OP_ASM             ((INSTR_INFO)0x2000)#define USES_SP            ((INSTR_INFO)0x4000)#define USES_CARRY_FLAG    ((INSTR_INFO)0x8000)#ifdef DEBUG#define FLOAT_INSTR       ((INSTR_INFO)0x10000)#else#define FLOAT_INSTR       ((INSTR_INFO)0)#endif#define DEST_ALTERED       (DEST_MODIFY | DEST_OVERWRITE)#define PAR_DEST_OVERWRITE (PARALLEL_INSTR | DEST_OVERWRITE)#define is_set_flags(ip)              ((op_flags[(ip)->opcode]&SET_FLAGS)!=0)#define is_set_all_flags(opcode)      ((op_flags[opcode]&SET_FLAGS_FOR_ALL)!=0)#define is_dest_overwritten(opcode)   ((op_flags[opcode]&DEST_OVERWRITE)!=0)#define is_parallel_opcode(opcode)    ((op_flags[opcode]&PARALLEL_INSTR)!=0)#define is_commutative_opcode(opcode) ((op_flags[opcode]&COMMUTATIVE_INSTR)!=0)#define is_op_op3_availlable(opcode)  ((op_flags[opcode]&HAS_OP3)!=0)#define is_controltransfer(opcode)    ((op_flags[opcode]&TRANSFER)!=0)#define is_pipelinegroup2_used(ip)    ((op_flags[(ip)->opcode]&USES_SP)!=0)#define is_using_sp(opcode)           ((op_flags[opcode]&USES_SP)!=0)#define is_using_carry(opcode)        ((op_flags[opcode]&USES_CARRY_FLAG)!=0)#define is_using_flags(opcode)        ((op_flags[opcode]&USE_FLAGS)!=0)#ifdef DEBUG#define is_float_instruction(opcode)  ((op_flags[opcode]&FLOAT_INSTR)!=0)#endif#ifdef SAVE_PEEP_MEMORY#define GET_PEEP_INFO(ip, PeepMap)	build_register_map(ip,PeepMap)#define Update_Peep_Info(ip)#define attach_peepinfo(ip)#else /* SAVE_PEEP_MEMORY */#define GET_PEEP_INFO(ip, Dummy)	(ip)->info#define Update_Peep_Info(ip)		update_peepinfo_fkt(ip)#define attach_peepinfo(ip)		attach_peepinfo_fkt(ip)#endif /* SAVE_PEEP_MEMORY */#define is_am_register(ap) (  (ap->mode == am_areg)||(ap->mode == am_ireg)\                            ||(ap->mode == am_dreg)||(ap->mode == am_freg)\                            ||(ap->mode == am_sreg))#ifdef MULTIPLE_PROCESSORS/* * remap function names - it is necessary to change the names of functions * if there are multiple code generators build into the compiler in order * to prevent name clashes. * * The following defines do the necessary renaming */#define address_register        address_registerC30#define	build_register_map	build_register_mapC30#define checkstack              checkstackC30#define copy_addr               copy_addrC30#define data_register           data_registerC30#define	find_label		find_labelC30#define float_register          float_registerC30#define flush_peep              flush_peepC30#define freeop                  freeopC30#define g_code                  g_codeC30#define g_code_parallel         g_code_parallelC30#define get_register            get_registerC30#define index_register          index_registerC30#define initstack               initstackC30#define is_free_data            is_free_dataC30#define is_free_addr            is_free_addrC30#define is_free_ireg            is_free_iregC30#define	is_register_used	is_register_usedC30#define mk_mreg                 mk_mregC30#define mk_reg                  mk_regC30#define	op_flags		op_flagsC30#define putamode_tst		putamode_tstC30#define putreg_tst		putreg_tstC30#define reg_usage               reg_usageC30#define regtype                 regtypeC30#define temp_inv                temp_invC30#define temporary_register      temporary_registerC30#define	update_peepinfo_fkt	update_peepinfo_fktC30#define validate                validateC30#endif /* MULTIPLE_PROCESSORS */extern REGUSAGE *reg_usage;	/* register usage *//* Constants for Optionsenumeration */#define OPT_YES     1#define OPT_NO      0#define OPT_NONE    0#define OPT_LEVEL1  1#define OPT_LEVEL2  2#define OPT_LEVEL3  3#define OPT_LEVEL4  4#define OPT_LEVEL5  5#define OPT_DO_ALL  99#define OPT_DEBUG   100/* stack optimisations */#define	OPT_SAFE	0#define	OPT_MINIMUM	1#define	OPT_AVERAGE	2#define	OPT_MAXIMUM	3/* peehole optimisations */#define	PEEP_NONE	0#define	PEEP_FLOW	0#define	PEEP_PIPELINE	1#define	PEEP_3OPERAND	2#define	PEEP_PARALLEL	3#define	PEEP_PARALLEL_ALL 4#define	PEEP_REMAP	5#define	PEEP_MINIMAL    6	/* dummy to enable minimalst optimisations */#define	PEEP_REDUNDANT  7#define	PEEP_STORE      8#define	PEEP_SWITCH     9#define	PEEP_HARD_REMAP 10#define	PEEP_VERY_HARD_REMAP 11#define	PEEP_ALL	((unsigned int)(0xFFFF))#define	PEEP_STANDARD  (MEMBER (PEEP_FLOW)     | \                        MEMBER (PEEP_PARALLEL) | \                        MEMBER (PEEP_REMAP)    | \                        MEMBER (PEEP_REDUNDANT))#define	is_peep_phase(l,x)	(((unsigned) l) & MEMBER(x))#define	is_switch_peep_enabled() (opt_peep_test > 9)extern REGTYPE regtype[];	/* type of register */extern INSTR_INFO op_flags[];extern int opt_delayed_branches;extern const CHAR *opt_peep_sequence;extern int opt_branches;extern int opt_peep_test;/* flowc30 */int flow_dataflow P_ ((CODE *, int));/* genc30 */extern REG frameptr;ADDRESS *mk_reg P_ ((REG));ADDRESS *mk_freg P_ ((REG));ADDRESS *copy_addr P_ ((ADDRESS *, AMODE));ADDRESS *mk_label P_ ((LABEL));#ifdef FLOAT_SUPPORTBOOL is_short_float P_ ((const RVAL, BTYPE));#endif /* FLOAT_SUPPORT *//* outc30 */#ifdef DEBUGvoid putamode_tst P_ ((const ADDRESS *));void putreg_tst P_ ((REG));#endif /* DEBUG *//* peepc30 */BOOL is_equal_address P_ ((const ADDRESS *, const ADDRESS *));BOOL is_register_used P_ ((REG, const ADDRESS *));CODE   *find_label P_ ((LABEL));void build_register_map P_ ((const CODE *, PEEPINFO *));void g_code P_ ((OPCODE, ITYPE, ADDRESS *, ADDRESS *));void g_code3 P_ ((OPCODE, ITYPE, ADDRESS *, ADDRESS *, ADDRESS *));void    g_code_parallelP_ (    (OPCODE, ITYPE, ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *,     ADDRESS *));void flush_peep P_ ((unsigned));void init_peep P_ ((void));void update_peepinfo_fkt P_ ((CODE *));#ifdef VERBOSEvoid c30_peep_report P0 (void);#endif/* regc30 */ADDRESS *address_register P_ ((void));ADDRESS *data_register P_ ((FLAGS));ADDRESS *index_register P_ ((void));ADDRESS *temporary_register P_ ((FLAGS));BOOL is_free_addr P_ ((void));BOOL is_free_data P_ ((void));BOOL is_free_ireg P_ ((void));void checkstack P_ ((void));void freeop P_ ((const ADDRESS *));void initstack P_ ((void));void temp_inv P_ ((void));void validate P_ ((const ADDRESS *));#endif /* _GENC30_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -