Browse Source

Cleaning cmd (#760)

Signed-off-by: Álvaro Jurado <elbingmiss@gmail.com>
Álvaro Jurado 1 year ago
parent
commit
9e548971d0
100 changed files with 0 additions and 54258 deletions
  1. BIN
      amd64/bin/syslinuxmbr.bin
  2. 0 188
      sys/src/cmd/5a/a.h
  3. 0 673
      sys/src/cmd/5a/a.y
  4. 0 38
      sys/src/cmd/5a/l.s
  5. 0 706
      sys/src/cmd/5a/lex.c
  6. 0 19
      sys/src/cmd/5a/mkfile
  7. 0 222
      sys/src/cmd/5c/5.out.h
  8. 0 1177
      sys/src/cmd/5c/cgen.c
  9. 0 113
      sys/src/cmd/5c/enam.c
  10. 0 361
      sys/src/cmd/5c/gc.h
  11. 0 313
      sys/src/cmd/5c/list.c
  12. 0 15
      sys/src/cmd/5c/mkenam
  13. 0 41
      sys/src/cmd/5c/mkfile
  14. 0 618
      sys/src/cmd/5c/mul.c
  15. 0 1448
      sys/src/cmd/5c/peep.c
  16. 0 1167
      sys/src/cmd/5c/reg.c
  17. 0 228
      sys/src/cmd/5c/sgen.c
  18. 0 628
      sys/src/cmd/5c/swt.c
  19. 0 1322
      sys/src/cmd/5c/txt.c
  20. 0 288
      sys/src/cmd/5i/5i.c
  21. 0 249
      sys/src/cmd/5i/arm.h
  22. 0 137
      sys/src/cmd/5i/bpt.c
  23. 0 649
      sys/src/cmd/5i/cmd.c
  24. 0 212
      sys/src/cmd/5i/float.c
  25. 0 26
      sys/src/cmd/5i/icache.c
  26. 0 294
      sys/src/cmd/5i/mem.c
  27. 0 26
      sys/src/cmd/5i/mkfile
  28. 0 957
      sys/src/cmd/5i/run.c
  29. 0 208
      sys/src/cmd/5i/stats.c
  30. 0 104
      sys/src/cmd/5i/symbols.c
  31. 0 816
      sys/src/cmd/5i/syscall.c
  32. 0 1815
      sys/src/cmd/5l/asm.c
  33. 0 74
      sys/src/cmd/5l/compat.c
  34. 0 420
      sys/src/cmd/5l/l.h
  35. 0 31
      sys/src/cmd/5l/l.s
  36. 0 361
      sys/src/cmd/5l/list.c
  37. 0 34
      sys/src/cmd/5l/mkfile
  38. 0 540
      sys/src/cmd/5l/noop.c
  39. 0 1654
      sys/src/cmd/5l/obj.c
  40. 0 266
      sys/src/cmd/5l/optab.c
  41. 0 604
      sys/src/cmd/5l/pass.c
  42. 0 996
      sys/src/cmd/5l/span.c
  43. 0 204
      sys/src/cmd/6a/a.h
  44. 0 562
      sys/src/cmd/6a/a.y
  45. 0 1298
      sys/src/cmd/6a/lex.c
  46. 0 26
      sys/src/cmd/6a/mkfile
  47. 0 829
      sys/src/cmd/6c/6.out.h
  48. 0 1972
      sys/src/cmd/6c/cgen.c
  49. 0 215
      sys/src/cmd/6c/div.c
  50. 0 678
      sys/src/cmd/6c/enam.c
  51. 0 389
      sys/src/cmd/6c/gc.h
  52. 0 346
      sys/src/cmd/6c/list.c
  53. 0 87
      sys/src/cmd/6c/machcap.c
  54. 0 15
      sys/src/cmd/6c/mkenam
  55. 0 38
      sys/src/cmd/6c/mkfile
  56. 0 437
      sys/src/cmd/6c/mul.c
  57. 0 855
      sys/src/cmd/6c/peep.c
  58. 0 1367
      sys/src/cmd/6c/reg.c
  59. 0 444
      sys/src/cmd/6c/sgen.c
  60. 0 522
      sys/src/cmd/6c/swt.c
  61. 0 115
      sys/src/cmd/6c/sys.c
  62. 0 1531
      sys/src/cmd/6c/txt.c
  63. 0 422
      sys/src/cmd/6l/asm.c
  64. 0 73
      sys/src/cmd/6l/compat.c
  65. 0 410
      sys/src/cmd/6l/l.h
  66. 0 359
      sys/src/cmd/6l/list.c
  67. 0 35
      sys/src/cmd/6l/mkfile
  68. 0 1683
      sys/src/cmd/6l/obj.c
  69. 0 1194
      sys/src/cmd/6l/optab.c
  70. 0 799
      sys/src/cmd/6l/pass.c
  71. 0 1763
      sys/src/cmd/6l/span.c
  72. 0 204
      sys/src/cmd/8a/a.h
  73. 0 577
      sys/src/cmd/8a/a.y
  74. 0 704
      sys/src/cmd/8a/l.s
  75. 0 963
      sys/src/cmd/8a/lex.c
  76. 0 26
      sys/src/cmd/8a/mkfile
  77. 0 514
      sys/src/cmd/8c/8.out.h
  78. 0 1861
      sys/src/cmd/8c/cgen.c
  79. 0 2663
      sys/src/cmd/8c/cgen64.c
  80. 0 215
      sys/src/cmd/8c/div.c
  81. 0 393
      sys/src/cmd/8c/enam.c
  82. 0 379
      sys/src/cmd/8c/gc.h
  83. 0 292
      sys/src/cmd/8c/list.c
  84. 0 100
      sys/src/cmd/8c/machcap.c
  85. 0 15
      sys/src/cmd/8c/mkenam
  86. 0 39
      sys/src/cmd/8c/mkfile
  87. 0 437
      sys/src/cmd/8c/mul.c
  88. 0 780
      sys/src/cmd/8c/peep.c
  89. 0 1273
      sys/src/cmd/8c/reg.c
  90. 0 449
      sys/src/cmd/8c/sgen.c
  91. 0 511
      sys/src/cmd/8c/swt.c
  92. 0 1455
      sys/src/cmd/8c/txt.c
  93. 0 532
      sys/src/cmd/8l/asm.c
  94. 0 74
      sys/src/cmd/8l/compat.c
  95. 0 275
      sys/src/cmd/8l/elf.c
  96. 0 111
      sys/src/cmd/8l/elf.h
  97. 0 374
      sys/src/cmd/8l/l.h
  98. 0 301
      sys/src/cmd/8l/list.c
  99. 0 35
      sys/src/cmd/8l/mkfile
  100. 0 0
      sys/src/cmd/8l/obj.c

BIN
amd64/bin/syslinuxmbr.bin


+ 0 - 188
sys/src/cmd/5a/a.h

@@ -1,188 +0,0 @@
-/*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
-
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include "../5c/5.out.h"
-
-#ifndef	EXTERN
-#define	EXTERN	extern
-#endif
-
-typedef	struct	Sym	Sym;
-typedef	struct	Gen	Gen;
-typedef	struct	Io	Io;
-typedef	struct	Hist	Hist;
-
-#define	MAXALIGN	7
-#define	FPCHIP		1
-#define	NSYMB		8192
-#define	BUFSIZ		8192
-#define	HISTSZ		20
-#define	NINCLUDE	10
-#define	NHUNK		10000
-#define	EOF		(-1)
-#define	IGN		(-2)
-#define	GETC()		((--fi.c < 0)? filbuf(): *fi.p++ & 0xff)
-#define	NHASH		503
-#define	STRINGSZ	200
-#define	NMACRO		10
-
-struct	Sym
-{
-	Sym*	link;
-	char*	macro;
-	long	value;
-	ushort	type;
-	char	*name;
-	char	sym;
-};
-#define	S	((Sym*)0)
-
-EXTERN	struct
-{
-	char*	p;
-	int	c;
-} fi;
-
-struct	Io
-{
-	Io*	link;
-	char	b[BUFSIZ];
-	char*	p;
-	short	c;
-	short	f;
-};
-#define	I	((Io*)0)
-
-EXTERN	struct
-{
-	Sym*	sym;
-	short	type;
-} h[NSYM];
-
-struct	Gen
-{
-	Sym*	sym;
-	long	offset;
-	short	type;
-	short	reg;
-	short	name;
-	double	dval;
-	char	sval[8];
-};
-
-struct	Hist
-{
-	Hist*	link;
-	char*	name;
-	long	line;
-	long	offset;
-};
-#define	H	((Hist*)0)
-
-enum
-{
-	CLAST,
-	CMACARG,
-	CMACRO,
-	CPREPROC,
-
-	Always	= 14,
-};
-
-EXTERN	char	debug[256];
-EXTERN	Sym*	hash[NHASH];
-EXTERN	char*	Dlist[30];
-EXTERN	int	nDlist;
-EXTERN	Hist*	ehist;
-EXTERN	int	newflag;
-EXTERN	Hist*	hist;
-EXTERN	char*	hunk;
-EXTERN	char*	include[NINCLUDE];
-EXTERN	Io*	iofree;
-EXTERN	Io*	ionext;
-EXTERN	Io*	iostack;
-EXTERN	long	lineno;
-EXTERN	int	nerrors;
-EXTERN	long	nhunk;
-EXTERN	int	ninclude;
-EXTERN	Gen	nullgen;
-EXTERN	char*	outfile;
-EXTERN	int	pass;
-EXTERN	char*	pathname;
-EXTERN	long	pc;
-EXTERN	int	peekc;
-EXTERN	int	sym;
-EXTERN	char	symb[NSYMB];
-EXTERN	int	thechar;
-EXTERN	char*	thestring;
-EXTERN	long	thunk;
-EXTERN	Biobuf	obuf;
-
-void*	alloc(long);
-void*	allocn(void*, long, long);
-void	errorexit(void);
-void	pushio(void);
-void	newio(void);
-void	newfile(char*, int);
-Sym*	slookup(char*);
-Sym*	lookup(void);
-void	syminit(Sym*);
-long	yylex(void);
-int	getc(void);
-int	getnsc(void);
-void	unget(int);
-int	escchar(int);
-void	cinit(void);
-void	pinit(char*);
-void	cclean(void);
-int	isreg(Gen*);
-void	outcode(int, int, Gen*, int, Gen*);
-void	zname(char*, int, int);
-void	zaddr(Gen*, int);
-void	ieeedtod(Ieee*, double);
-int	filbuf(void);
-Sym*	getsym(void);
-void	domacro(void);
-void	macund(void);
-void	macdef(void);
-void	macexpand(Sym*, char*);
-void	macinc(void);
-void	maclin(void);
-void	macprag(void);
-void	macif(int);
-void	macend(void);
-void	outhist(void);
-void	dodefine(char*);
-void	prfile(long);
-void	linehist(char*, int);
-void	gethunk(void);
-void	yyerror(char*, ...);
-int	yyparse(void);
-void	setinclude(char*);
-int	assemble(char*);
-
-/*
- *	system-dependent stuff from ../cc/compat.c
- */
-
-enum				/* keep in synch with ../cc/cc.h */
-{
-	Plan9	= 1<<0,
-	Unix	= 1<<1,
-	Windows	= 1<<2,
-};
-int	mywait(int*);
-int	mycreat(char*, int);
-int	systemtype(int);
-int	pathchar(void);
-int	myfork(void);
-void*	mysbrk(ulong);

+ 0 - 673
sys/src/cmd/5a/a.y

@@ -1,673 +0,0 @@
-%{
-#include "a.h"
-%}
-%union
-{
-	Sym	*sym;
-	long	lval;
-	double	dval;
-	char	sval[8];
-	Gen	gen;
-}
-%left	'|'
-%left	'^'
-%left	'&'
-%left	'<' '>'
-%left	'+' '-'
-%left	'*' '/' '%'
-%token	<lval>	LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5
-%token	<lval>	LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA
-%token	<lval>	LTYPEB LTYPEC LTYPED LTYPEE LTYPEF
-%token	<lval>	LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK
-%token	<lval>	LTYPEL LTYPEM LTYPEN LTYPEBX
-%token	<lval>	LCONST LSP LSB LFP LPC
-%token	<lval>	LTYPEX LR LREG LF LFREG LC LCREG LPSR LFCR
-%token	<lval>	LCOND LS LAT
-%token	<dval>	LFCONST
-%token	<sval>	LSCONST
-%token	<sym>	LNAME LLAB LVAR
-%type	<lval>	con expr oexpr pointer offset sreg spreg creg
-%type	<lval>	rcon cond reglist
-%type	<gen>	gen rel reg regreg freg shift fcon frcon
-%type	<gen>	imm ximm name oreg ireg nireg ioreg imsr
-%%
-prog:
-|	prog line
-
-line:
-	LLAB ':'
-	{
-		if($1->value != pc)
-			yyerror("redeclaration of %s", $1->name);
-		$1->value = pc;
-	}
-	line
-|	LNAME ':'
-	{
-		$1->type = LLAB;
-		$1->value = pc;
-	}
-	line
-|	LNAME '=' expr ';'
-	{
-		$1->type = LVAR;
-		$1->value = $3;
-	}
-|	LVAR '=' expr ';'
-	{
-		if($1->value != $3)
-			yyerror("redeclaration of %s", $1->name);
-		$1->value = $3;
-	}
-|	';'
-|	inst ';'
-|	error ';'
-
-inst:
-/*
- * ADD
- */
-	LTYPE1 cond imsr ',' spreg ',' reg
-	{
-		outcode($1, $2, &$3, $5, &$7);
-	}
-|	LTYPE1 cond imsr ',' spreg ','
-	{
-		outcode($1, $2, &$3, $5, &nullgen);
-	}
-|	LTYPE1 cond imsr ',' reg
-	{
-		outcode($1, $2, &$3, NREG, &$5);
-	}
-/*
- * MVN
- */
-|	LTYPE2 cond imsr ',' reg
-	{
-		outcode($1, $2, &$3, NREG, &$5);
-	}
-/*
- * MOVW
- */
-|	LTYPE3 cond gen ',' gen
-	{
-		outcode($1, $2, &$3, NREG, &$5);
-	}
-/*
- * B/BL
- */
-|	LTYPE4 cond comma rel
-	{
-		outcode($1, $2, &nullgen, NREG, &$4);
-	}
-|	LTYPE4 cond comma nireg
-	{
-		outcode($1, $2, &nullgen, NREG, &$4);
-	}
-/*
- * BX
- */
-|	LTYPEBX comma ireg
-	{
-		outcode($1, Always, &nullgen, NREG, &$3);
-	}
-/*
- * BEQ
- */
-|	LTYPE5 comma rel
-	{
-		outcode($1, Always, &nullgen, NREG, &$3);
-	}
-/*
- * SWI
- */
-|	LTYPE6 cond comma gen
-	{
-		outcode($1, $2, &nullgen, NREG, &$4);
-	}
-/*
- * CMP
- */
-|	LTYPE7 cond imsr ',' spreg comma
-	{
-		outcode($1, $2, &$3, $5, &nullgen);
-	}
-/*
- * MOVM
- */
-|	LTYPE8 cond ioreg ',' '[' reglist ']'
-	{
-		Gen g;
-
-		g = nullgen;
-		g.type = D_CONST;
-		g.offset = $6;
-		outcode($1, $2, &$3, NREG, &g);
-	}
-|	LTYPE8 cond '[' reglist ']' ',' ioreg
-	{
-		Gen g;
-
-		g = nullgen;
-		g.type = D_CONST;
-		g.offset = $4;
-		outcode($1, $2, &g, NREG, &$7);
-	}
-/*
- * SWAP
- */
-|	LTYPE9 cond reg ',' ireg ',' reg
-	{
-		outcode($1, $2, &$5, $3.reg, &$7);
-	}
-|	LTYPE9 cond reg ',' ireg comma
-	{
-		outcode($1, $2, &$5, $3.reg, &$3);
-	}
-|	LTYPE9 cond comma ireg ',' reg
-	{
-		outcode($1, $2, &$4, $6.reg, &$6);
-	}
-/*
- * RET
- */
-|	LTYPEA cond comma
-	{
-		outcode($1, $2, &nullgen, NREG, &nullgen);
-	}
-/*
- * TEXT/GLOBL
- */
-|	LTYPEB name ',' imm
-	{
-		outcode($1, Always, &$2, NREG, &$4);
-	}
-|	LTYPEB name ',' con ',' imm
-	{
-		outcode($1, Always, &$2, $4, &$6);
-	}
-/*
- * DATA
- */
-|	LTYPEC name '/' con ',' ximm
-	{
-		outcode($1, Always, &$2, $4, &$6);
-	}
-/*
- * CASE
- */
-|	LTYPED cond reg comma
-	{
-		outcode($1, $2, &$3, NREG, &nullgen);
-	}
-/*
- * word
- */
-|	LTYPEH comma ximm
-	{
-		outcode($1, Always, &nullgen, NREG, &$3);
-	}
-/*
- * floating-point coprocessor
- */
-|	LTYPEI cond freg ',' freg
-	{
-		outcode($1, $2, &$3, NREG, &$5);
-	}
-|	LTYPEK cond frcon ',' freg
-	{
-		outcode($1, $2, &$3, NREG, &$5);
-	}
-|	LTYPEK cond frcon ',' LFREG ',' freg
-	{
-		outcode($1, $2, &$3, $5, &$7);
-	}
-|	LTYPEL cond freg ',' freg comma
-	{
-		outcode($1, $2, &$3, $5.reg, &nullgen);
-	}
-/*
- * MCR MRC
- */
-|	LTYPEJ cond con ',' expr ',' spreg ',' creg ',' creg oexpr
-	{
-		Gen g;
-
-		g = nullgen;
-		g.type = D_CONST;
-		g.offset =
-			(0xe << 24) |		/* opcode */
-			($1 << 20) |		/* MCR/MRC */
-			($2 << 28) |		/* scond */
-			(($3 & 15) << 8) |	/* coprocessor number */
-			(($5 & 7) << 21) |	/* coprocessor operation */
-			(($7 & 15) << 12) |	/* arm register */
-			(($9 & 15) << 16) |	/* Crn */
-			(($11 & 15) << 0) |	/* Crm */
-			(($12 & 7) << 5) |	/* coprocessor information */
-			(1<<4);			/* must be set */
-		outcode(AWORD, Always, &nullgen, NREG, &g);
-	}
-/*
- * MULL hi,lo,r1,r2
- */
-|	LTYPEM cond reg ',' reg ',' regreg
-	{
-		outcode($1, $2, &$3, $5.reg, &$7);
-	}
-/*
- * MULA hi,lo,r1,r2
- */
-|	LTYPEN cond reg ',' reg ',' reg ',' spreg 
-	{
-		$7.type = D_REGREG;
-		$7.offset = $9;
-		outcode($1, $2, &$3, $5.reg, &$7);
-	}
-/*
- * END
- */
-|	LTYPEE comma
-	{
-		outcode($1, Always, &nullgen, NREG, &nullgen);
-	}
-
-cond:
-	{
-		$$ = Always;
-	}
-|	cond LCOND
-	{
-		$$ = ($1 & ~C_SCOND) | $2;
-	}
-|	cond LS
-	{
-		$$ = $1 | $2;
-	}
-
-comma:
-|	',' comma
-
-rel:
-	con '(' LPC ')'
-	{
-		$$ = nullgen;
-		$$.type = D_BRANCH;
-		$$.offset = $1 + pc;
-	}
-|	LNAME offset
-	{
-		$$ = nullgen;
-		if(pass == 2)
-			yyerror("undefined label: %s", $1->name);
-		$$.type = D_BRANCH;
-		$$.sym = $1;
-		$$.offset = $2;
-	}
-|	LLAB offset
-	{
-		$$ = nullgen;
-		$$.type = D_BRANCH;
-		$$.sym = $1;
-		$$.offset = $1->value + $2;
-	}
-
-ximm:	'$' con
-	{
-		$$ = nullgen;
-		$$.type = D_CONST;
-		$$.offset = $2;
-	}
-|	'$' oreg
-	{
-		$$ = $2;
-		$$.type = D_CONST;
-	}
-|	'$' '*' '$' oreg
-	{
-		$$ = $4;
-		$$.type = D_OCONST;
-	}
-|	'$' LSCONST
-	{
-		$$ = nullgen;
-		$$.type = D_SCONST;
-		memcpy($$.sval, $2, sizeof($$.sval));
-	}
-|	fcon
-
-fcon:
-	'$' LFCONST
-	{
-		$$ = nullgen;
-		$$.type = D_FCONST;
-		$$.dval = $2;
-	}
-|	'$' '-' LFCONST
-	{
-		$$ = nullgen;
-		$$.type = D_FCONST;
-		$$.dval = -$3;
-	}
-
-reglist:
-	spreg
-	{
-		$$ = 1 << $1;
-	}
-|	spreg '-' spreg
-	{
-		int i;
-		$$=0;
-		for(i=$1; i<=$3; i++)
-			$$ |= 1<<i;
-		for(i=$3; i<=$1; i++)
-			$$ |= 1<<i;
-	}
-|	spreg comma reglist
-	{
-		$$ = (1<<$1) | $3;
-	}
-
-gen:
-	reg
-|	ximm
-|	shift
-|	shift '(' spreg ')'
-	{
-		$$ = $1;
-		$$.reg = $3;
-	}
-|	LPSR
-	{
-		$$ = nullgen;
-		$$.type = D_PSR;
-		$$.reg = $1;
-	}
-|	LFCR
-	{
-		$$ = nullgen;
-		$$.type = D_FPCR;
-		$$.reg = $1;
-	}
-|	con
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.offset = $1;
-	}
-|	oreg
-|	freg
-
-nireg:
-	ireg
-|	name
-	{
-		$$ = $1;
-		if($1.name != D_EXTERN && $1.name != D_STATIC) {
-		}
-	}
-
-ireg:
-	'(' spreg ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.reg = $2;
-		$$.offset = 0;
-	}
-
-ioreg:
-	ireg
-|	con '(' sreg ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.reg = $3;
-		$$.offset = $1;
-	}
-
-oreg:
-	name
-|	name '(' sreg ')'
-	{
-		$$ = $1;
-		$$.type = D_OREG;
-		$$.reg = $3;
-	}
-|	ioreg
-
-imsr:
-	reg
-|	imm
-|	shift
-
-imm:	'$' con
-	{
-		$$ = nullgen;
-		$$.type = D_CONST;
-		$$.offset = $2;
-	}
-
-reg:
-	spreg
-	{
-		$$ = nullgen;
-		$$.type = D_REG;
-		$$.reg = $1;
-	}
-
-regreg:
-	'(' spreg ',' spreg ')'
-	{
-		$$ = nullgen;
-		$$.type = D_REGREG;
-		$$.reg = $2;
-		$$.offset = $4;
-	}
-
-shift:
-	spreg '<' '<' rcon
-	{
-		$$ = nullgen;
-		$$.type = D_SHIFT;
-		$$.offset = $1 | $4 | (0 << 5);
-	}
-|	spreg '>' '>' rcon
-	{
-		$$ = nullgen;
-		$$.type = D_SHIFT;
-		$$.offset = $1 | $4 | (1 << 5);
-	}
-|	spreg '-' '>' rcon
-	{
-		$$ = nullgen;
-		$$.type = D_SHIFT;
-		$$.offset = $1 | $4 | (2 << 5);
-	}
-|	spreg LAT '>' rcon
-	{
-		$$ = nullgen;
-		$$.type = D_SHIFT;
-		$$.offset = $1 | $4 | (3 << 5);
-	}
-
-rcon:
-	spreg
-	{
-		if($$ < 0 || $$ >= 16)
-			print("register value out of range\n");
-		$$ = (($1&15) << 8) | (1 << 4);
-	}
-|	con
-	{
-		if($$ < 0 || $$ >= 32)
-			print("shift value out of range\n");
-		$$ = ($1&31) << 7;
-	}
-
-sreg:
-	LREG
-|	LPC
-	{
-		$$ = REGPC;
-	}
-|	LR '(' expr ')'
-	{
-		if($3 < 0 || $3 >= NREG)
-			print("register value out of range\n");
-		$$ = $3;
-	}
-
-spreg:
-	sreg
-|	LSP
-	{
-		$$ = REGSP;
-	}
-
-creg:
-	LCREG
-|	LC '(' expr ')'
-	{
-		if($3 < 0 || $3 >= NREG)
-			print("register value out of range\n");
-		$$ = $3;
-	}
-
-frcon:
-	freg
-|	fcon
-
-freg:
-	LFREG
-	{
-		$$ = nullgen;
-		$$.type = D_FREG;
-		$$.reg = $1;
-	}
-|	LF '(' con ')'
-	{
-		$$ = nullgen;
-		$$.type = D_FREG;
-		$$.reg = $3;
-	}
-
-name:
-	con '(' pointer ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.name = $3;
-		$$.sym = S;
-		$$.offset = $1;
-	}
-|	LNAME offset '(' pointer ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.name = $4;
-		$$.sym = $1;
-		$$.offset = $2;
-	}
-|	LNAME '<' '>' offset '(' LSB ')'
-	{
-		$$ = nullgen;
-		$$.type = D_OREG;
-		$$.name = D_STATIC;
-		$$.sym = $1;
-		$$.offset = $4;
-	}
-
-offset:
-	{
-		$$ = 0;
-	}
-|	'+' con
-	{
-		$$ = $2;
-	}
-|	'-' con
-	{
-		$$ = -$2;
-	}
-
-pointer:
-	LSB
-|	LSP
-|	LFP
-
-con:
-	LCONST
-|	LVAR
-	{
-		$$ = $1->value;
-	}
-|	'-' con
-	{
-		$$ = -$2;
-	}
-|	'+' con
-	{
-		$$ = $2;
-	}
-|	'~' con
-	{
-		$$ = ~$2;
-	}
-|	'(' expr ')'
-	{
-		$$ = $2;
-	}
-
-oexpr:
-	{
-		$$ = 0;
-	}
-|	',' expr
-	{
-		$$ = $2;
-	}
-
-expr:
-	con
-|	expr '+' expr
-	{
-		$$ = $1 + $3;
-	}
-|	expr '-' expr
-	{
-		$$ = $1 - $3;
-	}
-|	expr '*' expr
-	{
-		$$ = $1 * $3;
-	}
-|	expr '/' expr
-	{
-		$$ = $1 / $3;
-	}
-|	expr '%' expr
-	{
-		$$ = $1 % $3;
-	}
-|	expr '<' '<' expr
-	{
-		$$ = $1 << $4;
-	}
-|	expr '>' '>' expr
-	{
-		$$ = $1 >> $4;
-	}
-|	expr '&' expr
-	{
-		$$ = $1 & $3;
-	}
-|	expr '^' expr
-	{
-		$$ = $1 ^ $3;
-	}
-|	expr '|' expr
-	{
-		$$ = $1 | $3;
-	}

