Commit da4abda2 authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

liblink, cmd/5a: fix reglist parsing/printing after changing REG_R0 to 32

Fixes #9759.

Change-Id: I263f1251b9401371231374551c4f71c70cb6e359
Signed-off-by: 's avatarShenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/3931Reviewed-by: 's avatarDave Cheney <dave@cheney.net>
parent 706cc13b
......@@ -38,7 +38,7 @@
%union
{
Sym *sym;
int32 lval;
int64 lval;
double dval;
char sval[8];
Addr addr;
......@@ -460,20 +460,20 @@ fcon:
reglist:
spreg
{
$$ = 1 << $1;
$$ = 1ULL << $1;
}
| spreg '-' spreg
{
int i;
$$=0;
for(i=$1; i<=$3; i++)
$$ |= 1<<i;
$$ |= 1ULL<<i;
for(i=$3; i<=$1; i++)
$$ |= 1<<i;
$$ |= 1ULL<<i;
}
| spreg comma reglist
{
$$ = (1<<$1) | $3;
$$ = (1ULL<<$1) | $3;
}
gen:
......
......@@ -204,7 +204,7 @@ typedef union YYSTYPE
#line 39 "a.y"
{
Sym *sym;
int32 lval;
int64 lval;
double dval;
char sval[8];
Addr addr;
......@@ -2223,7 +2223,7 @@ yyreduce:
case 64:
#line 462 "a.y"
{
(yyval.lval) = 1 << (yyvsp[(1) - (1)].lval);
(yyval.lval) = 1ULL << (yyvsp[(1) - (1)].lval);
}
break;
......@@ -2233,16 +2233,16 @@ yyreduce:
int i;
(yyval.lval)=0;
for(i=(yyvsp[(1) - (3)].lval); i<=(yyvsp[(3) - (3)].lval); i++)
(yyval.lval) |= 1<<i;
(yyval.lval) |= 1ULL<<i;
for(i=(yyvsp[(3) - (3)].lval); i<=(yyvsp[(1) - (3)].lval); i++)
(yyval.lval) |= 1<<i;
(yyval.lval) |= 1ULL<<i;
}
break;
case 66:
#line 475 "a.y"
{
(yyval.lval) = (1<<(yyvsp[(1) - (3)].lval)) | (yyvsp[(3) - (3)].lval);
(yyval.lval) = (1ULL<<(yyvsp[(1) - (3)].lval)) | (yyvsp[(3) - (3)].lval);
}
break;
......
......@@ -149,7 +149,7 @@ typedef union YYSTYPE
#line 39 "a.y"
{
Sym *sym;
int32 lval;
int64 lval;
double dval;
char sval[8];
Addr addr;
......
......@@ -1820,14 +1820,14 @@ if(0 /*debug['G']*/) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->na
switch(o->type) {
case 38: /* movm $con,oreg -> stm */
o1 = (0x4 << 25);
o1 |= p->from.offset & 0xffff;
o1 |= (p->from.offset >> REG_R0) & 0xffff;
o1 |= (p->to.reg&15) << 16;
aclass(ctxt, &p->to);
break;
case 39: /* movm oreg,$con -> ldm */
o1 = (0x4 << 25) | (1 << 20);
o1 |= p->to.offset & 0xffff;
o1 |= (p->to.offset >> REG_R0) & 0xffff;
o1 |= (p->from.reg&15) << 16;
aclass(ctxt, &p->from);
break;
......
......@@ -222,7 +222,8 @@ RAconv(Fmt *fp)
{
char str[STRINGSZ];
Addr *a;
int i, v;
int i;
vlong v;
a = va_arg(fp->args, Addr*);
sprint(str, "GOK-reglist");
......@@ -232,7 +233,7 @@ RAconv(Fmt *fp)
break;
if(a->sym != nil)
break;
v = a->offset;
v = a->offset >> REG_R0;
strcpy(str, "");
for(i=0; i<NREG; i++) {
if(v & (1<<i)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment