1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:46:47 -07:00

cmd/6a, cmd/6l: make FUNCDATA work

R=ken2
CC=golang-dev
https://golang.org/cl/11397043
This commit is contained in:
Russ Cox 2013-07-18 15:38:19 -04:00
parent b6f841733b
commit 8c741c97f7
12 changed files with 1905 additions and 1783 deletions

View File

@ -50,11 +50,11 @@
%left '*' '/' '%'
%token <lval> LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5
%token <lval> LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA
%token <lval> LTYPEB LTYPEC LTYPED LTYPEE LTYPEF
%token <lval> LTYPEB LTYPEC LTYPED LTYPEE
%token <lval> LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK
%token <lval> LTYPEL LTYPEM LTYPEN LTYPEBX LTYPEPLD
%token <lval> LCONST LSP LSB LFP LPC
%token <lval> LTYPEX LTYPEPC LR LREG LF LFREG LC LCREG LPSR LFCR
%token <lval> LTYPEX LTYPEPC LTYPEF LR LREG LF LFREG LC LCREG LPSR LFCR
%token <lval> LCOND LS LAT
%token <dval> LFCONST
%token <sval> LSCONST
@ -322,10 +322,23 @@ inst:
/*
* PCDATA
*/
| LTYPEPC imm ',' imm
| LTYPEPC gen ',' gen
{
if($2.type != D_CONST || $4.type != D_CONST)
yyerror("arguments to PCDATA must be integer constants");
outcode($1, Always, &$2, NREG, &$4);
}
/*
* FUNCDATA
*/
| LTYPEF gen ',' gen
{
if($2.type != D_CONST)
yyerror("index for FUNCDATA must be integer constant");
if($4.type != D_EXTERN && $4.type != D_STATIC)
yyerror("value for FUNCDATA must be symbol reference");
outcode($1, Always, &$2, NREG, &$4);
}
/*
* END
*/

View File

@ -415,6 +415,7 @@ struct
"USEFIELD", LTYPEN, AUSEFIELD,
"PCDATA", LTYPEPC, APCDATA,
"FUNCDATA", LTYPEF, AFUNCDATA,
0
};

File diff suppressed because it is too large Load Diff

View File

@ -53,24 +53,24 @@
LTYPEC = 269,
LTYPED = 270,
LTYPEE = 271,
LTYPEF = 272,
LTYPEG = 273,
LTYPEH = 274,
LTYPEI = 275,
LTYPEJ = 276,
LTYPEK = 277,
LTYPEL = 278,
LTYPEM = 279,
LTYPEN = 280,
LTYPEBX = 281,
LTYPEPLD = 282,
LCONST = 283,
LSP = 284,
LSB = 285,
LFP = 286,
LPC = 287,
LTYPEX = 288,
LTYPEPC = 289,
LTYPEG = 272,
LTYPEH = 273,
LTYPEI = 274,
LTYPEJ = 275,
LTYPEK = 276,
LTYPEL = 277,
LTYPEM = 278,
LTYPEN = 279,
LTYPEBX = 280,
LTYPEPLD = 281,
LCONST = 282,
LSP = 283,
LSB = 284,
LFP = 285,
LPC = 286,
LTYPEX = 287,
LTYPEPC = 288,
LTYPEF = 289,
LR = 290,
LREG = 291,
LF = 292,
@ -104,24 +104,24 @@
#define LTYPEC 269
#define LTYPED 270
#define LTYPEE 271
#define LTYPEF 272
#define LTYPEG 273
#define LTYPEH 274
#define LTYPEI 275
#define LTYPEJ 276
#define LTYPEK 277
#define LTYPEL 278
#define LTYPEM 279
#define LTYPEN 280
#define LTYPEBX 281
#define LTYPEPLD 282
#define LCONST 283
#define LSP 284
#define LSB 285
#define LFP 286
#define LPC 287
#define LTYPEX 288
#define LTYPEPC 289
#define LTYPEG 272
#define LTYPEH 273
#define LTYPEI 274
#define LTYPEJ 275
#define LTYPEK 276
#define LTYPEL 277
#define LTYPEM 278
#define LTYPEN 279
#define LTYPEBX 280
#define LTYPEPLD 281
#define LCONST 282
#define LSP 283
#define LSB 284
#define LFP 285
#define LPC 286
#define LTYPEX 287
#define LTYPEPC 288
#define LTYPEF 289
#define LR 290
#define LREG 291
#define LF 292