+ 0 - 38
sys/src/cmd/5a/l.s

@@ -1,38 +0,0 @@
-TEXT	main(SB), $0
-
-	ADD		R1,R4
-	ADD		R1,R3,R4
-	ADD		R1<<1,R3,R4	/* logical left */
-	ADD		R1>>1,R3,R4	/* logical right */
-	ADD		R1->1,R3,R4	/* arithmetic right */
- 	ADD		R1@>1,R3,R4	/* rotate right */
-
-	ADD		R1<<R2,R3,R4
-	ADD		$10,R1,R4
-
-loop:
-	ADD.S.NE	R1,R4
-	BNE		loop
-
-	MOVW		R3, CPSR
-	MOVW		R3, SPSR
-	MOVW		R3, F10
-	MOVW		R3, (R2)
-	MOVW		R3, 10(R2)
-	MOVW		R3, name(SB)
-	MOVW		R3, name(SB)(R2)
-	MOVW		R3, name(SB)(R2)
-	MOVW		R3, (R2)
-	MOVW		R3, R1<<2(R2)
-
-	MRC.EQ		3,9,R3,C5,C6,2
-	MRC		3,9,R3,C5,C6,2
-
-	MOVM.IA		[R0,SP,R4], (R2)
-	MOVM.DB.W	(R0), [R6-R11]
-	MOVM.DB.W	(R0), [R0-R11]
-	MOVM.S		(R0), [R0-R11]	// .S is supervisor space
-
-	CMN	$4096,R0,
-
-	RET

