github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/src/cmd/8a/lex.c (about)

     1  // Inferno utils/8a/lex.c
     2  // http://code.google.com/p/inferno-os/source/browse/utils/8a/lex.c
     3  //
     4  //	Copyright © 1994-1999 Lucent Technologies Inc.	All rights reserved.
     5  //	Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
     6  //	Portions Copyright © 1997-1999 Vita Nuova Limited
     7  //	Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
     8  //	Portions Copyright © 2004,2006 Bruce Ellis
     9  //	Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
    10  //	Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
    11  //	Portions Copyright © 2009 The Go Authors.  All rights reserved.
    12  //
    13  // Permission is hereby granted, free of charge, to any person obtaining a copy
    14  // of this software and associated documentation files (the "Software"), to deal
    15  // in the Software without restriction, including without limitation the rights
    16  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    17  // copies of the Software, and to permit persons to whom the Software is
    18  // furnished to do so, subject to the following conditions:
    19  //
    20  // The above copyright notice and this permission notice shall be included in
    21  // all copies or substantial portions of the Software.
    22  //
    23  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    24  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    25  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    26  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    27  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    28  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    29  // THE SOFTWARE.
    30  
    31  #define	EXTERN
    32  #include <u.h>
    33  #include <libc.h>
    34  #include "a.h"
    35  #include "y.tab.h"
    36  
    37  enum
    38  {
    39  	Plan9	= 1<<0,
    40  	Unix	= 1<<1,
    41  	Windows	= 1<<2,
    42  };
    43  
    44  int
    45  systemtype(int sys)
    46  {
    47  #ifdef _WIN32
    48  	return sys&Windows;
    49  #else
    50  	return sys&Plan9;
    51  #endif
    52  }
    53  
    54  int
    55  pathchar(void)
    56  {
    57  	return '/';
    58  }
    59  
    60  int
    61  Lconv(Fmt *fp)
    62  {
    63  	return linklinefmt(ctxt, fp);
    64  }
    65  
    66  void
    67  dodef(char *p)
    68  {
    69  	if(nDlist%8 == 0)
    70  		Dlist = allocn(Dlist, nDlist*sizeof(char *),
    71  			8*sizeof(char *));
    72  	Dlist[nDlist++] = p;
    73  }
    74  
    75  void
    76  usage(void)
    77  {
    78  	print("usage: %ca [options] file.c...\n", thechar);
    79  	flagprint(1);
    80  	errorexit();
    81  }
    82  void
    83  main(int argc, char *argv[])
    84  {
    85  	char *p;
    86  
    87  	thechar = '8';
    88  	thestring = "386";
    89  
    90  	ctxt = linknew(&link386);
    91  	ctxt->diag = yyerror;
    92  	ctxt->bso = &bstdout;
    93  	ctxt->enforce_data_order = 1;
    94  	Binit(&bstdout, 1, OWRITE);
    95  	listinit8();
    96  	fmtinstall('L', Lconv);
    97  
    98  	// Allow GOARCH=thestring or GOARCH=thestringsuffix,
    99  	// but not other values.	
   100  	p = getgoarch();
   101  	if(strncmp(p, thestring, strlen(thestring)) != 0)
   102  		sysfatal("cannot use %cc with GOARCH=%s", thechar, p);
   103  
   104  	ensuresymb(NSYMB);
   105  	memset(debug, 0, sizeof(debug));
   106  	cinit();
   107  	outfile = 0;
   108  	setinclude(".");
   109  	
   110  	flagfn1("D", "name[=value]: add #define", dodef);
   111  	flagfn1("I", "dir: add dir to include path", setinclude);
   112  	flagcount("S", "print assembly and machine code", &debug['S']);
   113  	flagcount("m", "debug preprocessor macros", &debug['m']);
   114  	flagstr("o", "file: set output file", &outfile);
   115  	flagstr("trimpath", "prefix: remove prefix from recorded source file paths", &ctxt->trimpath);
   116  
   117  	flagparse(&argc, &argv, usage);
   118  	ctxt->debugasm = debug['S'];
   119  
   120  	if(argc < 1)
   121  		usage();
   122  	if(argc > 1){
   123  		print("can't assemble multiple files\n");
   124  		errorexit();
   125  	}
   126  
   127  	if(assemble(argv[0]))
   128  		errorexit();
   129  	Bflush(&bstdout);
   130  	if(nerrors > 0)
   131  		errorexit();
   132  	exits(0);
   133  }
   134  
   135  int
   136  assemble(char *file)
   137  {
   138  	char *ofile, *p;
   139  	int i, of;
   140  
   141  	ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
   142  	strcpy(ofile, file);
   143  	p = utfrrune(ofile, pathchar());
   144  	if(p) {
   145  		include[0] = ofile;
   146  		*p++ = 0;
   147  	} else
   148  		p = ofile;
   149  	if(outfile == 0) {
   150  		outfile = p;
   151  		if(outfile){
   152  			p = utfrrune(outfile, '.');
   153  			if(p)
   154  				if(p[1] == 's' && p[2] == 0)
   155  					p[0] = 0;
   156  			p = utfrune(outfile, 0);
   157  			p[0] = '.';
   158  			p[1] = thechar;
   159  			p[2] = 0;
   160  		} else
   161  			outfile = "/dev/null";
   162  	}
   163  
   164  	of = create(outfile, OWRITE, 0664);
   165  	if(of < 0) {
   166  		yyerror("%ca: cannot create %s", thechar, outfile);
   167  		errorexit();
   168  	}
   169  	Binit(&obuf, of, OWRITE);
   170  	Bprint(&obuf, "go object %s %s %s\n", getgoos(), getgoarch(), getgoversion());
   171  	Bprint(&obuf, "!\n");
   172  
   173  	for(pass = 1; pass <= 2; pass++) {
   174  		pinit(file);
   175  		for(i=0; i<nDlist; i++)
   176  			dodefine(Dlist[i]);
   177  		yyparse();
   178  		cclean();
   179  		if(nerrors)
   180  			return nerrors;
   181  	}
   182  
   183  	writeobj(ctxt, &obuf);
   184  	Bflush(&obuf);
   185  	return 0;
   186  }
   187  
   188  struct
   189  {
   190  	char	*name;
   191  	ushort	type;
   192  	ushort	value;
   193  } itab[] =
   194  {
   195  	"SP",		LSP,	D_AUTO,
   196  	"SB",		LSB,	D_EXTERN,
   197  	"FP",		LFP,	D_PARAM,
   198  	"PC",		LPC,	D_BRANCH,
   199  
   200  	"AL",		LBREG,	D_AL,
   201  	"CL",		LBREG,	D_CL,
   202  	"DL",		LBREG,	D_DL,
   203  	"BL",		LBREG,	D_BL,
   204  	"AH",		LBREG,	D_AH,
   205  	"CH",		LBREG,	D_CH,
   206  	"DH",		LBREG,	D_DH,
   207  	"BH",		LBREG,	D_BH,
   208  
   209  	"AX",		LLREG,	D_AX,
   210  	"CX",		LLREG,	D_CX,
   211  	"DX",		LLREG,	D_DX,
   212  	"BX",		LLREG,	D_BX,
   213  /*	"SP",		LLREG,	D_SP,	*/
   214  	"BP",		LLREG,	D_BP,
   215  	"SI",		LLREG,	D_SI,
   216  	"DI",		LLREG,	D_DI,
   217  
   218  	"F0",		LFREG,	D_F0+0,
   219  	"F1",		LFREG,	D_F0+1,
   220  	"F2",		LFREG,	D_F0+2,
   221  	"F3",		LFREG,	D_F0+3,
   222  	"F4",		LFREG,	D_F0+4,
   223  	"F5",		LFREG,	D_F0+5,
   224  	"F6",		LFREG,	D_F0+6,
   225  	"F7",		LFREG,	D_F0+7,
   226  
   227  	"X0",		LXREG,	D_X0+0,
   228  	"X1",		LXREG,	D_X0+1,
   229  	"X2",		LXREG,	D_X0+2,
   230  	"X3",		LXREG,	D_X0+3,
   231  	"X4",		LXREG,	D_X0+4,
   232  	"X5",		LXREG,	D_X0+5,
   233  	"X6",		LXREG,	D_X0+6,
   234  	"X7",		LXREG,	D_X0+7,
   235  
   236  	"CS",		LSREG,	D_CS,
   237  	"SS",		LSREG,	D_SS,
   238  	"DS",		LSREG,	D_DS,
   239  	"ES",		LSREG,	D_ES,
   240  	"FS",		LSREG,	D_FS,
   241  	"GS",		LSREG,	D_GS,
   242  	"TLS",		LSREG,	D_TLS,
   243  
   244  	"GDTR",		LBREG,	D_GDTR,
   245  	"IDTR",		LBREG,	D_IDTR,
   246  	"LDTR",		LBREG,	D_LDTR,
   247  	"MSW",		LBREG,	D_MSW,
   248  	"TASK",		LBREG,	D_TASK,
   249  
   250  	"CR0",		LBREG,	D_CR+0,
   251  	"CR1",		LBREG,	D_CR+1,
   252  	"CR2",		LBREG,	D_CR+2,
   253  	"CR3",		LBREG,	D_CR+3,
   254  	"CR4",		LBREG,	D_CR+4,
   255  	"CR5",		LBREG,	D_CR+5,
   256  	"CR6",		LBREG,	D_CR+6,
   257  	"CR7",		LBREG,	D_CR+7,
   258  
   259  	"DR0",		LBREG,	D_DR+0,
   260  	"DR1",		LBREG,	D_DR+1,
   261  	"DR2",		LBREG,	D_DR+2,
   262  	"DR3",		LBREG,	D_DR+3,
   263  	"DR4",		LBREG,	D_DR+4,
   264  	"DR5",		LBREG,	D_DR+5,
   265  	"DR6",		LBREG,	D_DR+6,
   266  	"DR7",		LBREG,	D_DR+7,
   267  
   268  	"TR0",		LBREG,	D_TR+0,
   269  	"TR1",		LBREG,	D_TR+1,
   270  	"TR2",		LBREG,	D_TR+2,
   271  	"TR3",		LBREG,	D_TR+3,
   272  	"TR4",		LBREG,	D_TR+4,
   273  	"TR5",		LBREG,	D_TR+5,
   274  	"TR6",		LBREG,	D_TR+6,
   275  	"TR7",		LBREG,	D_TR+7,
   276  
   277  	"AAA",		LTYPE0,	AAAA,
   278  	"AAD",		LTYPE0,	AAAD,
   279  	"AAM",		LTYPE0,	AAAM,
   280  	"AAS",		LTYPE0,	AAAS,
   281  	"ADCB",		LTYPE3,	AADCB,
   282  	"ADCL",		LTYPE3,	AADCL,
   283  	"ADCW",		LTYPE3,	AADCW,
   284  	"ADDB",		LTYPE3,	AADDB,
   285  	"ADDL",		LTYPE3,	AADDL,
   286  	"ADDW",		LTYPE3,	AADDW,
   287  	"ADJSP",	LTYPE2,	AADJSP,
   288  	"ANDB",		LTYPE3,	AANDB,
   289  	"ANDL",		LTYPE3,	AANDL,
   290  	"ANDW",		LTYPE3,	AANDW,
   291  	"ARPL",		LTYPE3,	AARPL,
   292  	"BOUNDL",	LTYPE3,	ABOUNDL,
   293  	"BOUNDW",	LTYPE3,	ABOUNDW,
   294  	"BSFL",		LTYPE3,	ABSFL,
   295  	"BSFW",		LTYPE3,	ABSFW,
   296  	"BSRL",		LTYPE3,	ABSRL,
   297  	"BSRW",		LTYPE3,	ABSRW,
   298  	"BSWAPL",	LTYPE1,	ABSWAPL,
   299  	"BTCL",		LTYPE3,	ABTCL,
   300  	"BTCW",		LTYPE3,	ABTCW,
   301  	"BTL",		LTYPE3,	ABTL,
   302  	"BTRL",		LTYPE3,	ABTRL,
   303  	"BTRW",		LTYPE3,	ABTRW,
   304  	"BTSL",		LTYPE3,	ABTSL,
   305  	"BTSW",		LTYPE3,	ABTSW,
   306  	"BTW",		LTYPE3,	ABTW,
   307  	"BYTE",		LTYPE2,	ABYTE,
   308  	"CALL",		LTYPEC,	ACALL,
   309  	"CLC",		LTYPE0,	ACLC,
   310  	"CLD",		LTYPE0,	ACLD,
   311  	"CLI",		LTYPE0,	ACLI,
   312  	"CLTS",		LTYPE0,	ACLTS,
   313  	"CMC",		LTYPE0,	ACMC,
   314  	"CMPB",		LTYPE4,	ACMPB,
   315  	"CMPL",		LTYPE4,	ACMPL,
   316  	"CMPW",		LTYPE4,	ACMPW,
   317  	"CMPSB",	LTYPE0,	ACMPSB,
   318  	"CMPSL",	LTYPE0,	ACMPSL,
   319  	"CMPSW",	LTYPE0,	ACMPSW,
   320  	"CMPXCHG8B",	LTYPE1,	ACMPXCHG8B,
   321  	"CMPXCHGB",	LTYPE3,	ACMPXCHGB,
   322  	"CMPXCHGL",	LTYPE3,	ACMPXCHGL,
   323  	"CMPXCHGW",	LTYPE3,	ACMPXCHGW,
   324  	"CPUID",	LTYPE0,	ACPUID,
   325  	"DAA",		LTYPE0,	ADAA,
   326  	"DAS",		LTYPE0,	ADAS,
   327  	"DATA",		LTYPED,	ADATA,
   328  	"DECB",		LTYPE1,	ADECB,
   329  	"DECL",		LTYPE1,	ADECL,
   330  	"DECW",		LTYPE1,	ADECW,
   331  	"DIVB",		LTYPE2,	ADIVB,
   332  	"DIVL",		LTYPE2,	ADIVL,
   333  	"DIVW",		LTYPE2,	ADIVW,
   334  	"END",		LTYPE0,	AEND,
   335  	"ENTER",	LTYPE2,	AENTER,
   336  	"GLOBL",	LTYPEG,	AGLOBL,
   337  	"HLT",		LTYPE0,	AHLT,
   338  	"IDIVB",	LTYPE2,	AIDIVB,
   339  	"IDIVL",	LTYPE2,	AIDIVL,
   340  	"IDIVW",	LTYPE2,	AIDIVW,
   341  	"IMULB",	LTYPE2,	AIMULB,
   342  	"IMULL",	LTYPEI,	AIMULL,
   343  	"IMULW",	LTYPEI,	AIMULW,
   344  	"INB",		LTYPE0,	AINB,
   345  	"INL",		LTYPE0,	AINL,
   346  	"INW",		LTYPE0,	AINW,
   347  	"INCB",		LTYPE1,	AINCB,
   348  	"INCL",		LTYPE1,	AINCL,
   349  	"INCW",		LTYPE1,	AINCW,
   350  	"INSB",		LTYPE0,	AINSB,
   351  	"INSL",		LTYPE0,	AINSL,
   352  	"INSW",		LTYPE0,	AINSW,
   353  	"INT",		LTYPE2,	AINT,
   354  	"INTO",		LTYPE0,	AINTO,
   355  	"IRETL",	LTYPE0,	AIRETL,
   356  	"IRETW",	LTYPE0,	AIRETW,
   357  
   358  	"JOS",		LTYPER,	AJOS,	/* overflow set (OF = 1) */
   359  	"JO",		LTYPER,	AJOS,	/* alternate */
   360  	"JOC",		LTYPER,	AJOC,	/* overflow clear (OF = 0) */
   361  	"JNO",		LTYPER,	AJOC,	/* alternate */
   362  	"JCS",		LTYPER,	AJCS,	/* carry set (CF = 1) */
   363  	"JB",		LTYPER,	AJCS,	/* alternate */
   364  	"JC",		LTYPER,	AJCS,	/* alternate */
   365  	"JNAE",		LTYPER,	AJCS,	/* alternate */
   366  	"JLO",		LTYPER,	AJCS,	/* alternate */
   367  	"JCC",		LTYPER,	AJCC,	/* carry clear (CF = 0) */
   368  	"JAE",		LTYPER,	AJCC,	/* alternate */
   369  	"JNB",		LTYPER,	AJCC,	/* alternate */
   370  	"JNC",		LTYPER,	AJCC,	/* alternate */
   371  	"JHS",		LTYPER,	AJCC,	/* alternate */
   372  	"JEQ",		LTYPER,	AJEQ,	/* equal (ZF = 1) */
   373  	"JE",		LTYPER,	AJEQ,	/* alternate */
   374  	"JZ",		LTYPER,	AJEQ,	/* alternate */
   375  	"JNE",		LTYPER,	AJNE,	/* not equal (ZF = 0) */
   376  	"JNZ",		LTYPER,	AJNE,	/* alternate */
   377  	"JLS",		LTYPER,	AJLS,	/* lower or same (unsigned) (CF = 1 || ZF = 1) */
   378  	"JBE",		LTYPER,	AJLS,	/* alternate */
   379  	"JNA",		LTYPER,	AJLS,	/* alternate */
   380  	"JHI",		LTYPER,	AJHI,	/* higher (unsigned) (CF = 0 && ZF = 0) */
   381  	"JA",		LTYPER,	AJHI,	/* alternate */
   382  	"JNBE",		LTYPER,	AJHI,	/* alternate */
   383  	"JMI",		LTYPER,	AJMI,	/* negative (minus) (SF = 1) */
   384  	"JS",		LTYPER,	AJMI,	/* alternate */
   385  	"JPL",		LTYPER,	AJPL,	/* non-negative (plus) (SF = 0) */
   386  	"JNS",		LTYPER,	AJPL,	/* alternate */
   387  	"JPS",		LTYPER,	AJPS,	/* parity set (PF = 1) */
   388  	"JP",		LTYPER,	AJPS,	/* alternate */
   389  	"JPE",		LTYPER,	AJPS,	/* alternate */
   390  	"JPC",		LTYPER,	AJPC,	/* parity clear (PF = 0) */
   391  	"JNP",		LTYPER,	AJPC,	/* alternate */
   392  	"JPO",		LTYPER,	AJPC,	/* alternate */
   393  	"JLT",		LTYPER,	AJLT,	/* less than (signed) (SF != OF) */
   394  	"JL",		LTYPER,	AJLT,	/* alternate */
   395  	"JNGE",		LTYPER,	AJLT,	/* alternate */
   396  	"JGE",		LTYPER,	AJGE,	/* greater than or equal (signed) (SF = OF) */
   397  	"JNL",		LTYPER,	AJGE,	/* alternate */
   398  	"JLE",		LTYPER,	AJLE,	/* less than or equal (signed) (ZF = 1 || SF != OF) */
   399  	"JNG",		LTYPER,	AJLE,	/* alternate */
   400  	"JGT",		LTYPER,	AJGT,	/* greater than (signed) (ZF = 0 && SF = OF) */
   401  	"JG",		LTYPER,	AJGT,	/* alternate */
   402  	"JNLE",		LTYPER,	AJGT,	/* alternate */
   403  
   404  	"JCXZL",	LTYPER,	AJCXZL,
   405  	"JCXZW",	LTYPER,	AJCXZW,
   406  	"JMP",		LTYPEC,	AJMP,
   407  	"LAHF",		LTYPE0,	ALAHF,
   408  	"LARL",		LTYPE3,	ALARL,
   409  	"LARW",		LTYPE3,	ALARW,
   410  	"LEAL",		LTYPE3,	ALEAL,
   411  	"LEAW",		LTYPE3,	ALEAW,
   412  	"LEAVEL",	LTYPE0,	ALEAVEL,
   413  	"LEAVEW",	LTYPE0,	ALEAVEW,
   414  	"LOCK",		LTYPE0,	ALOCK,
   415  	"LODSB",	LTYPE0,	ALODSB,
   416  	"LODSL",	LTYPE0,	ALODSL,
   417  	"LODSW",	LTYPE0,	ALODSW,
   418  	"LONG",		LTYPE2,	ALONG,
   419  	"LOOP",		LTYPER,	ALOOP,
   420  	"LOOPEQ",	LTYPER,	ALOOPEQ,
   421  	"LOOPNE",	LTYPER,	ALOOPNE,
   422  	"LSLL",		LTYPE3,	ALSLL,
   423  	"LSLW",		LTYPE3,	ALSLW,
   424  	"MOVB",		LTYPE3,	AMOVB,
   425  	"MOVL",		LTYPEM,	AMOVL,
   426  	"MOVW",		LTYPEM,	AMOVW,
   427  	"MOVQ",		LTYPEM, AMOVQ,
   428  	"MOVBLSX",	LTYPE3, AMOVBLSX,
   429  	"MOVBLZX",	LTYPE3, AMOVBLZX,
   430  	"MOVBWSX",	LTYPE3, AMOVBWSX,
   431  	"MOVBWZX",	LTYPE3, AMOVBWZX,
   432  	"MOVWLSX",	LTYPE3, AMOVWLSX,
   433  	"MOVWLZX",	LTYPE3, AMOVWLZX,
   434  	"MOVSB",	LTYPE0,	AMOVSB,
   435  	"MOVSL",	LTYPE0,	AMOVSL,
   436  	"MOVSW",	LTYPE0,	AMOVSW,
   437  	"MULB",		LTYPE2,	AMULB,
   438  	"MULL",		LTYPE2,	AMULL,
   439  	"MULW",		LTYPE2,	AMULW,
   440  	"NEGB",		LTYPE1,	ANEGB,
   441  	"NEGL",		LTYPE1,	ANEGL,
   442  	"NEGW",		LTYPE1,	ANEGW,
   443  	"NOP",		LTYPEN,	ANOP,
   444  	"NOTB",		LTYPE1,	ANOTB,
   445  	"NOTL",		LTYPE1,	ANOTL,
   446  	"NOTW",		LTYPE1,	ANOTW,
   447  	"ORB",		LTYPE3,	AORB,
   448  	"ORL",		LTYPE3,	AORL,
   449  	"ORW",		LTYPE3,	AORW,
   450  	"OUTB",		LTYPE0,	AOUTB,
   451  	"OUTL",		LTYPE0,	AOUTL,
   452  	"OUTW",		LTYPE0,	AOUTW,
   453  	"OUTSB",	LTYPE0,	AOUTSB,
   454  	"OUTSL",	LTYPE0,	AOUTSL,
   455  	"OUTSW",	LTYPE0,	AOUTSW,
   456  	"PAUSE",	LTYPEN,	APAUSE,
   457  	"PINSRD",	LTYPEX,	APINSRD,
   458  	"POPAL",	LTYPE0,	APOPAL,
   459  	"POPAW",	LTYPE0,	APOPAW,
   460  	"POPFL",	LTYPE0,	APOPFL,
   461  	"POPFW",	LTYPE0,	APOPFW,
   462  	"POPL",		LTYPE1,	APOPL,
   463  	"POPW",		LTYPE1,	APOPW,
   464  	"PUSHAL",	LTYPE0,	APUSHAL,
   465  	"PUSHAW",	LTYPE0,	APUSHAW,
   466  	"PUSHFL",	LTYPE0,	APUSHFL,
   467  	"PUSHFW",	LTYPE0,	APUSHFW,
   468  	"PUSHL",	LTYPE2,	APUSHL,
   469  	"PUSHW",	LTYPE2,	APUSHW,
   470  	"RCLB",		LTYPE3,	ARCLB,
   471  	"RCLL",		LTYPE3,	ARCLL,
   472  	"RCLW",		LTYPE3,	ARCLW,
   473  	"RCRB",		LTYPE3,	ARCRB,
   474  	"RCRL",		LTYPE3,	ARCRL,
   475  	"RCRW",		LTYPE3,	ARCRW,
   476  	"RDTSC",	LTYPE0,	ARDTSC,
   477  	"REP",		LTYPE0,	AREP,
   478  	"REPN",		LTYPE0,	AREPN,
   479  	"RET",		LTYPE0,	ARET,
   480  	"ROLB",		LTYPE3,	AROLB,
   481  	"ROLL",		LTYPE3,	AROLL,
   482  	"ROLW",		LTYPE3,	AROLW,
   483  	"RORB",		LTYPE3,	ARORB,
   484  	"RORL",		LTYPE3,	ARORL,
   485  	"RORW",		LTYPE3,	ARORW,
   486  	"SAHF",		LTYPE0,	ASAHF,
   487  	"SALB",		LTYPE3,	ASALB,
   488  	"SALL",		LTYPE3,	ASALL,
   489  	"SALW",		LTYPE3,	ASALW,
   490  	"SARB",		LTYPE3,	ASARB,
   491  	"SARL",		LTYPE3,	ASARL,
   492  	"SARW",		LTYPE3,	ASARW,
   493  	"SBBB",		LTYPE3,	ASBBB,
   494  	"SBBL",		LTYPE3,	ASBBL,
   495  	"SBBW",		LTYPE3,	ASBBW,
   496  	"SCASB",	LTYPE0,	ASCASB,
   497  	"SCASL",	LTYPE0,	ASCASL,
   498  	"SCASW",	LTYPE0,	ASCASW,
   499  	"SETCC",	LTYPE1,	ASETCC,	/* see JCC etc above for condition codes */
   500  	"SETCS",	LTYPE1,	ASETCS,
   501  	"SETEQ",	LTYPE1,	ASETEQ,
   502  	"SETGE",	LTYPE1,	ASETGE,
   503  	"SETGT",	LTYPE1,	ASETGT,
   504  	"SETHI",	LTYPE1,	ASETHI,
   505  	"SETLE",	LTYPE1,	ASETLE,
   506  	"SETLS",	LTYPE1,	ASETLS,
   507  	"SETLT",	LTYPE1,	ASETLT,
   508  	"SETMI",	LTYPE1,	ASETMI,
   509  	"SETNE",	LTYPE1,	ASETNE,
   510  	"SETOC",	LTYPE1,	ASETOC,
   511  	"SETOS",	LTYPE1,	ASETOS,
   512  	"SETPC",	LTYPE1,	ASETPC,
   513  	"SETPL",	LTYPE1,	ASETPL,
   514  	"SETPS",	LTYPE1,	ASETPS,
   515  	"CDQ",		LTYPE0,	ACDQ,
   516  	"CWD",		LTYPE0,	ACWD,
   517  	"SHLB",		LTYPE3,	ASHLB,
   518  	"SHLL",		LTYPES,	ASHLL,
   519  	"SHLW",		LTYPES,	ASHLW,
   520  	"SHRB",		LTYPE3,	ASHRB,
   521  	"SHRL",		LTYPES,	ASHRL,
   522  	"SHRW",		LTYPES,	ASHRW,
   523  	"STC",		LTYPE0,	ASTC,
   524  	"STD",		LTYPE0,	ASTD,
   525  	"STI",		LTYPE0,	ASTI,
   526  	"STOSB",	LTYPE0,	ASTOSB,
   527  	"STOSL",	LTYPE0,	ASTOSL,
   528  	"STOSW",	LTYPE0,	ASTOSW,
   529  	"SUBB",		LTYPE3,	ASUBB,
   530  	"SUBL",		LTYPE3,	ASUBL,
   531  	"SUBW",		LTYPE3,	ASUBW,
   532  	"SYSCALL",	LTYPE0,	ASYSCALL,
   533  	"TESTB",	LTYPE3,	ATESTB,
   534  	"TESTL",	LTYPE3,	ATESTL,
   535  	"TESTW",	LTYPE3,	ATESTW,
   536  	"TEXT",		LTYPET,	ATEXT,
   537  	"VERR",		LTYPE2,	AVERR,
   538  	"VERW",		LTYPE2,	AVERW,
   539  	"WAIT",		LTYPE0,	AWAIT,
   540  	"WORD",		LTYPE2,	AWORD,
   541  	"XADDB",	LTYPE3,	AXADDB,
   542  	"XADDL",	LTYPE3,	AXADDL,
   543  	"XADDW",	LTYPE3,	AXADDW,
   544  	"XCHGB",	LTYPE3,	AXCHGB,
   545  	"XCHGL",	LTYPE3,	AXCHGL,
   546  	"XCHGW",	LTYPE3,	AXCHGW,
   547  	"XLAT",		LTYPE2,	AXLAT,
   548  	"XORB",		LTYPE3,	AXORB,
   549  	"XORL",		LTYPE3,	AXORL,
   550  	"XORW",		LTYPE3,	AXORW,
   551  
   552  	"CMOVLCC",	LTYPE3,	ACMOVLCC,
   553  	"CMOVLCS",	LTYPE3,	ACMOVLCS,
   554  	"CMOVLEQ",	LTYPE3,	ACMOVLEQ,
   555  	"CMOVLGE",	LTYPE3,	ACMOVLGE,
   556  	"CMOVLGT",	LTYPE3,	ACMOVLGT,
   557  	"CMOVLHI",	LTYPE3,	ACMOVLHI,
   558  	"CMOVLLE",	LTYPE3,	ACMOVLLE,
   559  	"CMOVLLS",	LTYPE3,	ACMOVLLS,
   560  	"CMOVLLT",	LTYPE3,	ACMOVLLT,
   561  	"CMOVLMI",	LTYPE3,	ACMOVLMI,
   562  	"CMOVLNE",	LTYPE3,	ACMOVLNE,
   563  	"CMOVLOC",	LTYPE3,	ACMOVLOC,
   564  	"CMOVLOS",	LTYPE3,	ACMOVLOS,
   565  	"CMOVLPC",	LTYPE3,	ACMOVLPC,
   566  	"CMOVLPL",	LTYPE3,	ACMOVLPL,
   567  	"CMOVLPS",	LTYPE3,	ACMOVLPS,
   568  	"CMOVWCC",	LTYPE3,	ACMOVWCC,
   569  	"CMOVWCS",	LTYPE3,	ACMOVWCS,
   570  	"CMOVWEQ",	LTYPE3,	ACMOVWEQ,
   571  	"CMOVWGE",	LTYPE3,	ACMOVWGE,
   572  	"CMOVWGT",	LTYPE3,	ACMOVWGT,
   573  	"CMOVWHI",	LTYPE3,	ACMOVWHI,
   574  	"CMOVWLE",	LTYPE3,	ACMOVWLE,
   575  	"CMOVWLS",	LTYPE3,	ACMOVWLS,
   576  	"CMOVWLT",	LTYPE3,	ACMOVWLT,
   577  	"CMOVWMI",	LTYPE3,	ACMOVWMI,
   578  	"CMOVWNE",	LTYPE3,	ACMOVWNE,
   579  	"CMOVWOC",	LTYPE3,	ACMOVWOC,
   580  	"CMOVWOS",	LTYPE3,	ACMOVWOS,
   581  	"CMOVWPC",	LTYPE3,	ACMOVWPC,
   582  	"CMOVWPL",	LTYPE3,	ACMOVWPL,
   583  	"CMOVWPS",	LTYPE3,	ACMOVWPS,
   584  
   585  	"FMOVB",	LTYPE3, AFMOVB,
   586  	"FMOVBP",	LTYPE3, AFMOVBP,
   587  	"FMOVD",	LTYPE3, AFMOVD,
   588  	"FMOVDP",	LTYPE3, AFMOVDP,
   589  	"FMOVF",	LTYPE3, AFMOVF,
   590  	"FMOVFP",	LTYPE3, AFMOVFP,
   591  	"FMOVL",	LTYPE3, AFMOVL,
   592  	"FMOVLP",	LTYPE3, AFMOVLP,
   593  	"FMOVV",	LTYPE3, AFMOVV,
   594  	"FMOVVP",	LTYPE3, AFMOVVP,
   595  	"FMOVW",	LTYPE3, AFMOVW,
   596  	"FMOVWP",	LTYPE3, AFMOVWP,
   597  	"FMOVX",	LTYPE3, AFMOVX,
   598  	"FMOVXP",	LTYPE3, AFMOVXP,
   599  	"FCMOVCC",	LTYPE3, AFCMOVCC,
   600  	"FCMOVCS",	LTYPE3, AFCMOVCS,
   601  	"FCMOVEQ",	LTYPE3, AFCMOVEQ,
   602  	"FCMOVHI",	LTYPE3, AFCMOVHI,
   603  	"FCMOVLS",	LTYPE3, AFCMOVLS,
   604  	"FCMOVNE",	LTYPE3, AFCMOVNE,
   605  	"FCMOVNU",	LTYPE3, AFCMOVNU,
   606  	"FCMOVUN",	LTYPE3, AFCMOVUN,
   607  	"FCOMB",	LTYPE3, AFCOMB,
   608  	"FCOMBP",	LTYPE3, AFCOMBP,
   609  	"FCOMD",	LTYPE3, AFCOMD,
   610  	"FCOMDP",	LTYPE3, AFCOMDP,
   611  	"FCOMDPP",	LTYPE3, AFCOMDPP,
   612  	"FCOMF",	LTYPE3, AFCOMF,
   613  	"FCOMFP",	LTYPE3, AFCOMFP,
   614  	"FCOMI",	LTYPE3, AFCOMI,
   615  	"FCOMIP",	LTYPE3, AFCOMIP,
   616  	"FCOML",	LTYPE3, AFCOML,
   617  	"FCOMLP",	LTYPE3, AFCOMLP,
   618  	"FCOMW",	LTYPE3, AFCOMW,
   619  	"FCOMWP",	LTYPE3, AFCOMWP,
   620  	"FUCOM",	LTYPE3, AFUCOM,
   621  	"FUCOMI",	LTYPE3, AFUCOMI,
   622  	"FUCOMIP",	LTYPE3, AFUCOMIP,
   623  	"FUCOMP",	LTYPE3, AFUCOMP,
   624  	"FUCOMPP",	LTYPE3, AFUCOMPP,
   625  	"FADDW",	LTYPE3, AFADDW,
   626  	"FADDL",	LTYPE3, AFADDL,
   627  	"FADDF",	LTYPE3, AFADDF,
   628  	"FADDD",	LTYPE3, AFADDD,
   629  	"FADDDP",	LTYPE3, AFADDDP,
   630  	"FSUBDP",	LTYPE3, AFSUBDP,
   631  	"FSUBW",	LTYPE3, AFSUBW,
   632  	"FSUBL",	LTYPE3, AFSUBL,
   633  	"FSUBF",	LTYPE3, AFSUBF,
   634  	"FSUBD",	LTYPE3, AFSUBD,
   635  	"FSUBRDP",	LTYPE3, AFSUBRDP,
   636  	"FSUBRW",	LTYPE3, AFSUBRW,
   637  	"FSUBRL",	LTYPE3, AFSUBRL,
   638  	"FSUBRF",	LTYPE3, AFSUBRF,
   639  	"FSUBRD",	LTYPE3, AFSUBRD,
   640  	"FMULDP",	LTYPE3, AFMULDP,
   641  	"FMULW",	LTYPE3, AFMULW,
   642  	"FMULL",	LTYPE3, AFMULL,
   643  	"FMULF",	LTYPE3, AFMULF,
   644  	"FMULD",	LTYPE3, AFMULD,
   645  	"FDIVDP",	LTYPE3, AFDIVDP,
   646  	"FDIVW",	LTYPE3, AFDIVW,
   647  	"FDIVL",	LTYPE3, AFDIVL,
   648  	"FDIVF",	LTYPE3, AFDIVF,
   649  	"FDIVD",	LTYPE3, AFDIVD,
   650  	"FDIVRDP",	LTYPE3, AFDIVRDP,
   651  	"FDIVRW",	LTYPE3, AFDIVRW,
   652  	"FDIVRL",	LTYPE3, AFDIVRL,
   653  	"FDIVRF",	LTYPE3, AFDIVRF,
   654  	"FDIVRD",	LTYPE3, AFDIVRD,
   655  	"FXCHD",	LTYPE3, AFXCHD,
   656  	"FFREE",	LTYPE1, AFFREE,
   657  	"FLDCW",	LTYPE2, AFLDCW,
   658  	"FLDENV",	LTYPE1, AFLDENV,
   659  	"FRSTOR",	LTYPE2, AFRSTOR,
   660  	"FSAVE",	LTYPE1, AFSAVE,
   661  	"FSTCW",	LTYPE1, AFSTCW,
   662  	"FSTENV",	LTYPE1, AFSTENV,
   663  	"FSTSW",	LTYPE1, AFSTSW,
   664  	"F2XM1",	LTYPE0, AF2XM1,
   665  	"FABS",		LTYPE0, AFABS,
   666  	"FCHS",		LTYPE0, AFCHS,
   667  	"FCLEX",	LTYPE0, AFCLEX,
   668  	"FCOS",		LTYPE0, AFCOS,
   669  	"FDECSTP",	LTYPE0, AFDECSTP,
   670  	"FINCSTP",	LTYPE0, AFINCSTP,
   671  	"FINIT",	LTYPE0, AFINIT,
   672  	"FLD1",		LTYPE0, AFLD1,
   673  	"FLDL2E",	LTYPE0, AFLDL2E,
   674  	"FLDL2T",	LTYPE0, AFLDL2T,
   675  	"FLDLG2",	LTYPE0, AFLDLG2,
   676  	"FLDLN2",	LTYPE0, AFLDLN2,
   677  	"FLDPI",	LTYPE0, AFLDPI,
   678  	"FLDZ",		LTYPE0, AFLDZ,
   679  	"FNOP",		LTYPE0, AFNOP,
   680  	"FPATAN",	LTYPE0, AFPATAN,
   681  	"FPREM",	LTYPE0, AFPREM,
   682  	"FPREM1",	LTYPE0, AFPREM1,
   683  	"FPTAN",	LTYPE0, AFPTAN,
   684  	"FRNDINT",	LTYPE0, AFRNDINT,
   685  	"FSCALE",	LTYPE0, AFSCALE,
   686  	"FSIN",		LTYPE0, AFSIN,
   687  	"FSINCOS",	LTYPE0, AFSINCOS,
   688  	"FSQRT",	LTYPE0, AFSQRT,
   689  	"FTST",		LTYPE0, AFTST,
   690  	"FXAM",		LTYPE0, AFXAM,
   691  	"FXTRACT",	LTYPE0, AFXTRACT,
   692  	"FYL2X",	LTYPE0, AFYL2X,
   693  	"FYL2XP1",	LTYPE0, AFYL2XP1,
   694  	"LFENCE",	LTYPE0, ALFENCE,
   695  	"MFENCE",	LTYPE0, AMFENCE,
   696  	"SFENCE",	LTYPE0, ASFENCE,
   697  	"EMMS",		LTYPE0, AEMMS,
   698  	"PREFETCHT0",		LTYPE2,	APREFETCHT0,
   699  	"PREFETCHT1",		LTYPE2,	APREFETCHT1,
   700  	"PREFETCHT2",		LTYPE2,	APREFETCHT2,
   701  	"PREFETCHNTA",		LTYPE2,	APREFETCHNTA,
   702  	"UNDEF",	LTYPE0,	AUNDEF,
   703  
   704  	"ADDPD",	LTYPE3,	AADDPD,
   705  	"ADDPS",	LTYPE3,	AADDPS,
   706  	"ADDSD",	LTYPE3,	AADDSD,
   707  	"ADDSS",	LTYPE3,	AADDSS,
   708  	"AESENC",	LTYPE3,	AAESENC,
   709  	"ANDNPD",	LTYPE3,	AANDNPD,
   710  	"ANDNPS",	LTYPE3,	AANDNPS,
   711  	"ANDPD",	LTYPE3,	AANDPD,
   712  	"ANDPS",	LTYPE3,	AANDPS,
   713  	"CMPPD",	LTYPEXC,ACMPPD,
   714  	"CMPPS",	LTYPEXC,ACMPPS,
   715  	"CMPSD",	LTYPEXC,ACMPSD,
   716  	"CMPSS",	LTYPEXC,ACMPSS,
   717  	"COMISD",	LTYPE3,	ACOMISD,
   718  	"COMISS",	LTYPE3,	ACOMISS,
   719  	"CVTPL2PD",	LTYPE3,	ACVTPL2PD,
   720  	"CVTPL2PS",	LTYPE3,	ACVTPL2PS,
   721  	"CVTPD2PL",	LTYPE3,	ACVTPD2PL,
   722  	"CVTPD2PS",	LTYPE3,	ACVTPD2PS,
   723  	"CVTPS2PL",	LTYPE3,	ACVTPS2PL,
   724  	"CVTPS2PD",	LTYPE3,	ACVTPS2PD,
   725  	"CVTSD2SL",	LTYPE3,	ACVTSD2SL,
   726  	"CVTSD2SS",	LTYPE3,	ACVTSD2SS,
   727  	"CVTSL2SD",	LTYPE3,	ACVTSL2SD,
   728  	"CVTSL2SS",	LTYPE3,	ACVTSL2SS,
   729  	"CVTSS2SD",	LTYPE3,	ACVTSS2SD,
   730  	"CVTSS2SL",	LTYPE3,	ACVTSS2SL,
   731  	"CVTTPD2PL",	LTYPE3,	ACVTTPD2PL,
   732  	"CVTTPS2PL",	LTYPE3,	ACVTTPS2PL,
   733  	"CVTTSD2SL",	LTYPE3,	ACVTTSD2SL,
   734  	"CVTTSS2SL",	LTYPE3,	ACVTTSS2SL,
   735  	"DIVPD",	LTYPE3,	ADIVPD,
   736  	"DIVPS",	LTYPE3,	ADIVPS,
   737  	"DIVSD",	LTYPE3,	ADIVSD,
   738  	"DIVSS",	LTYPE3,	ADIVSS,
   739  	"MASKMOVOU",	LTYPE3,	AMASKMOVOU,
   740  	"MASKMOVDQU",	LTYPE3,	AMASKMOVOU,	/* syn */
   741  	"MAXPD",	LTYPE3,	AMAXPD,
   742  	"MAXPS",	LTYPE3,	AMAXPS,
   743  	"MAXSD",	LTYPE3,	AMAXSD,
   744  	"MAXSS",	LTYPE3,	AMAXSS,
   745  	"MINPD",	LTYPE3,	AMINPD,
   746  	"MINPS",	LTYPE3,	AMINPS,
   747  	"MINSD",	LTYPE3,	AMINSD,
   748  	"MINSS",	LTYPE3,	AMINSS,
   749  	"MOVAPD",	LTYPE3,	AMOVAPD,
   750  	"MOVAPS",	LTYPE3,	AMOVAPS,
   751  	"MOVO",		LTYPE3,	AMOVO,
   752  	"MOVOA",	LTYPE3,	AMOVO,	/* syn */
   753  	"MOVOU",	LTYPE3,	AMOVOU,
   754  	"MOVHLPS",	LTYPE3,	AMOVHLPS,
   755  	"MOVHPD",	LTYPE3,	AMOVHPD,
   756  	"MOVHPS",	LTYPE3,	AMOVHPS,
   757  	"MOVLHPS",	LTYPE3,	AMOVLHPS,
   758  	"MOVLPD",	LTYPE3,	AMOVLPD,
   759  	"MOVLPS",	LTYPE3,	AMOVLPS,
   760  	"MOVMSKPD",	LTYPE3,	AMOVMSKPD,
   761  	"MOVMSKPS",	LTYPE3,	AMOVMSKPS,
   762  	"MOVNTO",	LTYPE3,	AMOVNTO,
   763  	"MOVNTDQ",	LTYPE3,	AMOVNTO,	/* syn */
   764  	"MOVNTPD",	LTYPE3,	AMOVNTPD,
   765  	"MOVNTPS",	LTYPE3,	AMOVNTPS,
   766  	"MOVSD",	LTYPE3,	AMOVSD,
   767  	"MOVSS",	LTYPE3,	AMOVSS,
   768  	"MOVUPD",	LTYPE3,	AMOVUPD,
   769  	"MOVUPS",	LTYPE3,	AMOVUPS,
   770  	"MULPD",	LTYPE3,	AMULPD,
   771  	"MULPS",	LTYPE3,	AMULPS,
   772  	"MULSD",	LTYPE3,	AMULSD,
   773  	"MULSS",	LTYPE3,	AMULSS,
   774  	"ORPD",		LTYPE3,	AORPD,
   775  	"ORPS",		LTYPE3,	AORPS,
   776  	"PADDQ",	LTYPE3,	APADDQ,
   777  	"PAND",		LTYPE3,	APAND,
   778  	"PCMPEQB",	LTYPE3,	APCMPEQB,
   779  	"PMAXSW",	LTYPE3,	APMAXSW,
   780  	"PMAXUB",	LTYPE3,	APMAXUB,
   781  	"PMINSW",	LTYPE3,	APMINSW,
   782  	"PMINUB",	LTYPE3,	APMINUB,
   783  	"PMOVMSKB",	LTYPE3,	APMOVMSKB,
   784  	"PSADBW",	LTYPE3,	APSADBW,
   785  	"PSHUFB",	LTYPE3, APSHUFB,
   786  	"PSHUFHW",      LTYPEX, APSHUFHW,
   787  	"PSHUFL",       LTYPEX, APSHUFL,
   788  	"PSHUFLW",      LTYPEX, APSHUFLW,
   789  	"PSUBB",	LTYPE3,	APSUBB,
   790  	"PSUBL",	LTYPE3,	APSUBL,
   791  	"PSUBQ",	LTYPE3,	APSUBQ,
   792  	"PSUBSB",	LTYPE3,	APSUBSB,
   793  	"PSUBSW",	LTYPE3,	APSUBSW,
   794  	"PSUBUSB",	LTYPE3,	APSUBUSB,
   795  	"PSUBUSW",	LTYPE3,	APSUBUSW,
   796  	"PSUBW",	LTYPE3,	APSUBW,
   797  	"PUNPCKHQDQ",	LTYPE3,	APUNPCKHQDQ,
   798  	"PUNPCKLQDQ",	LTYPE3,	APUNPCKLQDQ,
   799  	"PXOR",		LTYPE3, APXOR,
   800  	"RCPPS",	LTYPE3,	ARCPPS,
   801  	"RCPSS",	LTYPE3,	ARCPSS,
   802  	"RSQRTPS",	LTYPE3,	ARSQRTPS,
   803  	"RSQRTSS",	LTYPE3,	ARSQRTSS,
   804  	"SQRTPD",	LTYPE3,	ASQRTPD,
   805  	"SQRTPS",	LTYPE3,	ASQRTPS,
   806  	"SQRTSD",	LTYPE3,	ASQRTSD,
   807  	"SQRTSS",	LTYPE3,	ASQRTSS,
   808  	"SUBPD",	LTYPE3,	ASUBPD,
   809  	"SUBPS",	LTYPE3,	ASUBPS,
   810  	"SUBSD",	LTYPE3,	ASUBSD,
   811  	"SUBSS",	LTYPE3,	ASUBSS,
   812  	"UCOMISD",	LTYPE3,	AUCOMISD,
   813  	"UCOMISS",	LTYPE3,	AUCOMISS,
   814  	"UNPCKHPD",	LTYPE3,	AUNPCKHPD,
   815  	"UNPCKHPS",	LTYPE3,	AUNPCKHPS,
   816  	"UNPCKLPD",	LTYPE3,	AUNPCKLPD,
   817  	"UNPCKLPS",	LTYPE3,	AUNPCKLPS,
   818  	"XORPD",	LTYPE3,	AXORPD,
   819  	"XORPS",	LTYPE3,	AXORPS,
   820  	"USEFIELD",	LTYPEN, AUSEFIELD,
   821  	"PCDATA",	LTYPEPC,	APCDATA,
   822  	"FUNCDATA",	LTYPEF,	AFUNCDATA,
   823  	0
   824  };
   825  
   826  void
   827  cinit(void)
   828  {
   829  	Sym *s;
   830  	int i;
   831  
   832  	nullgen.type = D_NONE;
   833  	nullgen.index = D_NONE;
   834  
   835  	nerrors = 0;
   836  	iostack = I;
   837  	iofree = I;
   838  	peekc = IGN;
   839  	nhunk = 0;
   840  	for(i=0; i<NHASH; i++)
   841  		hash[i] = S;
   842  	for(i=0; itab[i].name; i++) {
   843  		s = slookup(itab[i].name);
   844  		if(s->type != LNAME)
   845  			yyerror("double initialization %s", itab[i].name);
   846  		s->type = itab[i].type;
   847  		s->value = itab[i].value;
   848  	}
   849  }
   850  
   851  void
   852  checkscale(int scale)
   853  {
   854  
   855  	switch(scale) {
   856  	case 1:
   857  	case 2:
   858  	case 4:
   859  	case 8:
   860  		return;
   861  	}
   862  	yyerror("scale must be 1248: %d", scale);
   863  }
   864  
   865  void
   866  syminit(Sym *s)
   867  {
   868  
   869  	s->type = LNAME;
   870  	s->value = 0;
   871  }
   872  
   873  void
   874  cclean(void)
   875  {
   876  	Addr2 g2;
   877  
   878  	g2.from = nullgen;
   879  	g2.to = nullgen;
   880  	outcode(AEND, &g2);
   881  }
   882  
   883  static Prog *lastpc;
   884  
   885  void
   886  outcode(int a, Addr2 *g2)
   887  {
   888  	Prog *p;
   889  	Plist *pl;
   890  	
   891  	if(pass == 1)
   892  		goto out;
   893  
   894  	p = malloc(sizeof *p);
   895  	memset(p, 0, sizeof *p);
   896  	p->as = a;
   897  	p->lineno = stmtline;
   898  	p->from = g2->from;
   899  	p->to = g2->to;
   900  	p->pc = pc;
   901  
   902  	if(lastpc == nil) {
   903  		pl = linknewplist(ctxt);
   904  		pl->firstpc = p;
   905  	} else
   906  		lastpc->link = p;
   907  	lastpc = p;	
   908  
   909  out:
   910  	if(a != AGLOBL && a != ADATA)
   911  		pc++;
   912  }
   913  
   914  #include "../cc/lexbody"
   915  #include "../cc/macbody"