View File

@ -50,7 +50,7 @@
%left '*' '/' '%'
%token <lval> LTYPE0 LTYPE1 LTYPE2 LTYPE3 LTYPE4
%token <lval> LTYPEC LTYPED LTYPEN LTYPER LTYPET LTYPEG LTYPEPC
%token <lval> LTYPES LTYPEM LTYPEI LTYPEXC LTYPEX LTYPERT
%token <lval> LTYPES LTYPEM LTYPEI LTYPEXC LTYPEX LTYPERT LTYPEF
%token <lval> LCONST LFP LPC LSB
%token <lval> LBREG LLREG LSREG LFREG LMREG LXREG
%token <dval> LFCONST
@ -58,8 +58,9 @@
%token <sym> LNAME LLAB LVAR
%type <lval> con con2 expr pointer offset
%type <gen> mem imm imm2 reg nam rel rem rim rom omem nmem
%type <gen2> nonnon nonrel nonrem rimnon rimrem remrim spec10 spec11 spec12
%type <gen2> nonnon nonrel nonrem rimnon rimrem remrim
%type <gen2> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9
%type <gen2> spec10 spec11 spec12 spec13
%%
prog:
| prog
@ -116,6 +117,7 @@ inst:
| LTYPERT spec10 { outcode($1, &$2); }
| LTYPEG spec11 { outcode($1, &$2); }
| LTYPEPC spec12 { outcode($1, &$2); }
| LTYPEF spec13 { outcode($1, &$2); }
nonnon:
{
@ -310,8 +312,21 @@ spec11: /* GLOBL */
}
spec12: /* PCDATA */
imm ',' imm
rim ',' rim
{
if($1.type != D_CONST || $3.type != D_CONST)
yyerror("arguments to PCDATA must be integer constants");
$$.from = $1;
$$.to = $3;
}
spec13: /* FUNCDATA */
rim ',' rim
{
if($1.type != D_CONST)
yyerror("index for FUNCDATA must be integer constant");
if($3.type != D_EXTERN && $3.type != D_STATIC)
yyerror("value for FUNCDATA must be symbol reference");
$$.from = $1;
$$.to = $3;
}

View File

@ -1021,6 +1021,7 @@ struct
"USEFIELD", LTYPEN, AUSEFIELD,
"PCLMULQDQ", LTYPEX, APCLMULQDQ,
"PCDATA", LTYPEPC, APCDATA,
"FUNCDATA", LTYPEF, AFUNCDATA,
0
};

File diff suppressed because it is too large Load Diff

View File

@ -57,22 +57,23 @@
LTYPEXC = 273,
LTYPEX = 274,
LTYPERT = 275,
LCONST = 276,
LFP = 277,
LPC = 278,
LSB = 279,
LBREG = 280,
LLREG = 281,
LSREG = 282,
LFREG = 283,
LMREG = 284,
LXREG = 285,
LFCONST = 286,
LSCONST = 287,
LSP = 288,
LNAME = 289,
LLAB = 290,
LVAR = 291
LTYPEF = 276,
LCONST = 277,
LFP = 278,
LPC = 279,
LSB = 280,
LBREG = 281,
LLREG = 282,
LSREG = 283,
LFREG = 284,
LMREG = 285,
LXREG = 286,
LFCONST = 287,
LSCONST = 288,
LSP = 289,
LNAME = 290,
LLAB = 291,
LVAR = 292
};
#endif
/* Tokens. */
@ -94,22 +95,23 @@
#define LTYPEXC 273
#define LTYPEX 274
#define LTYPERT 275
#define LCONST 276
#define LFP 277
#define LPC 278
#define LSB 279
#define LBREG 280
#define LLREG 281
#define LSREG 282
#define LFREG 283
#define LMREG 284
#define LXREG 285
#define LFCONST 286
#define LSCONST 287
#define LSP 288
#define LNAME 289
#define LLAB 290
#define LVAR 291
#define LTYPEF 276
#define LCONST 277
#define LFP 278
#define LPC 279
#define LSB 280
#define LBREG 281
#define LLREG 282
#define LSREG 283
#define LFREG 284
#define LMREG 285
#define LXREG 286
#define LFCONST 287
#define LSCONST 288
#define LSP 289
#define LNAME 290
#define LLAB 291
#define LVAR 292
@ -126,7 +128,7 @@ typedef union YYSTYPE
Gen2 gen2;
}
/* Line 1529 of yacc.c. */
#line 130 "y.tab.h"
#line 132 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