+ 0 - 706
sys/src/cmd/5a/lex.c

@@ -1,706 +0,0 @@
-/*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
-
-#define	EXTERN
-#include "a.h"
-#include "y.tab.h"
-#include <ctype.h>
-
-void
-main(int argc, char *argv[])
-{
-	char *p;
-	int nout, nproc, status, i, c;
-
-	thechar = '5';
-	thestring = "arm";
-	memset(debug, 0, sizeof(debug));
-	cinit();
-	outfile = 0;
-	include[ninclude++] = ".";
-	ARGBEGIN {
-	default:
-		c = ARGC();
-		if(c >= 0 || c < sizeof(debug))
-			debug[c] = 1;
-		break;
-
-	case 'o':
-		outfile = ARGF();
-		break;
-
-	case 'D':
-		p = ARGF();
-		if(p)
-			Dlist[nDlist++] = p;
-		break;
-
-	case 'I':
-		p = ARGF();
-		setinclude(p);
-		break;
-	case 't':
-		thechar = 't';
-		thestring = "thumb";
-		break;
-	} ARGEND
-	if(*argv == 0) {
-		print("usage: %ca [-options] file.s\n", thechar);
-		errorexit();
-	}
-	if(argc > 1 && systemtype(Windows)){
-		print("can't assemble multiple files on windows\n");
-		errorexit();
-	}
-	if(argc > 1 && !systemtype(Windows)) {
-		nproc = 1;
-		if(p = getenv("NPROC"))
-			nproc = atol(p);	/* */
-		c = 0;
-		nout = 0;
-		for(;;) {
-			while(nout < nproc && argc > 0) {
-				i = myfork();
-				if(i < 0) {
-					i = mywait(&status);
-					if(i < 0)
-						errorexit();
-					if(status)
-						c++;
-					nout--;
-					continue;
-				}
-				if(i == 0) {
-					print("%s:\n", *argv);
-					if(assemble(*argv))
-						errorexit();
-					exits(0);
-				}
-				nout++;
-				argc--;
-				argv++;
-			}
-			i = mywait(&status);
-			if(i < 0) {
-				if(c)
-					errorexit();
-				exits(0);
-			}
-			if(status)
-				c++;
-			nout--;
-		}
-	}
-	if(assemble(argv[0]))
-		errorexit();
-	exits(0);
-}
-
-int
-assemble(char *file)
-{
-	char ofile[100], incfile[20], *p;
-	int i, of;
-
-	strcpy(ofile, file);
-	p = utfrrune(ofile, pathchar());
-	if(p) {
-		include[0] = ofile;
-		*p++ = 0;
-	} else
-		p = ofile;
-	if(outfile == 0) {
-		outfile = p;
-		if(outfile){
-			p = utfrrune(outfile, '.');
-			if(p)
-				if(p[1] == 's' && p[2] == 0)
-					p[0] = 0;
-			p = utfrune(outfile, 0);
-			p[0] = '.';
-			p[1] = thechar;
-			p[2] = 0;
-		} else
-			outfile = "/dev/null";
-	}
-	p = getenv("INCLUDE");
-	if(p) {
-		setinclude(p);
-	} else {
-		if(systemtype(Plan9)) {
-			sprint(incfile,"/%s/include", thestring);
-			setinclude(strdup(incfile));
-		}
-	}
-
-	of = mycreat(outfile, 0664);
-	if(of < 0) {
-		yyerror("%ca: cannot create %s", thechar, outfile);
-		errorexit();
-	}
-	Binit(&obuf, of, OWRITE);
-
-	pass = 1;
-	pinit(file);
-	for(i=0; i<nDlist; i++)
-		dodefine(Dlist[i]);
-	yyparse();
-	if(nerrors) {
-		cclean();
-		return nerrors;
-	}
-
-	pass = 2;
-	outhist();
-	pinit(file);
-	for(i=0; i<nDlist; i++)
-		dodefine(Dlist[i]);
-	yyparse();
-	cclean();
-	return nerrors;
-}
-
-struct
-{
-	char	*name;
-	uint16_t	type;
-	uint16_t	value;
-} itab[] =
-{
-	"SP",		LSP,	D_AUTO,
-	"SB",		LSB,	D_EXTERN,
-	"FP",		LFP,	D_PARAM,
-	"PC",		LPC,	D_BRANCH,
-
-	"R",		LR,	0,
-	"R0",		LREG,	0,
-	"R1",		LREG,	1,
-	"R2",		LREG,	2,
-	"R3",		LREG,	3,
-	"R4",		LREG,	4,
-	"R5",		LREG,	5,
-	"R6",		LREG,	6,
-	"R7",		LREG,	7,
-	"R8",		LREG,	8,
-	"R9",		LREG,	9,
-	"R10",		LREG,	10,
-	"R11",		LREG,	11,
-	"R12",		LREG,	12,
-	"R13",		LREG,	13,
-	"R14",		LREG,	14,
-	"R15",		LREG,	15,
-
-	"F",		LF,	0,
-
-	"F0",		LFREG,	0,
-	"F1",		LFREG,	1,
-	"F2",		LFREG,	2,
-	"F3",		LFREG,	3,
-	"F4",		LFREG,	4,
-	"F5",		LFREG,	5,
-	"F6",		LFREG,	6,
-	"F7",		LFREG,	7,
-	"F8",		LFREG,	8,
-	"F9",		LFREG,	9,
-	"F10",		LFREG,	10,
-	"F11",		LFREG,	11,
-	"F12",		LFREG,	12,
-	"F13",		LFREG,	13,
-	"F14",		LFREG,	14,
-	"F15",		LFREG,	15,
-
-	"C",		LC,	0,
-
-	"C0",		LCREG,	0,
-	"C1",		LCREG,	1,
-	"C2",		LCREG,	2,
-	"C3",		LCREG,	3,
-	"C4",		LCREG,	4,
-	"C5",		LCREG,	5,
-	"C6",		LCREG,	6,
-	"C7",		LCREG,	7,
-	"C8",		LCREG,	8,
-	"C9",		LCREG,	9,
-	"C10",		LCREG,	10,
-	"C11",		LCREG,	11,
-	"C12",		LCREG,	12,
-	"C13",		LCREG,	13,
-	"C14",		LCREG,	14,
-	"C15",		LCREG,	15,
-
-	"CPSR",		LPSR,	0,
-	"SPSR",		LPSR,	1,
-
-	"FPSR",		LFCR,	0,
-	"FPCR",		LFCR,	1,
-
-	".EQ",		LCOND,	0,
-	".NE",		LCOND,	1,
-	".CS",		LCOND,	2,
-	".HS",		LCOND,	2,
-	".CC",		LCOND,	3,
-	".LO",		LCOND,	3,
-	".MI",		LCOND,	4,
-	".PL",		LCOND,	5,
-	".VS",		LCOND,	6,
-	".VC",		LCOND,	7,
-	".HI",		LCOND,	8,
-	".LS",		LCOND,	9,
-	".GE",		LCOND,	10,
-	".LT",		LCOND,	11,
-	".GT",		LCOND,	12,
-	".LE",		LCOND,	13,
-	".AL",		LCOND,	Always,
-
-	".U",		LS,	C_UBIT,
-	".S",		LS,	C_SBIT,
-	".W",		LS,	C_WBIT,
-	".P",		LS,	C_PBIT,
-	".PW",		LS,	C_WBIT|C_PBIT,
-	".WP",		LS,	C_WBIT|C_PBIT,
-
-	".F",		LS,	C_FBIT,
-
-	".IBW",		LS,	C_WBIT|C_PBIT|C_UBIT,
-	".IAW",		LS,	C_WBIT|C_UBIT,
-	".DBW",		LS,	C_WBIT|C_PBIT,
-	".DAW",		LS,	C_WBIT,
-	".IB",		LS,	C_PBIT|C_UBIT,
-	".IA",		LS,	C_UBIT,
-	".DB",		LS,	C_PBIT,
-	".DA",		LS,	0,
-
-	"@",		LAT,	0,
-
-	"AND",		LTYPE1,	AAND,
-	"EOR",		LTYPE1,	AEOR,
-	"SUB",		LTYPE1,	ASUB,
-	"RSB",		LTYPE1,	ARSB,
-	"ADD",		LTYPE1,	AADD,
-	"ADC",		LTYPE1,	AADC,
-	"SBC",		LTYPE1,	ASBC,
-	"RSC",		LTYPE1,	ARSC,
-	"ORR",		LTYPE1,	AORR,
-	"BIC",		LTYPE1,	ABIC,
-
-	"SLL",		LTYPE1,	ASLL,
-	"SRL",		LTYPE1,	ASRL,
-	"SRA",		LTYPE1,	ASRA,
-
-	"MUL",		LTYPE1, AMUL,
-	"MULA",		LTYPEN, AMULA,
-	"DIV",		LTYPE1,	ADIV,
-	"MOD",		LTYPE1,	AMOD,
-
-	"MULL",		LTYPEM, AMULL,
-	"MULAL",	LTYPEM, AMULAL,
-	"MULLU",	LTYPEM, AMULLU,
-	"MULALU",	LTYPEM, AMULALU,
-
-	"MVN",		LTYPE2, AMVN,	/* op2 ignored */
-
-	"MOVB",		LTYPE3, AMOVB,
-	"MOVBU",	LTYPE3, AMOVBU,
-	"MOVH",		LTYPE3, AMOVH,
-	"MOVHU",	LTYPE3, AMOVHU,
-	"MOVW",		LTYPE3, AMOVW,
-
-	"MOVD",		LTYPE3, AMOVD,
-	"MOVDF",		LTYPE3, AMOVDF,
-	"MOVDW",	LTYPE3, AMOVDW,
-	"MOVF",		LTYPE3, AMOVF,
-	"MOVFD",		LTYPE3, AMOVFD,
-	"MOVFW",		LTYPE3, AMOVFW,
-	"MOVWD",	LTYPE3, AMOVWD,
-	"MOVWF",		LTYPE3, AMOVWF,
-
-	"LDREX",		LTYPE3, ALDREX,
-	"LDREXD",		LTYPE3, ALDREXD,
-	"STREX",		LTYPE9, ASTREX,
-	"STREXD",		LTYPE9, ASTREXD,
-
-/*
-	"ABSF",		LTYPEI, AABSF,
-	"ABSD",		LTYPEI, AABSD,
-	"NEGF",		LTYPEI, ANEGF,
-	"NEGD",		LTYPEI, ANEGD,
-	"SQTF",		LTYPEI,	ASQTF,
-	"SQTD",		LTYPEI,	ASQTD,
-	"RNDF",		LTYPEI,	ARNDF,
-	"RNDD",		LTYPEI,	ARNDD,
-	"URDF",		LTYPEI,	AURDF,
-	"URDD",		LTYPEI,	AURDD,
-	"NRMF",		LTYPEI,	ANRMF,
-	"NRMD",		LTYPEI,	ANRMD,
-*/
-
-	"SQRTF",	LTYPEI, ASQRTF,
-	"SQRTD",	LTYPEI, ASQRTD,
-	"CMPF",		LTYPEL, ACMPF,
-	"CMPD",		LTYPEL, ACMPD,
-	"ADDF",		LTYPEK,	AADDF,
-	"ADDD",		LTYPEK,	AADDD,
-	"SUBF",		LTYPEK,	ASUBF,
-	"SUBD",		LTYPEK,	ASUBD,
-	"MULF",		LTYPEK,	AMULF,
-	"MULD",		LTYPEK,	AMULD,
-	"DIVF",		LTYPEK,	ADIVF,
-	"DIVD",		LTYPEK,	ADIVD,
-
-	"B",		LTYPE4, AB,
-	"BL",		LTYPE4, ABL,
-	"BX",		LTYPEBX,	ABX,
-
-	"BEQ",		LTYPE5,	ABEQ,
-	"BNE",		LTYPE5,	ABNE,
-	"BCS",		LTYPE5,	ABCS,
-	"BHS",		LTYPE5,	ABHS,
-	"BCC",		LTYPE5,	ABCC,
-	"BLO",		LTYPE5,	ABLO,
-	"BMI",		LTYPE5,	ABMI,
-	"BPL",		LTYPE5,	ABPL,
-	"BVS",		LTYPE5,	ABVS,
-	"BVC",		LTYPE5,	ABVC,
-	"BHI",		LTYPE5,	ABHI,
-	"BLS",		LTYPE5,	ABLS,
-	"BGE",		LTYPE5,	ABGE,
-	"BLT",		LTYPE5,	ABLT,
-	"BGT",		LTYPE5,	ABGT,
-	"BLE",		LTYPE5,	ABLE,
-	"BCASE",	LTYPE5,	ABCASE,
-
-	"SWI",		LTYPE6, ASWI,
-
-	"CMP",		LTYPE7,	ACMP,
-	"TST",		LTYPE7,	ATST,
-	"TEQ",		LTYPE7,	ATEQ,
-	"CMN",		LTYPE7,	ACMN,
-
-	"MOVM",		LTYPE8, AMOVM,
-
-	"SWPBU",	LTYPE9, ASWPBU,
-	"SWPW",		LTYPE9, ASWPW,
-
-	"RET",		LTYPEA, ARET,
-	"RFE",		LTYPEA, ARFE,
-
-	"TEXT",		LTYPEB, ATEXT,
-	"GLOBL",	LTYPEB, AGLOBL,
-	"DATA",		LTYPEC, ADATA,
-	"CASE",		LTYPED, ACASE,
-	"END",		LTYPEE, AEND,
-	"WORD",		LTYPEH, AWORD,
-	"NOP",		LTYPEI, ANOP,
-
-	"MCR",		LTYPEJ, 0,
-	"MRC",		LTYPEJ, 1,
-	0
-};
-
-void
-cinit(void)
-{
-	Sym *s;
-	int i;
-
-	nullgen.sym = S;
-	nullgen.offset = 0;
-	nullgen.type = D_NONE;
-	nullgen.name = D_NONE;
-	nullgen.reg = NREG;
-	if(FPCHIP)
-		nullgen.dval = 0;
-	for(i=0; i<sizeof(nullgen.sval); i++)
-		nullgen.sval[i] = 0;
-
-	nerrors = 0;
-	iostack = I;
-	iofree = I;
-	peekc = IGN;
-	nhunk = 0;
-	for(i=0; i<NHASH; i++)
-		hash[i] = S;
-	for(i=0; itab[i].name; i++) {
-		s = slookup(itab[i].name);
-		s->type = itab[i].type;
-		s->value = itab[i].value;
-	}
-
-	pathname = allocn(pathname, 0, 100);
-	if(getwd(pathname, 99) == 0) {
-		pathname = allocn(pathname, 100, 900);
-		if(getwd(pathname, 999) == 0)
-			strcpy(pathname, "/???");
-	}
-}
-
-void
-syminit(Sym *s)
-{
-
-	s->type = LNAME;
-	s->value = 0;
-}
-
-int
-isreg(Gen *g)
-{
-
-	USED(g);
-	return 1;
-}
-
-void
-cclean(void)
-{
-
-	outcode(AEND, Always, &nullgen, NREG, &nullgen);
-	Bflush(&obuf);
-}
-
-void
-zname(char *n, int t, int s)
-{
-
-	Bputc(&obuf, ANAME);
-	Bputc(&obuf, t);	/* type */
-	Bputc(&obuf, s);	/* sym */
-	while(*n) {
-		Bputc(&obuf, *n);
-		n++;
-	}
-	Bputc(&obuf, 0);
-}
-
-void
-zaddr(Gen *a, int s)
-{
-	int32_t l;
-	int i;
-	char *n;
-	Ieee e;
-
-	Bputc(&obuf, a->type);
-	Bputc(&obuf, a->reg);
-	Bputc(&obuf, s);
-	Bputc(&obuf, a->name);
-	switch(a->type) {
-	default:
-		print("unknown type %d\n", a->type);
-		exits("arg");
-
-	case D_NONE:
-	case D_REG:
-	case D_FREG:
-	case D_PSR:
-	case D_FPCR:
-		break;
-
-	case D_REGREG:
-		Bputc(&obuf, a->offset);
-		break;
-
-	case D_OREG:
-	case D_CONST:
-	case D_BRANCH:
-	case D_SHIFT:
-		l = a->offset;
-		Bputc(&obuf, l);
-		Bputc(&obuf, l>>8);
-		Bputc(&obuf, l>>16);
-		Bputc(&obuf, l>>24);
-		break;
-
-	case D_SCONST:
-		n = a->sval;
-		for(i=0; i<NSNAME; i++) {
-			Bputc(&obuf, *n);
-			n++;
-		}
-		break;
-
-	case D_FCONST:
-		ieeedtod(&e, a->dval);
-		Bputc(&obuf, e.l);
-		Bputc(&obuf, e.l>>8);
-		Bputc(&obuf, e.l>>16);
-		Bputc(&obuf, e.l>>24);
-		Bputc(&obuf, e.h);
-		Bputc(&obuf, e.h>>8);
-		Bputc(&obuf, e.h>>16);
-		Bputc(&obuf, e.h>>24);
-		break;
-	}
-}
-
-static int bcode[] =
-{
-	ABEQ,
-	ABNE,
-	ABCS,
-	ABCC,
-	ABMI,
-	ABPL,
-	ABVS,
-	ABVC,
-	ABHI,
-	ABLS,
-	ABGE,
-	ABLT,
-	ABGT,
-	ABLE,
-	AB,
-	ANOP,
-};
-
-void
-outcode(int a, int scond, Gen *g1, int reg, Gen *g2)
-{
-	int sf, st, t;
-	Sym *s;
-
-	/* hack to make B.NE etc. work: turn it into the corresponding conditional */
-	if(a == AB){
-		a = bcode[scond&0xf];
-		scond = (scond & ~0xf) | Always;
-	}
-
-	if(pass == 1)
-		goto out;
-jackpot:
-	sf = 0;
-	s = g1->sym;
-	while(s != S) {
-		sf = s->sym;
-		if(sf < 0 || sf >= NSYM)
-			sf = 0;
-		t = g1->name;
-		if(h[sf].type == t)
-		if(h[sf].sym == s)
-			break;
-		zname(s->name, t, sym);
-		s->sym = sym;
-		h[sym].sym = s;
-		h[sym].type = t;
-		sf = sym;
-		sym++;
-		if(sym >= NSYM)
-			sym = 1;
-		break;
-	}
-	st = 0;
-	s = g2->sym;
-	while(s != S) {
-		st = s->sym;
-		if(st < 0 || st >= NSYM)
-			st = 0;
-		t = g2->name;
-		if(h[st].type == t)
-		if(h[st].sym == s)
-			break;
-		zname(s->name, t, sym);
-		s->sym = sym;
-		h[sym].sym = s;
-		h[sym].type = t;
-		st = sym;
-		sym++;
-		if(sym >= NSYM)
-			sym = 1;
-		if(st == sf)
-			goto jackpot;
-		break;
-	}
-	Bputc(&obuf, a);
-	Bputc(&obuf, scond);
-	Bputc(&obuf, reg);
-	Bputc(&obuf, lineno);
-	Bputc(&obuf, lineno>>8);
-	Bputc(&obuf, lineno>>16);
-	Bputc(&obuf, lineno>>24);
-	zaddr(g1, sf);
-	zaddr(g2, st);
-
-out:
-	if(a != AGLOBL && a != ADATA)
-		pc++;
-}
-
-void
-outhist(void)
-{
-	Gen g;
-	Hist *h;
-	char *p, *q, *op, c;
-	int n;
-
-	g = nullgen;
-	c = pathchar();
-	for(h = hist; h != H; h = h->link) {
-		p = h->name;
-		op = 0;
-		/* on windows skip drive specifier in pathname */
-		if(systemtype(Windows) && p && p[1] == ':'){
-			p += 2;
-			c = *p;
-		}
-		if(p && p[0] != c && h->offset == 0 && pathname){
-			/* on windows skip drive specifier in pathname */
-			if(systemtype(Windows) && pathname[1] == ':') {
-				op = p;
-				p = pathname+2;
-				c = *p;
-			} else if(pathname[0] == c){
-				op = p;
-				p = pathname;
-			}
-		}
-		while(p) {
-			q = strchr(p, c);
-			if(q) {
-				n = q-p;
-				if(n == 0){
-					n = 1;	/* leading "/" */
-					*p = '/';	/* don't emit "\" on windows */
-				}
-				q++;
-			} else {
-				n = strlen(p);
-				q = 0;
-			}
-			if(n) {
-				Bputc(&obuf, ANAME);
-				Bputc(&obuf, D_FILE);	/* type */
-				Bputc(&obuf, 1);	/* sym */
-				Bputc(&obuf, '<');
-				Bwrite(&obuf, p, n);
-				Bputc(&obuf, 0);
-			}
-			p = q;
-			if(p == 0 && op) {
-				p = op;
-				op = 0;
-			}
-		}
-		g.offset = h->offset;
-
-		Bputc(&obuf, AHISTORY);
-		Bputc(&obuf, Always);
-		Bputc(&obuf, 0);
-		Bputc(&obuf, h->line);
-		Bputc(&obuf, h->line>>8);
-		Bputc(&obuf, h->line>>16);
-		Bputc(&obuf, h->line>>24);
-		zaddr(&nullgen, 0);
-		zaddr(&g, 0);
-	}
-}
-
-#include "../cc/lexbody"
-#include "../cc/macbody"
-#include "../cc/compat"

