/* x86/linux lburg spec. Derived from x86.md by
Marcos Ramirez <marcos@inf.utfsm.cl>
Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
Jacob Navia <jacob@jacob.remcomp.fr>
*/
enum { EAX=0, ECX=1, EDX=2, EBX=3, ESI=6, EDI=7 };
#include "c.h"
#define NODEPTR_TYPE Node
#define OP_LABEL(p) ((p)->op)
#define LEFT_CHILD(p) ((p)->kids[0])
#define RIGHT_CHILD(p) ((p)->kids[1])
#define STATE_LABEL(p) ((p)->x.state)
extern int ckstack(Node, int);
extern int memop(Node);
extern int sametree(Node, Node);
static Symbol charreg[32], shortreg[32], intreg[32];
static Symbol fltreg[32];
static Symbol charregw, shortregw, intregw, fltregw;
static int cseg;
static Symbol quo, rem;
extern char *stabprefix;
extern void stabblock(int, int, Symbol*);
extern void stabend(Coordinate *, Symbol, Coordinate **, Symbol *, Symbol *);
extern void stabfend(Symbol, int);
extern void stabinit(char *, int, char *[]);
extern void stabline(Coordinate *);
extern void stabsym(Symbol);
extern void stabtype(Symbol);
static int pflag = 0;
static char rcsid[] = "$Id: x86linux.md,v 1.1 2002/08/28 23:12:48 drh Exp $";
#define hasargs(p) (p->syms[0] && p->syms[0]->u.c.v.i > 0 ? 0 : LBURG_MAX)
/*
generated at Sun Sep 16 10:29:26 2007
by $Id: lburg.c,v 2.10 2002/03/08 18:45:21 drh Exp $
*/
static void _kids(NODEPTR_TYPE, int, NODEPTR_TYPE[]);
static void _label(NODEPTR_TYPE);
static int _rule(void*, int);
#define _stmt_NT 1
#define _reg_NT 2
#define _freg_NT 3
#define _cnst_NT 4
#define _con_NT 5
#define _acon_NT 6
#define _baseaddr_NT 7
#define _base_NT 8
#define _index_NT 9
#define _con1_NT 10
#define _con2_NT 11
#define _con3_NT 12
#define _con0_NT 13
#define _addr_NT 14
#define _mem1_NT 15
#define _mem2_NT 16
#define _mem4_NT 17
#define _rc_NT 18
#define _mr_NT 19
#define _mr1_NT 20
#define _mr2_NT 21
#define _mrc_NT 22
#define _rc5_NT 23
#define _mrca_NT 24
#define _memf_NT 25
#define _flt_NT 26
#define _flt2_NT 27
#define _addrj_NT 28
#define _cmpf_NT 29
static char *_ntname[] = {
0,
"stmt",
"reg",
"freg",
"cnst",
"con",
"acon",
"baseaddr",
"base",
"index",
"con1",
"con2",
"con3",
"con0",
"addr",
"mem1",
"mem2",
"mem4",
"rc",
"mr",
"mr1",
"mr2",
"mrc",
"rc5",
"mrca",
"memf",
"flt",
"flt2",
"addrj",
"cmpf",
0
};
struct _state {
short cost[30];
struct {
unsigned int _stmt:7;
unsigned int _reg:7;
unsigned int _freg:6;
unsigned int _cnst:4;
unsigned int _con:1;
unsigned int _acon:2;
unsigned int _baseaddr:1;
unsigned int _base:3;
unsigned int _index:3;
unsigned int _con1:2;
unsigned int _con2:2;
unsigned int _con3:2;
unsigned int _con0:2;
unsigned int _addr:4;
unsigned int _mem1:2;
unsigned int _mem2:2;
unsigned int _mem4:2;
unsigned int _rc:2;
unsigned int _mr:2;
unsigned int _mr1:2;
unsigned int _mr2:2;
unsigned int _mrc:3;
unsigned int _rc5:2;
unsigned int _mrca:3;
unsigned int _memf:3;
unsigned int _flt:2;
unsigned int _flt2:2;
unsigned int _addrj:2;
unsigned int _cmpf:3;
} rule;
};
static short _nts_0[] = { 0 };
static short _nts_1[] = { _reg_NT, 0 };
static short _nts_2[] = { _cnst_NT, 0 };
static short _nts_3[] = { _freg_NT, 0 };
static short _nts_4[] = { _reg_NT, _acon_NT, 0 };
static short _nts_5[] = { _reg_NT, _con1_NT, 0 };
static short _nts_6[] = { _reg_NT, _con2_NT, 0 };
static short _nts_7[] = { _reg_NT, _con3_NT, 0 };
static short _nts_8[] = { _base_NT, 0 };
static short _nts_9[] = { _baseaddr_NT, 0 };
static short _nts_10[] = { _index_NT, _baseaddr_NT, 0 };
static short _nts_11[] = { _reg_NT, _baseaddr_NT, 0 };
static short _nts_12[] = { _index_NT, _reg_NT, 0 };
static short _nts_13[] = { _index_NT, 0 };
static short _nts_14[] = { _addr_NT, 0 };
static short _nts_15[] = { _con_NT, 0 };
static short _nts_16[] = { _mem4_NT, 0 };
static short _nts_17[] = { _mem1_NT, 0 };
static short _nts_18[] = { _mem2_NT, 0 };
static short _nts_19[] = { _rc_NT, 0 };
static short _nts_20[] = { _mr_NT, 0 };
static short _nts_21[] = { _mr1_NT, 0 };
static short _nts_22[] = { _mr2_NT, 0 };
static short _nts_23[] = { _reg_NT, _mrc_NT, 0 };
static short _nts_24[] = { _addr_NT, _mem4_NT, _con1_NT, 0 };
static short _nts_25[] = { _addr_NT, _mem4_NT, _rc_NT, 0 };
static short _nts_26[] = { _addr_NT, _mem4_NT, 0 };
static short _nts_27[] = { _reg_NT, _rc5_NT, 0 };
static short _nts_28[] = { _addr_NT, _mem4_NT, _rc5_NT, 0 };
static short _nts_29[] = { _con_NT, _mr_NT, 0 };
static short _nts_30[] = { _reg_NT, _mr_NT, 0 };
static short _nts_31[] = { _reg_NT, _reg_NT, 0 };
static short _nts_32[] = { _addr_NT, _rc_NT, 0 };
static short _nts_33[] = { _mrca_NT, 0 };
static short _nts_34[] = { _memf_NT, 0 };
static short _nts_35[] = { _addr_NT, _freg_NT, 0 };
static short _nts_36[] = { _freg_NT, _flt_NT, 0 };
static short _nts_37[] = { _freg_NT, _flt2_NT, 0 };
static short _nts_38[] = { _addrj_NT, 0 };
static short _nts_39[] = { _mem4_NT, _rc_NT, 0 };
static short _nts_40[] = { _mr_NT, _con_NT, _con0_NT, 0 };
static short _nts_41[] = { _addr_NT, _con_NT, _con0_NT, 0 };
static short _nts_42[] = { _cmpf_NT, _freg_NT, 0 };
static short _nts_43[] = { _freg_NT, _addr_NT, 0 };
static short *_nts[] = {
0, /* 0 */
_nts_0, /* 1 */
_nts_0, /* 2 */
_nts_0, /* 3 */
_nts_0, /* 4 */
_nts_0, /* 5 */
_nts_0, /* 6 */
_nts_0, /* 7 */
_nts_0, /* 8 */
_nts_0, /* 9 */
_nts_0, /* 10 */
_nts_0, /* 11 */
_nts_0, /* 12 */
_nts_1, /* 13 */
_nts_1, /* 14 */
_nts_1, /* 15 */
_nts_1, /* 16 */
_nts_1, /* 17 */
_nts_1, /* 18 */
_nts_1, /* 19 */
_nts_1, /* 20 */
_nts_1, /* 21 */
_nts_1, /* 22 */
_nts_1, /* 23 */
_nts_1, /* 24 */
_nts_0, /* 25 */
_nts_0, /* 26 */
_nts_0, /* 27 */
_nts_0, /* 28 */
_nts_0, /* 29 */
_nts_0, /* 30 */
_nts_0, /* 31 */
_nts_0, /* 32 */
_nts_0, /* 33 */
_nts_0, /* 34 */
_nts_2, /* 35 */
_nts_1, /* 36 */
_nts_3, /* 37 */
_nts_0, /* 38 */
_nts_0, /* 39 */
_nts_2, /* 40 */
_nts_0, /* 41 */
_nts_1, /* 42 */
_nts_4, /* 43 */
_nts_4, /* 44 */
_nts_4, /* 45 */
_nts_0, /* 46 */
_nts_0, /* 47 */
_nts_1, /* 48 */
_nts_5, /* 49 */
_nts_6, /* 50 */
_nts_7, /* 51 */
_nts_5, /* 52 */
_nts_6, /* 53 */
_nts_7, /* 54 */
_nts_0, /* 55 */
_nts_0, /* 56 */
_nts_0, /* 57 */
_nts_0, /* 58 */
_nts_0, /* 59 */
_nts_0, /* 60 */
_nts_0, /* 61 */
_nts_0, /* 62 */
_nts_8, /* 63 */
_nts_9, /* 64 */
_nts_10, /* 65 */
_nts_10, /* 66 */
_nts_10, /* 67 */
_nts_11, /* 68 */
_nts_11, /* 69 */
_nts_11, /* 70 */
_nts_12, /* 71 */
_nts_12, /* 72 */
_nts_12, /* 73 */
_nts_13, /* 74 */
_nts_14, /* 75 */
_nts_14, /* 76 */
_nts_14, /* 77 */
_nts_14, /* 78 */
_nts_14, /* 79 */
_nts_14, /* 80 */
_nts_14, /* 81 */
_nts_1, /* 82 */
_nts_15, /* 83 */
_nts_1, /* 84 */
_nts_16, /* 85 */
_nts_1, /* 86 */
_nts_17, /* 87 */
_nts_1, /* 88 */
_nts_18, /* 89 */
_nts_16, /* 90 */
_nts_17, /* 91 */
_nts_18, /* 92 */
_nts_19, /* 93 */
_nts_14, /* 94 */
_nts_20, /* 95 */
_nts_21, /* 96 */
_nts_22, /* 97 */
_nts_15, /* 98 */
_nts_1, /* 99 */
_nts_1, /* 100 */
_nts_1, /* 101 */
_nts_1, /* 102 */
_nts_1, /* 103 */
_nts_1, /* 104 */
_nts_1, /* 105 */
_nts_23, /* 106 */
_nts_23, /* 107 */
_nts_23, /* 108 */
_nts_23, /* 109 */
_nts_23, /* 110 */
_nts_23, /* 111 */
_nts_23, /* 112 */
_nts_23, /* 113 */
_nts_23, /* 114 */
_nts_23, /* 115 */
_nts_23, /* 116 */
_nts_23, /* 117 */
_nts_24, /* 118 */
_nts_24, /* 119 */
_nts_24, /* 120 */
_nts_24, /* 121 */
_nts_24, /* 122 */
_nts_24, /* 123 */
_nts_25, /* 124 */
_nts_25, /* 125 */
_nts_25, /* 126 */
_nts_25, /* 127 */
_nts_25, /* 128 */
_nts_25, /* 129 */
_nts_25, /* 130 */
_nts_25, /* 131 */
_nts_25, /* 132 */
_nts_25, /* 133 */
_nts_1, /* 134 */
_nts_1, /* 135 */
_nts_1, /* 136 */
- 1
- 2
前往页