summaryrefslogtreecommitdiff
path: root/src/cmd/5a/a.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/5a/a.y')
-rw-r--r--src/cmd/5a/a.y30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/cmd/5a/a.y b/src/cmd/5a/a.y
index c506ff9d5..56d0c563d 100644
--- a/src/cmd/5a/a.y
+++ b/src/cmd/5a/a.y
@@ -41,7 +41,7 @@
int32 lval;
double dval;
char sval[8];
- Gen gen;
+ Addr addr;
}
%left '|'
%left '^'
@@ -62,8 +62,8 @@
%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
+%type <addr> gen rel reg regreg freg shift fcon frcon
+%type <addr> imm ximm name oreg ireg nireg ioreg imsr
%%
prog:
| prog
@@ -175,7 +175,7 @@ inst:
*/
| LTYPE8 cond ioreg ',' '[' reglist ']'
{
- Gen g;
+ Addr g;
g = nullgen;
g.type = D_CONST;
@@ -184,7 +184,7 @@ inst:
}
| LTYPE8 cond '[' reglist ']' ',' ioreg
{
- Gen g;
+ Addr g;
g = nullgen;
g.type = D_CONST;
@@ -279,7 +279,7 @@ inst:
*/
| LTYPEJ cond con ',' expr ',' spreg ',' creg ',' creg oexpr
{
- Gen g;
+ Addr g;
g = nullgen;
g.type = D_CONST;
@@ -294,7 +294,7 @@ inst:
(($11 & 15) << 0) | /* Crm */
(($12 & 7) << 5) | /* coprocessor information */
(1<<4); /* must be set */
- outcode(AWORD, Always, &nullgen, NREG, &g);
+ outcode(AMRC, Always, &nullgen, NREG, &g);
}
/*
* MULL r1,r2,(hi,lo)
@@ -336,7 +336,7 @@ inst:
{
if($2.type != D_CONST)
yyerror("index for FUNCDATA must be integer constant");
- if($4.type != D_EXTERN && $4.type != D_STATIC)
+ if($4.type != D_EXTERN && $4.type != D_STATIC && $4.type != D_OREG)
yyerror("value for FUNCDATA must be symbol reference");
outcode($1, Always, &$2, NREG, &$4);
}
@@ -377,14 +377,12 @@ rel:
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;
}
@@ -408,7 +406,7 @@ ximm: '$' con
{
$$ = nullgen;
$$.type = D_SCONST;
- memcpy($$.sval, $2, sizeof($$.sval));
+ memcpy($$.u.sval, $2, sizeof($$.u.sval));
}
| fcon
@@ -417,13 +415,13 @@ fcon:
{
$$ = nullgen;
$$.type = D_FCONST;
- $$.dval = $2;
+ $$.u.dval = $2;
}
| '$' '-' LFCONST
{
$$ = nullgen;
$$.type = D_FCONST;
- $$.dval = -$3;
+ $$.u.dval = -$3;
}
reglist:
@@ -635,7 +633,7 @@ name:
$$ = nullgen;
$$.type = D_OREG;
$$.name = $3;
- $$.sym = S;
+ $$.sym = nil;
$$.offset = $1;
}
| LNAME offset '(' pointer ')'
@@ -643,7 +641,7 @@ name:
$$ = nullgen;
$$.type = D_OREG;
$$.name = $4;
- $$.sym = $1;
+ $$.sym = linklookup(ctxt, $1->name, 0);
$$.offset = $2;
}
| LNAME '<' '>' offset '(' LSB ')'
@@ -651,7 +649,7 @@ name:
$$ = nullgen;
$$.type = D_OREG;
$$.name = D_STATIC;
- $$.sym = $1;
+ $$.sym = linklookup(ctxt, $1->name, 1);
$$.offset = $4;
}