+ 0 - 19
sys/src/cmd/5a/mkfile

@@ -1,19 +0,0 @@
-</$objtype/mkfile
-
-TARG=5a
-OFILES=\
-	y.tab.$O\
-	lex.$O\
-
-HFILES=\
-	../5c/5.out.h\
-	y.tab.h\
-	a.h\
-
-YFILES=a.y\
-
-BIN=/$objtype/bin
-< /sys/src/cmd/mkone
-YFLAGS=-D1 -d
-
-lex.$O:	../cc/macbody ../cc/lexbody

+ 0 - 222
sys/src/cmd/5c/5.out.h

@@ -1,222 +0,0 @@
-/*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
-
-#define	NSNAME		8
-#define	NSYM		50
-#define	NREG		16
-
-#define NOPROF		(1<<0)
-#define DUPOK		(1<<1)
-#define	ALLTHUMBS	(1<<2)
-
-#define	REGRET		0
-#define	REGARG		0
-/* compiler allocates R1 up as temps */
-/* compiler allocates register variables R2 up */
-#define	REGMIN		2
-#define	REGMAX		8
-#define	REGEXT		10
-/* compiler allocates external registers R10 down */
-#define	REGTMP		11
-#define	REGSB		12
-#define	REGSP		13
-#define	REGLINK		14
-#define	REGPC		15
-
-#define	REGTMPT		7	/* used by the loader for thumb code */
-
-#define	NFREG		8
-#define	FREGRET		0
-#define	FREGEXT		7
-#define	FREGTMP		15
-/* compiler allocates register variables F0 up */
-/* compiler allocates external registers F7 down */
-
-enum	as
-{
-	AXXX,
-
-	AAND,
-	AEOR,
-	ASUB,
-	ARSB,
-	AADD,
-	AADC,
-	ASBC,
-	ARSC,
-	ATST,
-	ATEQ,
-	ACMP,
-	ACMN,
-	AORR,
-	ABIC,
-
-	AMVN,
-
-	AB,
-	ABL,
-
-/* 
- * Do not reorder or fragment the conditional branch 
- * opcodes, or the predication code will break 
- */ 
-	ABEQ,
-	ABNE,
-	ABCS,
-	ABHS,
-	ABCC,
-	ABLO,
-	ABMI,
-	ABPL,
-	ABVS,
-	ABVC,
-	ABHI,
-	ABLS,
-	ABGE,
-	ABLT,
-	ABGT,
-	ABLE,
-
-	AMOVWD,
-	AMOVWF,
-	AMOVDW,
-	AMOVFW,
-	AMOVFD,
-	AMOVDF,
-	AMOVF,
-	AMOVD,
-
-	ACMPF,
-	ACMPD,
-	AADDF,
-	AADDD,
-	ASUBF,
-	ASUBD,
-	AMULF,
-	AMULD,
-	ADIVF,
-	ADIVD,
-//	ASQRTF,
-//	ASQRTD,
-
-	ASRL,
-	ASRA,
-	ASLL,
-	AMULU,
-	ADIVU,
-	AMUL,
-	ADIV,
-	AMOD,
-	AMODU,
-
-	AMOVB,
-	AMOVBU,
-	AMOVH,
-	AMOVHU,
-	AMOVW,
-	AMOVM,
-	ASWPBU,
-	ASWPW,
-
-	ANOP,
-	ARFE,
-	ASWI,
-	AMULA,
-
-	ADATA,
-	AGLOBL,
-	AGOK,
-	AHISTORY,
-	ANAME,
-	ARET,
-	ATEXT,
-	AWORD,
-	ADYNT,
-	AINIT,
-	ABCASE,
-	ACASE,
-
-	AEND,
-
-	AMULL,
-	AMULAL,
-	AMULLU,
-	AMULALU,
-
-	ABX,
-	ABXRET,
-	ADWORD,
-
-	ASIGNAME,
-
-	/* moved here to preserve values of older identifiers */
-	ASQRTF,
-	ASQRTD,
-
-	ALDREX,
-	ASTREX,
-	
-	ALDREXD,
-	ASTREXD,
-
-	ALAST,
-};
-
-/* scond byte */
-#define	C_SCOND	((1<<4)-1)
-#define	C_SBIT	(1<<4)
-#define	C_PBIT	(1<<5)
-#define	C_WBIT	(1<<6)
-#define	C_FBIT	(1<<7)	/* psr flags-only */
-#define	C_UBIT	(1<<7)	/* up bit */
-
-/* type/name */
-#define	D_GOK	0
-#define	D_NONE	1
-
-/* type */
-#define	D_BRANCH	(D_NONE+1)
-#define	D_OREG		(D_NONE+2)
-#define	D_CONST		(D_NONE+7)
-#define	D_FCONST	(D_NONE+8)
-#define	D_SCONST	(D_NONE+9)
-#define	D_PSR		(D_NONE+10)
-#define	D_REG		(D_NONE+12)
-#define	D_FREG		(D_NONE+13)
-#define	D_FILE		(D_NONE+16)
-#define	D_OCONST	(D_NONE+17)
-#define	D_FILE1		(D_NONE+18)
-
-#define	D_SHIFT		(D_NONE+19)
-#define	D_FPCR		(D_NONE+20)
-#define	D_REGREG	(D_NONE+21)
-#define	D_ADDR		(D_NONE+22)
-
-/* name */
-#define	D_EXTERN	(D_NONE+3)
-#define	D_STATIC	(D_NONE+4)
-#define	D_AUTO		(D_NONE+5)
-#define	D_PARAM		(D_NONE+6)
-
-/*
- * this is the ranlib header
- */
-#define	SYMDEF	"__.SYMDEF"
-
-/*
- * this is the simulated IEEE floating point
- */
-typedef	struct	ieee	Ieee;
-struct	ieee
-{
-	long	l;	/* contains ls-man	0xffffffff */
-	long	h;	/* contains sign	0x80000000
-				    exp		0x7ff00000
-				    ms-man	0x000fffff */
-};

