Skip to content

Commit 51229e3

Browse files
committed
cmd/7g: fix some instances of large-offset indirects
Updates golang#22 Change-Id: I643ba889a2b6da03bf88b2131cf8118005302de5
1 parent 97c7f8b commit 51229e3

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/cmd/7g/gsubr.c

+9-14
Original file line numberDiff line numberDiff line change
@@ -1066,21 +1066,16 @@ fixlargeoffset(Node *n)
10661066
return;
10671067
if(n->op != OINDREG)
10681068
return;
1069-
if(n->val.u.reg == D_R0+REGSP) // stack offset cannot be large
1069+
if(-4096 <= n->xoffset && n->xoffset < 4096)
10701070
return;
1071-
if(n->xoffset != (int32)n->xoffset) {
1072-
// TODO(minux): offset too large, move into R31 and add to R31 instead.
1073-
// this is used only in test/fixedbugs/issue6036.go.
1074-
print("offset too large: %N\n", n);
1075-
noimpl;
1076-
a = *n;
1077-
a.op = OREGISTER;
1078-
a.type = types[tptr];
1079-
a.xoffset = 0;
1080-
cgen_checknil(&a);
1081-
ginscon(optoas(OADD, types[tptr]), n->xoffset, &a);
1082-
n->xoffset = 0;
1083-
}
1071+
1072+
a = *n;
1073+
a.op = OREGISTER;
1074+
a.type = types[tptr];
1075+
a.xoffset = 0;
1076+
cgen_checknil(&a);
1077+
ginscon(optoas(OADD, types[tptr]), n->xoffset, &a);
1078+
n->xoffset = 0;
10841079
}
10851080

10861081
/*

0 commit comments

Comments
 (0)