diff options
author | Russ Cox <rsc@golang.org> | 2013-07-18 15:38:19 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2013-07-18 15:38:19 -0400 |
commit | e77921592506ee6fc3b2d70933010a448d609abe (patch) | |
tree | 9bb540885e9c4b6feeb01b2381b0ffd25f65fa20 /src/cmd/5a/a.y | |
parent | d73a900230c5740dc887c01392ae711ad4a27f09 (diff) | |
download | go-e77921592506ee6fc3b2d70933010a448d609abe.tar.gz |
cmd/6a, cmd/6l: make FUNCDATA work
R=ken2
CC=golang-dev
https://codereview.appspot.com/11397043
Diffstat (limited to 'src/cmd/5a/a.y')
-rw-r--r-- | src/cmd/5a/a.y | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/cmd/5a/a.y b/src/cmd/5a/a.y index 467f92892..19ef98b76 100644 --- a/src/cmd/5a/a.y +++ b/src/cmd/5a/a.y @@ -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,11 +322,24 @@ 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 */ | LTYPEE comma |