File diff suppressed because it is too large
+ 0 - 1177
sys/src/cmd/5c/cgen.c


+ 0 - 113
sys/src/cmd/5c/enam.c

@@ -1,113 +0,0 @@
-/*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
-
-char*	anames[] =
-{
-	"XXX",
-	"AND",
-	"EOR",
-	"SUB",
-	"RSB",
-	"ADD",
-	"ADC",
-	"SBC",
-	"RSC",
-	"TST",
-	"TEQ",
-	"CMP",
-	"CMN",
-	"ORR",
-	"BIC",
-	"MVN",
-	"B",
-	"BL",
-	"BEQ",
-	"BNE",
-	"BCS",
-	"BHS",
-	"BCC",
-	"BLO",
-	"BMI",
-	"BPL",
-	"BVS",
-	"BVC",
-	"BHI",
-	"BLS",
-	"BGE",
-	"BLT",
-	"BGT",
-	"BLE",
-	"MOVWD",
-	"MOVWF",
-	"MOVDW",
-	"MOVFW",
-	"MOVFD",
-	"MOVDF",
-	"MOVF",
-	"MOVD",
-	"CMPF",
-	"CMPD",
-	"ADDF",
-	"ADDD",
-	"SUBF",
-	"SUBD",
-	"MULF",
-	"MULD",
-	"DIVF",
-	"DIVD",
-	"SRL",
-	"SRA",
-	"SLL",
-	"MULU",
-	"DIVU",
-	"MUL",
-	"DIV",
-	"MOD",
-	"MODU",
-	"MOVB",
-	"MOVBU",
-	"MOVH",
-	"MOVHU",
-	"MOVW",
-	"MOVM",
-	"SWPBU",
-	"SWPW",
-	"NOP",
-	"RFE",
-	"SWI",
-	"MULA",
-	"DATA",
-	"GLOBL",
-	"GOK",
-	"HISTORY",
-	"NAME",
-	"RET",
-	"TEXT",
-	"WORD",
-	"DYNT",
-	"INIT",
-	"BCASE",
-	"CASE",
-	"END",
-	"MULL",
-	"MULAL",
-	"MULLU",
-	"MULALU",
-	"BX",
-	"BXRET",
-	"DWORD",
-	"SIGNAME",
-	"SQRTF",
-	"SQRTD",
-	"LDREX",
-	"STREX",
-	"LDREXD",
-	"STREXD",
-	"LAST",
-};

+ 0 - 361
sys/src/cmd/5c/gc.h

@@ -1,361 +0,0 @@
-/*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
-
-#include	"../cc/cc.h"
-#include	"../5c/5.out.h"
-
-/*
- * 5c/arm
- * Arm
- */
-#define	SZ_CHAR		1
-#define	SZ_SHORT	2
-#define	SZ_INT		4
-#define	SZ_LONG		4
-#define	SZ_IND		4
-#define	SZ_FLOAT	4
-#define	SZ_VLONG	8
-#define	SZ_DOUBLE	8
-#define	FNX		100
-#define	BTRUE		0x1000
-
-typedef	struct	Adr	Adr;
-typedef	struct	Prog	Prog;
-typedef	struct	Case	Case;
-typedef	struct	C1	C1;
-typedef	struct	Multab	Multab;
-typedef	struct	Hintab	Hintab;
-typedef	struct	Var	Var;
-typedef	struct	Reg	Reg;
-typedef	struct	Rgn	Rgn;
-
-
-#define	R0ISZERO	0
-
-struct	Adr
-{
-	long	offset;
-	double	dval;
-	char	sval[NSNAME];
-	Ieee	ieee;
-
-	Sym*	sym;
-	char	type;
-	char	reg;
-	char	name;
-	char	etype;
-};
-#define	A	((Adr*)0)
-
-#define	INDEXED	9
-struct	Prog
-{
-	Adr	from;
-	Adr	to;
-	Prog*	link;
-	long	lineno;
-	char	as;
-	char	reg;
-	uchar	scond;
-};
-#define	P	((Prog*)0)
-
-struct	Case
-{
-	Case*	link;
-	vlong	val;
-	long	label;
-	char	def;
-	char isv;
-};
-#define	C	((Case*)0)
-
-struct	C1
-{
-	vlong	val;
-	long	label;
-};
-
-struct	Multab
-{
-	long	val;
-	char	code[20];
-};
-
-struct	Hintab
-{
-	ushort	val;
-	char	hint[10];
-};
-
-struct	Var
-{
-	long	offset;
-	Sym*	sym;
-	char	name;
-	char	etype;
-};
-
-struct	Reg
-{
-	long	pc;
-	long	rpo;		/* reverse post ordering */
-
-	Bits	set;
-	Bits	use1;
-	Bits	use2;
-
-	Bits	refbehind;
-	Bits	refahead;
-	Bits	calbehind;
-	Bits	calahead;
-	Bits	regdiff;
-	Bits	act;
-
-	long	regu;
-	long	loop;		/* could be shorter */
-
-	
-	Reg*	log5;
-	long	active;
-
-	Reg*	p1;
-	Reg*	p2;
-	Reg*	p2link;
-	Reg*	s1;
-	Reg*	s2;
-	Reg*	link;
-	Prog*	prog;
-};
-#define	R	((Reg*)0)
-
-#define	NRGN	1000		/* was 600; raised for paranoia.c */
-struct	Rgn
-{
-	Reg*	enter;
-	short	cost;
-	short	varno;
-	short	regno;
-};
-
-EXTERN	long	breakpc;
-EXTERN	long	nbreak;
-EXTERN	Case*	cases;
-EXTERN	Node	constnode;
-EXTERN	Node	fconstnode;
-EXTERN	long	continpc;
-EXTERN	long	curarg;
-EXTERN	long	cursafe;
-EXTERN	Prog*	firstp;
-EXTERN	Prog*	lastp;
-EXTERN	long	maxargsafe;
-EXTERN	int	mnstring;
-EXTERN	Multab	multab[20];
-EXTERN	int	hintabsize;
-EXTERN	Node*	nodrat;
-EXTERN	Node*	nodret;
-EXTERN	Node*	nodsafe;
-EXTERN	long	nrathole;
-EXTERN	long	nstring;
-EXTERN	Prog*	p;
-EXTERN	long	pc;
-EXTERN	Node	regnode;
-EXTERN	char	string[NSNAME];
-EXTERN	Sym*	symrathole;
-EXTERN	Node	znode;
-EXTERN	Prog	zprog;
-EXTERN	char	reg[NREG+NFREG];
-EXTERN	long	exregoffset;
-EXTERN	long	exfregoffset;
-EXTERN	int	suppress;
-
-#define	BLOAD(r)	band(bnot(r->refbehind), r->refahead)
-#define	BSTORE(r)	band(bnot(r->calbehind), r->calahead)
-#define	LOAD(r)		(~r->refbehind.b[z] & r->refahead.b[z])
-#define	STORE(r)	(~r->calbehind.b[z] & r->calahead.b[z])
-
-#define	bset(a,n)	((a).b[(n)/32]&(1L<<(n)%32))
-
-#define	CLOAD	4
-#define	CREF	5
-#define	CINF	1000
-#define	LOOP	3
-
-EXTERN	Rgn	region[NRGN];
-EXTERN	Rgn*	rgp;
-EXTERN	int	nregion;
-EXTERN	int	nvar;
-
-EXTERN	Bits	externs;
-EXTERN	Bits	params;
-EXTERN	Bits	consts;
-EXTERN	Bits	addrs;
-
-EXTERN	long	regbits;
-EXTERN	long	exregbits;
-
-EXTERN	int	change;
-
-EXTERN	Reg*	firstr;
-EXTERN	Reg*	lastr;
-EXTERN	Reg	zreg;
-EXTERN	Reg*	freer;
-EXTERN	Var	var[NVAR];
-EXTERN	long*	idom;
-EXTERN	Reg**	rpo2r;
-EXTERN	long	maxnr;
-
-extern	char*	anames[];
-extern	Hintab	hintab[];
-
-/*
- * sgen.c
- */
-void	codgen(Node*, Node*);
-void	gen(Node*);
-void	noretval(int);
-void	usedset(Node*, int);
-void	xcom(Node*);
-int	bcomplex(Node*, Node*);
-
-/*
- * cgen.c
- */
-void	cgen(Node*, Node*);
-void	cgenrel(Node*, Node*, int);
-void	reglcgen(Node*, Node*, Node*);
-void	lcgen(Node*, Node*);
-void	bcgen(Node*, int);
-void	boolgen(Node*, int, Node*);
-void	sugen(Node*, Node*, long);
-void	layout(Node*, Node*, int, int, Node*);
-
-/*
- * txt.c
- */
-void	ginit(void);
-void	gclean(void);
-void	nextpc(void);
-void	gargs(Node*, Node*, Node*);
-void	garg1(Node*, Node*, Node*, int, Node**);
-Node*	nodconst(long);
-Node*	nod32const(vlong);
-Node*	nodfconst(double);
-void	nodreg(Node*, Node*, int);
-void	regret(Node*, Node*);
-int	tmpreg(void);
-void	regalloc(Node*, Node*, Node*);
-void	regfree(Node*);
-void	regialloc(Node*, Node*, Node*);
-void	regsalloc(Node*, Node*);
-void	regaalloc1(Node*, Node*);
-void	regaalloc(Node*, Node*);
-void	regind(Node*, Node*);
-void	gprep(Node*, Node*);
-void	raddr(Node*, Prog*);
-void	naddr(Node*, Adr*);
-void	gmovm(Node*, Node*, int);
-void	gmove(Node*, Node*);
-void	gmover(Node*, Node*);
-void	gins(int a, Node*, Node*);
-void	gopcode(int, Node*, Node*, Node*);
-int	samaddr(Node*, Node*);
-void	gbranch(int);
-void	patch(Prog*, long);
-int	sconst(Node*);
-int	sval(long);
-void	gpseudo(int, Sym*, Node*);
-
-/*
- * swt.c
- */
-int	swcmp(const void*, const void*);
-void	doswit(Node*);
-void	swit1(C1*, int, long, Node*);
-void	swit2(C1*, int, long, Node*, Node*);
-void	casf(void);
-void	bitload(Node*, Node*, Node*, Node*, Node*);
-void	bitstore(Node*, Node*, Node*, Node*, Node*);
-long	outstring(char*, long);
-int	mulcon(Node*, Node*);
-Multab*	mulcon0(long);
-void	nullwarn(Node*, Node*);
-void	gextern(Sym*, Node*, long, long);
-void	outcode(void);
-void	ieeedtod(Ieee*, double);
-
-/*
- * list
- */
-void	listinit(void);
-int	Pconv(Fmt*);
-int	Aconv(Fmt*);
-int	Dconv(Fmt*);
-int	Sconv(Fmt*);
-int	Nconv(Fmt*);
-int	Bconv(Fmt*);
-int	Rconv(Fmt*);
-
-/*
- * reg.c
- */
-Reg*	rega(void);
-int	rcmp(const void*, const void*);
-void	regopt(Prog*);
-void	addmove(Reg*, int, int, int);
-Bits	mkvar(Adr*, int);
-void	prop(Reg*, Bits, Bits);
-void	loopit(Reg*, long);
-void	synch(Reg*, Bits);
-uint32_t	allreg(uint32_t, Rgn*);
-void	paint1(Reg*, int);
-uint32_t	paint2(Reg*, int);
-void	paint3(Reg*, int, long, int);
-void	addreg(Adr*, int);
-
-/*
- * peep.c
- */
-void	peep(void);
-void	excise(Reg*);
-Reg*	uniqp(Reg*);
-Reg*	uniqs(Reg*);
-int	regtyp(Adr*);
-int	regzer(Adr*);
-int	anyvar(Adr*);
-int	subprop(Reg*);
-int	copyprop(Reg*);
-int	shiftprop(Reg*);
-void	constprop(Adr*, Adr*, Reg*);
-int	copy1(Adr*, Adr*, Reg*, int);
-int	copyu(Prog*, Adr*, Adr*);
-
-int	copyas(Adr*, Adr*);
-int	copyau(Adr*, Adr*);
-int	copyau1(Prog*, Adr*);
-int	copysub(Adr*, Adr*, Adr*, int);
-int	copysub1(Prog*, Adr*, Adr*, int);
-
-long	RtoB(int);
-long	FtoB(int);
-int	BtoR(long);
-int	BtoF(long);
-
-void	predicate(void); 
-int	isbranch(Prog *); 
-int	predicable(Prog *p); 
-int	modifiescpsr(Prog *p); 
-
-#pragma	varargck	type	"A"	int
-#pragma	varargck	type	"B"	Bits
-#pragma	varargck	type	"D"	Adr*
-#pragma	varargck	type	"N"	Adr*
-#pragma	varargck	type	"R"	Adr*
-#pragma	varargck	type	"P"	Prog*
-#pragma	varargck	type	"S"	char*