View File

@ -54,7 +54,7 @@
%left '*' '/' '%'
%token <lval> LTYPE0 LTYPE1 LTYPE2 LTYPE3 LTYPE4
%token <lval> LTYPEC LTYPED LTYPEN LTYPER LTYPET LTYPES LTYPEM LTYPEI LTYPEG LTYPEXC
%token <lval> LTYPEX LTYPEPC LCONST LFP LPC LSB
%token <lval> LTYPEX LTYPEPC LTYPEF LCONST LFP LPC LSB
%token <lval> LBREG LLREG LSREG LFREG LXREG
%token <dval> LFCONST
%token <sval> LSCONST LSP
@ -63,7 +63,7 @@
%type <con2> con2
%type <gen> mem imm imm2 reg nam rel rem rim rom omem nmem
%type <gen2> nonnon nonrel nonrem rimnon rimrem remrim
%type <gen2> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9 spec10 spec11
%type <gen2> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9 spec10 spec11 spec12
%%
prog:
| prog
@ -119,6 +119,7 @@ inst:
| LTYPEXC spec9 { outcode($1, &$2); }
| LTYPEX spec10 { outcode($1, &$2); }
| LTYPEPC spec11 { outcode($1, &$2); }
| LTYPEF spec12 { outcode($1, &$2); }
nonnon:
{
@ -309,12 +310,25 @@ spec10: /* PINSRD */
}
spec11: /* PCDATA */
imm ',' imm
rim ',' rim
{
if($1.type != D_CONST || $3.type != D_CONST)
yyerror("arguments to PCDATA must be integer constants");
$$.from = $1;
$$.to = $3;
}
spec12: /* FUNCDATA */
rim ',' rim
{
if($1.type != D_CONST)
yyerror("index for FUNCDATA must be integer constant");
if($3.type != D_EXTERN && $3.type != D_STATIC)
yyerror("value for FUNCDATA must be symbol reference");
$$.from = $1;
$$.to = $3;
}
rem:
reg
| mem

View File

@ -800,6 +800,7 @@ struct
"XORPS", LTYPE3, AXORPS,
"USEFIELD", LTYPEN, AUSEFIELD,
"PCDATA", LTYPEPC, APCDATA,
"FUNCDATA", LTYPEF, AFUNCDATA,
0
};

File diff suppressed because it is too large Load Diff

View File

@ -56,21 +56,22 @@
LTYPEXC = 272,
LTYPEX = 273,
LTYPEPC = 274,
LCONST = 275,
LFP = 276,
LPC = 277,
LSB = 278,
LBREG = 279,
LLREG = 280,
LSREG = 281,
LFREG = 282,
LXREG = 283,
LFCONST = 284,
LSCONST = 285,
LSP = 286,
LNAME = 287,
LLAB = 288,
LVAR = 289
LTYPEF = 275,
LCONST = 276,
LFP = 277,
LPC = 278,
LSB = 279,
LBREG = 280,
LLREG = 281,
LSREG = 282,
LFREG = 283,
LXREG = 284,
LFCONST = 285,
LSCONST = 286,
LSP = 287,
LNAME = 288,
LLAB = 289,
LVAR = 290
};
#endif
/* Tokens. */
@ -91,21 +92,22 @@
#define LTYPEXC 272
#define LTYPEX 273
#define LTYPEPC 274
#define LCONST 275
#define LFP 276
#define LPC 277
#define LSB 278
#define LBREG 279
#define LLREG 280
#define LSREG 281
#define LFREG 282
#define LXREG 283
#define LFCONST 284
#define LSCONST 285
#define LSP 286
#define LNAME 287
#define LLAB 288
#define LVAR 289
#define LTYPEF 275
#define LCONST 276
#define LFP 277
#define LPC 278
#define LSB 279
#define LBREG 280
#define LLREG 281
#define LSREG 282
#define LFREG 283
#define LXREG 284
#define LFCONST 285
#define LSCONST 286
#define LSP 287
#define LNAME 288
#define LLAB 289
#define LVAR 290
@ -126,7 +128,7 @@ typedef union YYSTYPE
Gen2 gen2;
}
/* Line 1529 of yacc.c. */
#line 130 "y.tab.h"
#line 132 "y.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1