Skip to content

Commit

Permalink
cmd/7g: fix some instances of large-offset indirects
Browse files Browse the repository at this point in the history
Updates golang#22

Change-Id: I643ba889a2b6da03bf88b2131cf8118005302de5
  • Loading branch information
4ad committed Jan 7, 2015
1 parent 97c7f8b commit 51229e3
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/cmd/7g/gsubr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,21 +1066,16 @@ fixlargeoffset(Node *n)
return;
if(n->op != OINDREG)
return;
if(n->val.u.reg == D_R0+REGSP) // stack offset cannot be large
if(-4096 <= n->xoffset && n->xoffset < 4096)
return;
if(n->xoffset != (int32)n->xoffset) {
// TODO(minux): offset too large, move into R31 and add to R31 instead.
// this is used only in test/fixedbugs/issue6036.go.
print("offset too large: %N\n", n);
noimpl;
a = *n;
a.op = OREGISTER;
a.type = types[tptr];
a.xoffset = 0;
cgen_checknil(&a);
ginscon(optoas(OADD, types[tptr]), n->xoffset, &a);
n->xoffset = 0;
}

a = *n;
a.op = OREGISTER;
a.type = types[tptr];
a.xoffset = 0;
cgen_checknil(&a);
ginscon(optoas(OADD, types[tptr]), n->xoffset, &a);
n->xoffset = 0;
}

/*
Expand Down

0 comments on commit 51229e3

Please sign in to comment.