+ 0 - 313
sys/src/cmd/5c/list.c

@@ -1,313 +0,0 @@
-/*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
-
-#define	EXTERN
-#include "gc.h"
-
-void
-listinit(void)
-{
-
-	fmtinstall('A', Aconv);
-	fmtinstall('P', Pconv);
-	fmtinstall('S', Sconv);
-	fmtinstall('N', Nconv);
-	fmtinstall('B', Bconv);
-	fmtinstall('D', Dconv);
-	fmtinstall('R', Rconv);
-}
-
-int
-Bconv(Fmt *fp)
-{
-	char str[STRINGSZ], ss[STRINGSZ], *s;
-	Bits bits;
-	int i;
-
-	str[0] = 0;
-	bits = va_arg(fp->args, Bits);
-	while(bany(&bits)) {
-		i = bnum(bits);
-		if(str[0])
-			strcat(str, " ");
-		if(var[i].sym == S) {
-			snprint(ss, sizeof(ss), "$%ld", var[i].offset);
-			s = ss;
-		} else
-			s = var[i].sym->name;
-		if(strlen(str) + strlen(s) + 1 >= STRINGSZ)
-			break;
-		strcat(str, s);
-		bits.b[i/32] &= ~(1L << (i%32));
-	}
-	return fmtstrcpy(fp, str);
-}
-
-char *extra [] = {
-	".EQ", ".NE", ".CS", ".CC", 
-	".MI", ".PL", ".VS", ".VC", 
-	".HI", ".LS", ".GE", ".LT", 
-	".GT", ".LE", "", ".NV",
-};
-
-int
-Pconv(Fmt *fp)
-{
-	char str[STRINGSZ], sc[20];
-	Prog *p;
-	int a, s;
-
-	p = va_arg(fp->args, Prog*);
-	a = p->as;
-	s = p->scond; 
-	strcpy(sc, extra[s & C_SCOND]);
-	if(s & C_SBIT)
-		strcat(sc, ".S");
-	if(s & C_PBIT)
-		strcat(sc, ".P");
-	if(s & C_WBIT)
-		strcat(sc, ".W");
-	if(s & C_UBIT)		/* ambiguous with FBIT */
-		strcat(sc, ".U");
-	if(a == AMOVM) {
-		if(p->from.type == D_CONST)
-			snprint(str, sizeof(str), "	%A%s	%R,%D", a, sc, &p->from, &p->to);
-		else
-		if(p->to.type == D_CONST)
-			snprint(str, sizeof(str), "	%A%s	%D,%R", a, sc, &p->from, &p->to);
-		else
-			snprint(str, sizeof(str), "	%A%s	%D,%D", a, sc, &p->from, &p->to);
-	} else
-	if(a == ADATA)
-		snprint(str, sizeof(str), "	%A	%D/%d,%D", a, &p->from, p->reg, &p->to);
-	else
-	if(p->as == ATEXT)
-		snprint(str, sizeof(str), "	%A	%D,%d,%D", a, &p->from, p->reg, &p->to);
-	else
-	if(p->reg == NREG)
-		snprint(str, sizeof(str), "	%A%s	%D,%D", a, sc, &p->from, &p->to);
-	else
-	if(p->from.type != D_FREG)
-		snprint(str, sizeof(str), "	%A%s	%D,R%d,%D", a, sc, &p->from, p->reg, &p->to);
-	else
-		snprint(str, sizeof(str), "	%A%s	%D,F%d,%D", a, sc, &p->from, p->reg, &p->to);
-	return fmtstrcpy(fp, str);
-}
-
-int
-Aconv(Fmt *fp)
-{
-	char *s;
-	int a;
-
-	a = va_arg(fp->args, int);
-	s = "???";
-	if(a >= AXXX && a < ALAST)
-		s = anames[a];
-	return fmtstrcpy(fp, s);
-}
-
-int
-Dconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Adr *a;
-	char *op;
-	int v;
-
-	a = va_arg(fp->args, Adr*);
-	switch(a->type) {
-
-	default:
-		snprint(str, sizeof(str), "GOK-type(%d)", a->type);
-		break;
-
-	case D_NONE:
-		str[0] = 0;
-		if(a->name != D_NONE || a->reg != NREG || a->sym != S)
-			snprint(str, sizeof(str), "%N(R%d)(NONE)", a, a->reg);
-		break;
-
-	case D_CONST:
-		if(a->reg != NREG)
-			snprint(str, sizeof(str), "$%N(R%d)", a, a->reg);
-		else
-			snprint(str, sizeof(str), "$%N", a);
-		break;
-
-	case D_SHIFT:
-		v = a->offset;
-		op = "<<>>->@>" + (((v>>5) & 3) << 1);
-		if(v & (1<<4))
-			snprint(str, sizeof(str), "R%d%c%cR%d", v&15, op[0], op[1], (v>>8)&15);
-		else
-			snprint(str, sizeof(str), "R%d%c%c%d", v&15, op[0], op[1], (v>>7)&31);
-		if(a->reg != NREG)
-			sprint(str+strlen(str), "(R%d)", a->reg);
-		break;
-
-	case D_OREG:
-		if(a->reg != NREG)
-			snprint(str, sizeof(str), "%N(R%d)", a, a->reg);
-		else
-			snprint(str, sizeof(str), "%N", a);
-		break;
-
-	case D_REG:
-		snprint(str, sizeof(str), "R%d", a->reg);
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof(str), "%N(R%d)(REG)", a, a->reg);
-		break;
-
-	case D_FREG:
-		snprint(str, sizeof(str), "F%d", a->reg);
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof(str), "%N(R%d)(REG)", a, a->reg);
-		break;
-
-	case D_PSR:
-		snprint(str, sizeof(str), "PSR");
-		if(a->name != D_NONE || a->sym != S)
-			snprint(str, sizeof(str), "%N(PSR)(REG)", a);
-		break;
-
-	case D_BRANCH:
-		snprint(str, sizeof(str), "%ld(PC)", a->offset-pc);
-		break;
-
-	case D_FCONST:
-		snprint(str, sizeof(str), "$%.17e", a->dval);
-		break;
-
-	case D_SCONST:
-		snprint(str, sizeof(str), "$\"%S\"", a->sval);
-		break;
-	}
-	return fmtstrcpy(fp, str);
-}
-
-int
-Rconv(Fmt *fp)
-{
-	char str[STRINGSZ], *p, *e;
-	Adr *a;
-	int i, v;
-
-	a = va_arg(fp->args, Adr*);
-	snprint(str, sizeof(str), "GOK-reglist");
-	switch(a->type) {
-	case D_CONST:
-		if(a->reg != NREG)
-			break;
-		if(a->sym != S)
-			break;
-		v = a->offset;
-		p = str;
-		e = str+sizeof(str);
-		for(i=0; i<NREG; i++) {
-			if(v & (1<<i)) {
-				if(p == str)
-					p = seprint(p, e, "[R%d", i);
-				else
-					p = seprint(p, e, ",R%d", i);
-			}
-		}
-		seprint(p, e, "]");
-	}
-	return fmtstrcpy(fp, str);
-}
-
-int
-Sconv(Fmt *fp)
-{
-	int i, c;
-	char str[STRINGSZ], *p, *a;
-
-	a = va_arg(fp->args, char*);
-	p = str;
-	for(i=0; i<NSNAME; i++) {
-		c = a[i] & 0xff;
-		if(c >= 'a' && c <= 'z' ||
-		   c >= 'A' && c <= 'Z' ||
-		   c >= '0' && c <= '9' ||
-		   c == ' ' || c == '%') {
-			*p++ = c;
-			continue;
-		}
-		*p++ = '\\';
-		switch(c) {
-		case 0:
-			*p++ = 'z';
-			continue;
-		case '\\':
-		case '"':
-			*p++ = c;
-			continue;
-		case '\n':
-			*p++ = 'n';
-			continue;
-		case '\t':
-			*p++ = 't';
-			continue;
-		case '\r':
-			*p++ = 'r';
-			continue;
-		case '\f':
-			*p++ = 'f';
-			continue;
-		}
-		*p++ = (c>>6) + '0';
-		*p++ = ((c>>3) & 7) + '0';
-		*p++ = (c & 7) + '0';
-	}
-	*p = 0;
-	return fmtstrcpy(fp, str);
-}
-
-int
-Nconv(Fmt *fp)
-{
-	char str[STRINGSZ];
-	Adr *a;
-	Sym *s;
-
-	a = va_arg(fp->args, Adr*);
-	s = a->sym;
-	if(s == S) {
-		snprint(str, sizeof(str), "%ld", a->offset);
-		goto out;
-	}
-	switch(a->name) {
-	default:
-		snprint(str, sizeof(str), "GOK-name(%d)", a->name);
-		break;
-
-	case D_NONE:
-		snprint(str, sizeof(str), "%ld", a->offset);
-		break;
-
-	case D_EXTERN:
-		snprint(str, sizeof(str), "%s+%ld(SB)", s->name, a->offset);
-		break;
-
-	case D_STATIC:
-		snprint(str, sizeof(str), "%s<>+%ld(SB)", s->name, a->offset);
-		break;
-
-	case D_AUTO:
-		snprint(str, sizeof(str), "%s-%ld(SP)", s->name, -a->offset);
-		break;
-
-	case D_PARAM:
-		snprint(str, sizeof(str), "%s+%ld(FP)", s->name, a->offset);
-		break;
-	}
-out:
-	return fmtstrcpy(fp, str);
-}

