1
0
mirror of https://github.com/golang/go synced 2024-11-23 02:10:03 -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 '*' '/' '%' %left '*' '/' '%'
%token <lval> LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5 %token <lval> LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5
%token <lval> LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA %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> LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK
%token <lval> LTYPEL LTYPEM LTYPEN LTYPEBX LTYPEPLD %token <lval> LTYPEL LTYPEM LTYPEN LTYPEBX LTYPEPLD
%token <lval> LCONST LSP LSB LFP LPC %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 <lval> LCOND LS LAT
%token <dval> LFCONST %token <dval> LFCONST
%token <sval> LSCONST %token <sval> LSCONST
@ -322,10 +322,23 @@ inst:
/* /*
* PCDATA * 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); 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 * END
*/ */

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -50,7 +50,7 @@
%left '*' '/' '%' %left '*' '/' '%'
%token <lval> LTYPE0 LTYPE1 LTYPE2 LTYPE3 LTYPE4 %token <lval> LTYPE0 LTYPE1 LTYPE2 LTYPE3 LTYPE4
%token <lval> LTYPEC LTYPED LTYPEN LTYPER LTYPET LTYPEG LTYPEPC %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> LCONST LFP LPC LSB
%token <lval> LBREG LLREG LSREG LFREG LMREG LXREG %token <lval> LBREG LLREG LSREG LFREG LMREG LXREG
%token <dval> LFCONST %token <dval> LFCONST
@ -58,8 +58,9 @@
%token <sym> LNAME LLAB LVAR %token <sym> LNAME LLAB LVAR
%type <lval> con con2 expr pointer offset %type <lval> con con2 expr pointer offset
%type <gen> mem imm imm2 reg nam rel rem rim rom omem nmem %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> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9
%type <gen2> spec10 spec11 spec12 spec13
%% %%
prog: prog:
| prog | prog
@ -116,6 +117,7 @@ inst:
| LTYPERT spec10 { outcode($1, &$2); } | LTYPERT spec10 { outcode($1, &$2); }
| LTYPEG spec11 { outcode($1, &$2); } | LTYPEG spec11 { outcode($1, &$2); }
| LTYPEPC spec12 { outcode($1, &$2); } | LTYPEPC spec12 { outcode($1, &$2); }
| LTYPEF spec13 { outcode($1, &$2); }
nonnon: nonnon:
{ {
@ -310,8 +312,21 @@ spec11: /* GLOBL */
} }
spec12: /* PCDATA */ 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; $$.from = $1;
$$.to = $3; $$.to = $3;
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -54,7 +54,7 @@
%left '*' '/' '%' %left '*' '/' '%'
%token <lval> LTYPE0 LTYPE1 LTYPE2 LTYPE3 LTYPE4 %token <lval> LTYPE0 LTYPE1 LTYPE2 LTYPE3 LTYPE4
%token <lval> LTYPEC LTYPED LTYPEN LTYPER LTYPET LTYPES LTYPEM LTYPEI LTYPEG LTYPEXC %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 <lval> LBREG LLREG LSREG LFREG LXREG
%token <dval> LFCONST %token <dval> LFCONST
%token <sval> LSCONST LSP %token <sval> LSCONST LSP
@ -63,7 +63,7 @@
%type <con2> con2 %type <con2> con2
%type <gen> mem imm imm2 reg nam rel rem rim rom omem nmem %type <gen> mem imm imm2 reg nam rel rem rim rom omem nmem
%type <gen2> nonnon nonrel nonrem rimnon rimrem remrim %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:
| prog | prog
@ -119,6 +119,7 @@ inst:
| LTYPEXC spec9 { outcode($1, &$2); } | LTYPEXC spec9 { outcode($1, &$2); }
| LTYPEX spec10 { outcode($1, &$2); } | LTYPEX spec10 { outcode($1, &$2); }
| LTYPEPC spec11 { outcode($1, &$2); } | LTYPEPC spec11 { outcode($1, &$2); }
| LTYPEF spec12 { outcode($1, &$2); }
nonnon: nonnon:
{ {
@ -309,12 +310,25 @@ spec10: /* PINSRD */
} }
spec11: /* PCDATA */ 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; $$.from = $1;
$$.to = $3; $$.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: rem:
reg reg
| mem | mem

View File

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

File diff suppressed because it is too large Load Diff

View File

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