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

📄 genc30.h

📁 一款拥有一定历史的C语言编译器
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * C compiler * ========== * * Copyright 1989, 1990, 1991 Christoph van Wuellen. * Credits to Matthew Brandt. * All commercial rights reserved. * * This compiler may be redistributed as long there is no * commercial interest. The compiler must not be redistributed * without its full sources. This notice must stay intact. * * History: * * 1989   starting an 68000 C compiler, starting with material *        originally by M. Brandt * 1990   68000 C compiler further bug fixes *        started i386 port (December) * 1991   i386 port finished (January) *        further corrections in the front end and in the 68000 *        code generator. *        The next port will be a SPARC port */#ifndef _GENC30_H#define _GENC30_H#ifdef DEBUG/*#define REGISTER_FLOW_ANALYZER */#endif/* enable data-flow-analyzer which differs between float and integer types */#define NO_MIX_WITH_FLOAT/*#define SAVE_PEEP_MEMORY */typedef unsigned int FLAGS;#define	F_NONE ((FLAGS) 0U)#define	F_DREG ((FLAGS) 1U)	/* data register direct mode allowed (INT)      */#define	F_FREG ((FLAGS) 2U)	/* float register direct mode allowed (FLOAT)   */#define	F_AREG ((FLAGS) 4U)	/* address register direct mode allowed */#define	F_IREG ((FLAGS) 8U)	/* Indexregister needed */#define	F_MEM ((FLAGS) 16U)	/* memory alterable modes allowed */#define	F_IMMED ((FLAGS) 32U)	/* immediate mode allowed */#define	F_VOL ((FLAGS) 64U)	/* need volitile operand  */#define	F_NOVALUE ((FLAGS) 128U)	/* dont need result value  */#define	F_USES ((FLAGS) 256U)	/* need result value more than once */					/* this forbids autoincrement modes */#define	F_DIRECT ((FLAGS) 512U)	/* Immediate will later be used as direct */#define	F_UNSIGNED ((FLAGS) 1024U)	/* Immediate will later be treated as unsigned  */#define F_XREG          ((FLAGS)(F_DREG | F_AREG | F_IREG))#define F_ALL           ((FLAGS)(F_DREG | F_FREG | F_AREG | F_IREG | F_MEM | F_IMMED))#define F_FALL          ((FLAGS)(F_FREG | F_MEM | F_IMMED))#define F_IALL          ((FLAGS)(F_DREG | F_AREG | F_IREG | F_MEM | F_IMMED))/* The instructions *//* * The order of the branch instructions must not be changed * since array revcond[] in the peephole optimizer relies on * them. * all arithmethical operations on r0 to r7 affects flags * only compare and test set Flags with all registers !!! * load of r0-r7 set flags too * load of other registers doesn't change flags */enum e_op{    op_absf,			/* float: abs(src) -> dst         */    op_absi,			/* int:   abs(src) -> dst         */#ifdef USE_ALL_OPCODES    op_addc,			/* int:   dst + src + cary -> dst */#endif    op_addf,			/* float: dst + src -> dst        */    op_addi,			/* int:   dst + src -> dst        */    op_and,			/* int:   dst & src -> dst        */    op_andn,			/* int:   dst & ~src -> dst       */    op_ash,			/* int:   dst << src -> dst (if src < 0: >> abs(src))  */    op_cmpf,			/* float: dst - src -> NIL        */    op_cmpi,			/* int:   dst - src -> NIL        */    op_fix,			/* int:   int(src) -> dst, src is float */    op_float,			/* float: float(src) -> dst, src is int */#ifdef USE_ALL_OPCODES    op_idle,			/*  idle until interupt (wait for interrupt) */    op_lde,			/* float: dst.exponentfield -> dst.exponentfield */#endif    op_ldf,			/* float: src -> dst              */    op_popldf,			/* float: src -> dst  pseudo op, like ldf, but peep wont touch it */#ifdef USE_ALL_OPCODES    op_ldfi,			/* float: src -> dst, interloked (Shared memoryacccess) */#endif    op_ldi,			/* int:   src -> dst              */    op_popldi,			/* int:   src -> dst  pseudo op, like ldi, but peep wont touch it */#ifdef USE_ALL_OPCODES    op_ldii,			/* int:   src -> dst, interloked (Shared memoryacccess) */    op_ldm,			/* float: src.mantissa -> dst.mantissa  */#endif    op_lsh,			/* uint:  dst << src -> dst (if src < 0: >> abs(src))   */    op_mpyf,			/* float: dst * src -> dst        */    op_mpyi,			/* int:   dst * src -> dst        */#ifdef USE_ALL_OPCODES    op_negb,			/* int:   0 - src - cary -> dst   */#endif    op_negf,			/* float: 0.0 - src -> dst        */    op_negi,			/* int:   0 - src   -> dst        */    op_nop,			/* no operation, addressarithmetic on src may be performed */#ifdef USE_ALL_OPCODES    op_norm,			/* float: normalize(src) -> dst   */#endif    op_not,			/* int:   ~src -> dst             */    op_pop,			/* int:   *sp-- -> dst            */    op_popf,			/* float: *sp-- -> dst            */    op_push,			/* int:   src -> *++sp            */    op_pushf,			/* float: src -> *++sp            */    op_pushnopeep,		/* int:   src -> *++sp   (pseudoop)     */    op_pushfnopeep,		/* float: src -> *++sp   (pseudoop)     */    op_or,			/* int:   dst | src -> dst        */#ifdef USE_ALL_OPCODES    op_rnd,			/* float: round(src) -> dst       */    op_rol,			/* int:   rotateleft_1_bit(dst) -> dst       */    op_rolc,			/* int:   rotateleft_1_bit_carry(dst) -> dst */    op_ror,			/* int:   rotateright_1_bit(dst) -> dst      */    op_rorc,			/* int:   rotateright_1_bit_carry(dst) -> dst */#endif    op_rpts,			/* repeat following instruction src times    */    op_stf,			/* float: src -> dst<memory>      */#ifdef USE_ALL_OPCODES    op_stfi,			/* float: src -> dst<memory>, interloked (shared memoryaccess) */#endif    op_sti,			/* int:   src -> dst<memory>      */#ifdef USE_ALL_OPCODES    op_stii,			/* int:   src -> dst<memory>, interloked (shared memoryaccess) */    op_sigi,			/* signal interloked, (synchronice multiple processors) */    op_subb,			/* int:   dst - src - cary -> dst */    op_subc,			/* int:   conditional subtract and shift, part of divisionsroutine */#endif    op_subf,			/* float: dst - src -> dst        */    op_subi,			/* int:   dst - src -> dst        */#ifdef USE_ALL_OPCODES    op_subrb,			/* int:   src - dst - cary -> dst (dst and src exchanged) */#endif    op_subrf,			/* float: src - dst -> dst (dst and src exchanged) */    op_subri,			/* int:   src - dst -> dst (dst and src exchanged) */    op_tstb,			/* int:   dst & src -> NIL        */    op_xor,			/* int:   dst ^ src -> dst        */#ifdef USE_ALL_OPCODES    op_iack,			/* generate iack pulse (interrupt aknowledge) */    op_addc3,			/* int:   src1 + src2 + cary -> dst */#endif    op_addf3,			/* float: src1 + src2 -> dst        */    op_addi3,			/* int:   src1 + src2 -> dst        */    op_and3,			/* int:   src1 & src2 -> dst        */    op_andn3,			/* int:   src1 & ~src2 -> dst       */    op_ash3,			/* int:   src2 << src1 -> dst (if src1 < 0: >> abs(src1)) */    op_cmpf3,			/* float: src1 - src2 -> NIL        */    op_cmpi3,			/* int:   src1 - src2 -> NIL        */    op_lsh3,			/* int:   src2 << src1 -> dst (if src1 < 0: >> abs(src1)) */    op_mpyf3,			/* float: src1 * src2 -> dst        */    op_mpyi3,			/* int:   src1 * src2 -> dst        */    op_or3,			/* int:   src1 | src2 -> dst        */#ifdef USE_ALL_OPCODES    op_subb3,			/* int:   src1 - src2 -cary -> dst  */#endif    op_subf3,			/* float: src1 - src2 -> dst        */    op_subi3,			/* int:   src1 - src2 -> dst        */    op_tstb3,			/* int:   src1 & src2 -> NIL        */    op_xor3,			/* int:   src1 ^ src2 -> dst        */    op_ldfu,			/* float: src -> dst, flags unaffected */    op_ldflo,			/* float: if lower:       src -> dst, flags unaffected */    op_ldfls,			/* float: if lowerorsame: src -> dst, flags unaffected */    op_ldfhi,			/* float: if higher:      src -> dst, flags unaffected */    op_ldfhs,			/* float: if higerorsame: src -> dst, flags unaffected */    op_ldfeq,			/* float: if equal:       src -> dst, flags unaffected */    op_ldfne,			/* float: if notequal:    src -> dst, flags unaffected */    op_ldflt,			/* float: if lessthan:    src -> dst, flags unaffected */    op_ldfle,			/* float: if lessorequal: src -> dst, flags unaffected */    op_ldfgt,			/* float: if greater:     src -> dst, flags unaffected */    op_ldfge,			/* float: if greatorequal:src -> dst, flags unaffected */    op_ldfz,			/* float: if zero:        src -> dst, flags unaffected */    op_ldfnz,			/* float: if nozero:      src -> dst, flags unaffected */    op_ldfp,			/* float: if positive:    src -> dst, flags unaffected */    op_ldfn,			/* float: if negative:    src -> dst, flags unaffected */    op_ldfnn,			/* float: if notnegative: src -> dst, flags unaffected */    op_ldiu,			/* int:  src -> dst, flags unaffected */    op_ldilo,			/* int:   if lower:       src -> dst, flags unaffected */    op_ldils,			/* int:   if lowerorsame: src -> dst, flags unaffected */    op_ldihi,			/* int:   if higher:      src -> dst, flags unaffected */    op_ldihs,			/* int:   if higerorsame: src -> dst, flags unaffected */    op_ldieq,			/* int:   if equal:       src -> dst, flags unaffected */    op_ldine,			/* int:   if notequal:    src -> dst, flags unaffected */    op_ldilt,			/* int:   if lessthan:    src -> dst, flags unaffected */    op_ldile,			/* int:   if lessorequal: src -> dst, flags unaffected */    op_ldigt,			/* int:   if greater:     src -> dst, flags unaffected */    op_ldige,			/* int:   if greatorequal:src -> dst, flags unaffected */    op_ldiz,			/* int:   if zero:        src -> dst, flags unaffected */    op_ldinz,			/* int:   if nozero:      src -> dst, flags unaffected */    op_ldip,			/* int:   if positive:    src -> dst, flags unaffected */    op_ldin,			/* int:   if negative:    src -> dst, flags unaffected */    op_ldinn,			/* int:   if notnegative: src -> dst, flags unaffected */    op_br,			/* branch  (absolute jump, whole addressrange)         */    op_brd,			/* branch delayed, next 3 instructions will be executed */    op_call,			/* call subroutine  (absolute jump, whole addressrange) */    op_xcall,			/* pseudo opcode, marks call of supportrutine, but same */    /* op_call. is needed for peepholeoptimizer            */    op_rptb,			/* repeat a block from current pc to label (RC) times  */#ifdef USE_ALL_OPCODES    op_swi,			/* Softwareinterupt, only for emulator                 */#endif    op_bu,			/* branch unconditionally, if dst = register: absolute */    /* if dest = label: relative, -\+ 32k addressrange     */    op_blo,			/* same as bu, but conditionally                       */    op_bls,			/* same as bu, but conditionally                       */    op_bhi,			/* same as bu, but conditionally                       */    op_bhs,			/* same as bu, but conditionally                       */    op_beq,			/* same as bu, but conditionally                       */    op_bne,			/* same as bu, but conditionally                       */    op_blt,			/* same as bu, but conditionally                       */    op_ble,			/* same as bu, but conditionally                       */    op_bgt,			/* same as bu, but conditionally                       */    op_bge,			/* same as bu, but conditionally                       */    op_bz,			/* same as bu, but conditionally                       */    op_bnz,			/* same as bu, but conditionally                       */    op_bp,			/* same as bu, but conditionally                       */    op_bn,			/* same as bu, but conditionally                       */    op_bnn,			/* same as bu, but conditionally                       */    op_bud,			/* same as bu, but delayed (next 3 instr. will be executed */    op_blod,			/* same as bud, but conditionally                      */    op_blsd,			/* same as bud, but conditionally                      */    op_bhid,			/* same as bud, but conditionally                      */    op_bhsd,			/* same as bud, but conditionally                      */    op_beqd,			/* same as bud, but conditionally                      */    op_bned,			/* same as bud, but conditionally                      */    op_bltd,			/* same as bud, but conditionally                      */    op_bled,			/* same as bud, but conditionally                      */    op_bgtd,			/* same as bdu, but conditionally                      */    op_bged,			/* same as bud, but conditionally                      */    op_bzd,			/* same as bud, but conditionally                      */    op_bnzd,			/* same as bud, but conditionally                      */    op_bpd,			/* same as bud, but conditionally                      */    op_bnd,			/* same as bud, but conditionally                      */    op_bnnd,			/* same as bud, but conditionally                      */#ifdef USE_ALL_OPCODES    op_dbu,			/* decrement src, branch if not zero reached like bu   */    op_dblo,			/* like dbu, but for branch condition mudst be true    */    op_dbls,			/* like dbu, but for branch condition mudst be true    */    op_dbhi,			/* like dbu, but for branch condition mudst be true    */    op_dbhs,			/* like dbu, but for branch condition mudst be true    */    op_dbeq,			/* like dbu, but for branch condition mudst be true    */    op_dbne,			/* like dbu, but for branch condition mudst be true    */    op_dblt,			/* like dbu, but for branch condition mudst be true    */    op_dble,			/* like dbu, but for branch condition mudst be true    */    op_dbgt,			/* like dbu, but for branch condition mudst be true    */    op_dbge,			/* like dbu, but for branch condition mudst be true    */    op_dbz,			/* like dbu, but for branch condition mudst be true    */    op_dbnz,			/* like dbu, but for branch condition mudst be true    */    op_dbp,			/* like dbu, but for branch condition mudst be true    */    op_dbn,			/* like dbu, but for branch condition mudst be true    */    op_dbnn,			/* like dbu, but for branch condition mudst be true    */    op_dbud,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dblod,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dblsd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbhid,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbhsd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbeqd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbned,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbltd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbled,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbgtd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbged,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbzd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbnzd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbpd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbnd,			/* like dbxx, but delayed, next 3 instr will be executed */    op_dbnnd,			/* like dbxx, but delayed, next 3 instr will be executed */#endif    op_callu,			/* call unconditionally, if dst = register: absolute     */    /* if dest = label: relative, -\+ 32k addressrange      */#ifdef USE_ALL_OPCODES    op_calllo,			/* like callu, but contitionally                        */    op_callls,			/* like callu, but contitionally                        */    op_callhi,			/* like callu, but contitionally                        */    op_callhs,			/* like callu, but contitionally                        */    op_calleq,			/* like callu, but contitionally                        */    op_callne,			/* like callu, but contitionally                        */

⌨️ 快捷键说明

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