+ 0 - 15
sys/src/cmd/5c/mkenam

@@ -1,15 +0,0 @@
-ed - ../5c/5.out.h <<'!'
-v/^	A/d
-,s/^	A/	"/
-g/ .*$/s///
-,s/,*$/",/
-1i
-char*	anames[] =
-{
-.
-$a
-};
-.
-w enam.c
-Q
-!

+ 0 - 41
sys/src/cmd/5c/mkfile

@@ -1,41 +0,0 @@
-</$objtype/mkfile
-
-TARG=5c
-OFILES=\
-	cgen.$O\
-	enam.$O\
-	list.$O\
-	mul.$O\
-	peep.$O\
-	pgen.$O\
-	pswt.$O\
-	reg.$O\
-	sgen.$O\
-	swt.$O\
-	txt.$O\
-
-HFILES=\
-	gc.h\
-	5.out.h\
-	../cc/cc.h\
-
-LIB=../cc/cc.a$O
-
-BIN=/$objtype/bin
-</sys/src/cmd/mkone
-
-$LIB:
-	cd ../cc
-	mk install
-	mk clean
-
-%.$O: ../cc/%.c
-	$CC $CFLAGS ../cc/$stem.c
-
-t:V:	$O.out
-	$O.out -S t
-	$LD -o t.out t.$O
-	t.out
-
-enam.c: 5.out.h
-	rc mkenam

