x86linux.c

来自「基于4个mips核的noc设计」· C语言 代码 · 共 2,383 行 · 第 1/5 页

C
2,383
字号
/* x86/linux lburg spec. Derived from x86.md byMarcos 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: x86.nw,v 2.25 1998/07/02 00:26:44 drh Exp $";#define hasargs(p) (p->syms[0] && p->syms[0]->u.c.v.i > 0 ? 0 : LBURG_MAX)/*generated at Tue Dec 18 12:37:01 2007by $Id: lburg.c,v 2.8 1997/10/30 23:41:10 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 _addrj_NT 27#define _cmpf_NT 28static 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",	"addrj",	"cmpf",	0};struct _state {	short cost[29];	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 _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[] = { _addrj_NT, 0 };static short _nts_38[] = { _mem4_NT, _rc_NT, 0 };static short _nts_39[] = { _mr_NT, _con_NT, _con0_NT, 0 };static short _nts_40[] = { _addr_NT, _con_NT, _con0_NT, 0 };static short _nts_41[] = { _cmpf_NT, _freg_NT, 0 };static short _nts_42[] = { _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 */	_nts_26,	/* 137 */	_nts_26,	/* 138 */	_nts_26,	/* 139 */	_nts_27,	/* 140 */	_nts_27,	/* 141 */	_nts_27,	/* 142 */	_nts_27,	/* 143 */	_nts_28,	/* 144 */	_nts_28,	/* 145 */	_nts_28,	/* 146 */	_nts_28,	/* 147 */	_nts_0,	/* 148 */	_nts_1,	/* 149 */	_nts_23,	/* 150 */	_nts_29,	/* 151 */	_nts_30,	/* 152 */	_nts_31,	/* 153 */	_nts_31,	/* 154 */	_nts_31,	/* 155 */	_nts_31,	/* 156 */	_nts_1,	/* 157 */	_nts_1,	/* 158 */	_nts_14,	/* 159 */	_nts_14,	/* 160 */	_nts_14,	/* 161 */	_nts_14,	/* 162 */	_nts_1,	/* 163 */	_nts_1,	/* 164 */	_nts_1,	/* 165 */	_nts_1,	/* 166 */	_nts_1,	/* 167 */	_nts_1,	/* 168 */	_nts_1,	/* 169 */	_nts_1,	/* 170 */	_nts_16,	/* 171 */	_nts_19,	/* 172 */	_nts_0,	/* 173 */	_nts_0,	/* 174 */	_nts_32,	/* 175 */	_nts_32,	/* 176 */	_nts_32,	/* 177 */	_nts_32,	/* 178 */	_nts_32,	/* 179 */	_nts_32,	/* 180 */	_nts_32,	/* 181 */	_nts_33,	/* 182 */	_nts_33,	/* 183 */	_nts_33,	/* 184 */	_nts_31,	/* 185 */	_nts_1,	/* 186 */	_nts_14,	/* 187 */	_nts_14,	/* 188 */	_nts_14,	/* 189 */	_nts_14,	/* 190 */	_nts_34,	/* 191 */	_nts_35,	/* 192 */	_nts_35,	/* 193 */	_nts_35,	/* 194 */	_nts_3,	/* 195 */	_nts_3,	/* 196 */	_nts_3,	/* 197 */	_nts_3,	/* 198 */	_nts_34,	/* 199 */	_nts_3,	/* 200 */	_nts_36,	/* 201 */	_nts_36,	/* 202 */	_nts_36,	/* 203 */	_nts_36,	/* 204 */	_nts_36,	/* 205 */	_nts_36,	/* 206 */	_nts_36,	/* 207 */	_nts_36,	/* 208 */	_nts_3,	/* 209 */	_nts_3,	/* 210 */	_nts_35,	/* 211 */	_nts_3,	/* 212 */	_nts_14,	/* 213 */	_nts_1,	/* 214 */	_nts_14,	/* 215 */	_nts_1,	/* 216 */	_nts_0,	/* 217 */	_nts_1,	/* 218 */	_nts_16,	/* 219 */	_nts_0,	/* 220 */	_nts_37,	/* 221 */	_nts_38,	/* 222 */	_nts_38,	/* 223 */	_nts_38,	/* 224 */	_nts_38,	/* 225 */	_nts_38,	/* 226 */	_nts_38,	/* 227 */	_nts_38,	/* 228 */	_nts_38,	/* 229 */	_nts_38,	/* 230 */	_nts_38,	/* 231 */	_nts_23,	/* 232 */	_nts_23,	/* 233 */	_nts_23,	/* 234 */	_nts_23,	/* 235 */	_nts_23,	/* 236 */	_nts_23,	/* 237 */	_nts_23,	/* 238 */	_nts_23,	/* 239 */	_nts_23,	/* 240 */	_nts_23,	/* 241 */	_nts_23,	/* 242 */	_nts_23,	/* 243 */	_nts_39,	/* 244 */	_nts_39,	/* 245 */	_nts_40,	/* 246 */	_nts_40,	/* 247 */	_nts_40,	/* 248 */	_nts_40,	/* 249 */	_nts_40,	/* 250 */	_nts_14,	/* 251 */	_nts_14,	/* 252 */	_nts_14,	/* 253 */	_nts_3,	/* 254 */	_nts_41,	/* 255 */	_nts_41,	/* 256 */	_nts_41,	/* 257 */	_nts_41,	/* 258 */	_nts_41,	/* 259 */	_nts_41,	/* 260 */	_nts_41,	/* 261 */	_nts_41,	/* 262 */	_nts_41,	/* 263 */	_nts_41,	/* 264 */	_nts_41,	/* 265 */	_nts_41,	/* 266 */	_nts_42,	/* 267 */	_nts_35,	/* 268 */	_nts_42,	/* 269 */	_nts_35,	/* 270 */	_nts_42,	/* 271 */	_nts_42,	/* 272 */	_nts_42,	/* 273 */	_nts_35,	/* 274 */	_nts_42,	/* 275 */	_nts_35,	/* 276 */	_nts_42,	/* 277 */	_nts_42,	/* 278 */	_nts_42,	/* 279 */	_nts_42,	/* 280 */	_nts_42,	/* 281 */	_nts_42,	/* 282 */	_nts_34,	/* 283 */	_nts_37,	/* 284 */	_nts_37,	/* 285 */	_nts_37,	/* 286 */	_nts_37,	/* 287 */	_nts_37,	/* 288 */	_nts_37,	/* 289 */	_nts_37,	/* 290 */

⌨️ 快捷键说明

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