+ 0 - 618
sys/src/cmd/5c/mul.c

@@ -1,618 +0,0 @@
-/*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
-
-#include "gc.h"
-
-/*
- * code sequences for multiply by constant.
- * [a-l][0-3]
- *	lsl	$(A-'a'),r0,r1
- * [+][0-7]
- *	add	r0,r1,r2
- * [-][0-7]
- *	sub	r0,r1,r2
- */
-
-static  int	maxmulops = 3;	/* max # of ops to replace mul with */
-static	int	multabp;
-static	int32_t	mulval;
-static	char*	mulcp;
-static	int32_t	valmax;
-static	int	shmax;
-
-static int	docode(char *hp, char *cp, int r0, int r1);
-static int	gen1(int len);
-static int	gen2(int len, int32_t r1);
-static int	gen3(int len, int32_t r0, int32_t r1, int flag);
-enum
-{
-	SR1	= 1<<0,		/* r1 has been shifted */
-	SR0	= 1<<1,		/* r0 has been shifted */
-	UR1	= 1<<2,		/* r1 has not been used */
-	UR0	= 1<<3,		/* r0 has not been used */
-};
-
-Multab*
-mulcon0(int32_t v)
-{
-	int a1, a2, g;
-	Multab *m, *m1;
-	char hint[10];
-
-	if(v < 0)
-		v = -v;
-
-	/*
-	 * look in cache
-	 */
-	m = multab;
-	for(g=0; g<nelem(multab); g++) {
-		if(m->val == v) {
-			if(m->code[0] == 0)
-				return 0;
-			return m;
-		}
-		m++;
-	}
-
-	/*
-	 * select a spot in cache to overwrite
-	 */
-	multabp++;
-	if(multabp < 0 || multabp >= nelem(multab))
-		multabp = 0;
-	m = multab+multabp;
-	m->val = v;
-	mulval = v;
-
-	/*
-	 * look in execption hint table
-	 */
-	a1 = 0;
-	a2 = hintabsize;
-	for(;;) {
-		if(a1 >= a2)
-			goto no;
-		g = (a2 + a1)/2;
-		if(v < hintab[g].val) {
-			a2 = g;
-			continue;
-		}
-		if(v > hintab[g].val) {
-			a1 = g+1;
-			continue;
-		}
-		break;
-	}
-
-	if(docode(hintab[g].hint, m->code, 1, 0))
-		return m;
-	print("multiply table failure %ld\n", v);
-	m->code[0] = 0;
-	return 0;
-
-no:
-	/*
-	 * try to search
-	 */
-	hint[0] = 0;
-	for(g=1; g<=maxmulops; g++) {
-		if(g >= maxmulops && v >= 65535)
-			break;
-		mulcp = hint+g;
-		*mulcp = 0;
-		if(gen1(g)) {
-			if(docode(hint, m->code, 1, 0))
-				return m;
-			print("multiply table failure %ld\n", v);
-			break;
-		}
-	}
-
-	/*
-	 * try a recur followed by a shift
-	 */
-	g = 0;
-	while(!(v & 1)) {
-		g++;
-		v >>= 1;
-	}
-	if(g) {
-		m1 = mulcon0(v);
-		if(m1) {
-			strcpy(m->code, m1->code);
-			sprint(strchr(m->code, 0), "%c0", g+'a');
-			return m;
-		}
-	}
-	m->code[0] = 0;
-	return 0;
-}
-
-static int
-docode(char *hp, char *cp, int r0, int r1)
-{
-	int c, i;
-
-	c = *hp++;
-	*cp = c;
-	cp += 2;
-	switch(c) {
-	default:
-		c -= 'a';
-		if(c < 1 || c >= 30)
-			break;
-		for(i=0; i<4; i++) {
-			switch(i) {
-			case 0:
-				if(docode(hp, cp, r0<<c, r1))
-					goto out;
-				break;
-			case 1:
-				if(docode(hp, cp, r1<<c, r1))
-					goto out;
-				break;
-			case 2:
-				if(docode(hp, cp, r0, r0<<c))
-					goto out;
-				break;
-			case 3:
-				if(docode(hp, cp, r0, r1<<c))
-					goto out;
-				break;
-			}
-		}
-		break;
-
-	case '+':
-		for(i=0; i<8; i++) {
-			cp[-1] = i+'0';
-			switch(i) {
-			case 1:
-				if(docode(hp, cp, r0+r1, r1))
-					goto out;
-				break;
-			case 5:
-				if(docode(hp, cp, r0, r0+r1))
-					goto out;
-				break;
-			}
-		}
-		break;
-
-	case '-':
-		for(i=0; i<8; i++) {
-			cp[-1] = i+'0';
-			switch(i) {
-			case 1:
-				if(docode(hp, cp, r0-r1, r1))
-					goto out;
-				break;
-			case 2:
-				if(docode(hp, cp, r1-r0, r1))
-					goto out;
-				break;
-			case 5:
-				if(docode(hp, cp, r0, r0-r1))
-					goto out;
-				break;
-			case 6:
-				if(docode(hp, cp, r0, r1-r0))
-					goto out;
-				break;
-			}
-		}
-		break;
-
-	case 0:
-		if(r0 == mulval)
-			return 1;
-	}
-	return 0;
-
-out:
-	cp[-1] = i+'0';
-	return 1;
-}
-
-static int
-gen1(int len)
-{
-	int i;
-
-	for(shmax=1; shmax<30; shmax++) {
-		valmax = 1<<shmax;
-		if(valmax >= mulval)
-			break;
-	}
-	if(mulval == 1)
-		return 1;
-
-	len--;
-	for(i=1; i<=shmax; i++)
-		if(gen2(len, 1<<i)) {
-			*--mulcp = 'a'+i;
-			return 1;
-		}
-	return 0;
-}
-
-static int
-gen2(int len, int32_t r1)
-{
-	int i;
-
-	if(len <= 0) {