Commit 8ce5f6e1 authored by Kai Backman's avatar Kai Backman

fix bad code generation.

go/test: passes 64% (215/337) tests

metric updated, had total number of tests wrong. number of
failing tests is down from 129 to 122.

R=rsc
APPROVED=rsc
DELTA=228  (12 added, 5 deleted, 211 changed)
OCL=34897
CL=34899
parent f7e43ffa
......@@ -103,7 +103,6 @@ cgen(Node *n, Node *res)
} else
p1 = gins(a, n, N);
p1->to = addr;
p1->reg = w;
if(debug['g'])
print("%P [ignore previous line]\n", p1);
sudoclean();
......@@ -179,12 +178,10 @@ cgen(Node *n, Node *res)
if(res->op == OREGISTER) {
p1 = gins(a, N, res);
p1->from = addr;
p1->reg = w;
} else {
regalloc(&n2, n->type, N);
p1 = gins(a, N, &n2);
p1->from = addr;
p1->reg = w;
gins(a, &n2, res);
regfree(&n2);
}
......@@ -372,7 +369,6 @@ abop: // asymmetric binary
if(sudoaddable(a, nr, &addr, &w)) {
p1 = gins(a, N, &n1);
p1->from = addr;
p1->reg = w;
gmove(&n1, res);
sudoclean();
regfree(&n1);
......@@ -574,7 +570,6 @@ agen(Node *n, Node *res)
tmp.op = OADDR;
tmp.left = &n2;
p1 = gins(AMOVW, &tmp, &n3);
p1->reg = w;
} else {
nodconst(&n1, t, w);
gins(optoas(OMUL, t), &n1, &n2);
......
......@@ -184,11 +184,12 @@ isfat(Type *t)
* naddr of func generates code for address of func.
* if using opcode that can take address implicitly,
* call afunclit to fix up the argument.
* also fix up direct register references to be D_OREG.
*/
void
afunclit(Addr *a)
{
if(a->type == D_ADDR && a->name == D_EXTERN) {
if(a->type == D_ADDR && a->name == D_EXTERN || a->type == D_REG) {
a->type = D_OREG;
}
}
......@@ -1441,7 +1442,7 @@ sudoaddable(int as, Node *n, Addr *a, int *w)
int o, i;
int oary[10];
int64 v;
Node n1, n2, n3, *nn, *l, *r;
Node n1, n2, n3, n4, *nn, *l, *r;
Node *reg, *reg1;
Prog *p1;
Type *t;
......@@ -1655,8 +1656,11 @@ oindex_const:
nodconst(&n2, types[TUINT32], v);
regalloc(&n3, types[TUINT32], N);
cgen(&n2, &n3);
p1 = gins(optoas(OCMP, types[TUINT32]), &n1, N);
regalloc(&n4, n1.type, N);
cgen(&n1, &n4);
p1 = gins(optoas(OCMP, types[TUINT32]), &n4, N);
raddr(&n3, p1);
regfree(&n4);
regfree(&n3);
p1 = gbranch(optoas(OGT, types[TUINT32]), T);
ginscall(throwindex, 0);
......
64bit.go
assign.go
blank1.go
bugs/bug136.go
bugs/bug169.go
bugs/bug190.go
bugs/bug193.go
bugs/bug196.go
bugs/bug198.go
chan/perm.go
cmp2.go
cmp3.go
cmp4.go
cmp5.go
const1.go
const2.go
convert3.go
convlit.go
convlit1.go
declbad.go
empty.go
escape1.go
fixedbugs/bug000.go
fixedbugs/bug001.go
fixedbugs/bug002.go
fixedbugs/bug003.go
fixedbugs/bug004.go
fixedbugs/bug005.go
fixedbugs/bug007.go
fixedbugs/bug008.go
fixedbugs/bug009.go
fixedbugs/bug013.go
fixedbugs/bug014.go
fixedbugs/bug015.go
fixedbugs/bug016.go
fixedbugs/bug017.go
fixedbugs/bug020.go
fixedbugs/bug021.go
fixedbugs/bug022.go
fixedbugs/bug023.go
fixedbugs/bug024.go
fixedbugs/bug026.go
fixedbugs/bug030.go
fixedbugs/bug031.go
fixedbugs/bug035.go
fixedbugs/bug036.go
fixedbugs/bug037.go
fixedbugs/bug038.go
fixedbugs/bug039.go
fixedbugs/bug040.go
fixedbugs/bug046.go
fixedbugs/bug049.go
fixedbugs/bug050.go
fixedbugs/bug051.go
fixedbugs/bug053.go
fixedbugs/bug057.go
fixedbugs/bug058.go
fixedbugs/bug061.go
fixedbugs/bug062.go
fixedbugs/bug063.go
fixedbugs/bug064.go
fixedbugs/bug065.go
fixedbugs/bug066.go
fixedbugs/bug068.go
fixedbugs/bug070.go
fixedbugs/bug071.go
fixedbugs/bug072.go
fixedbugs/bug073.go
fixedbugs/bug074.go
fixedbugs/bug076.go
fixedbugs/bug077.go
fixedbugs/bug078.go
fixedbugs/bug080.go
fixedbugs/bug081.go
fixedbugs/bug082.go
fixedbugs/bug083.go
fixedbugs/bug085.go
fixedbugs/bug086.go
fixedbugs/bug087.go
fixedbugs/bug088.go
fixedbugs/bug089.go
fixedbugs/bug090.go
fixedbugs/bug091.go
fixedbugs/bug093.go
fixedbugs/bug094.go
fixedbugs/bug096.go
fixedbugs/bug097.go
fixedbugs/bug098.go
fixedbugs/bug099.go
fixedbugs/bug102.go
fixedbugs/bug103.go
fixedbugs/bug104.go
fixedbugs/bug106.go
fixedbugs/bug107.go
fixedbugs/bug108.go
fixedbugs/bug109.go
fixedbugs/bug110.go
fixedbugs/bug111.go
fixedbugs/bug112.go
fixedbugs/bug113.go
fixedbugs/bug114.go
fixedbugs/bug115.go
fixedbugs/bug116.go
fixedbugs/bug118.go
fixedbugs/bug119.go
fixedbugs/bug120.go
fixedbugs/bug121.go
fixedbugs/bug122.go
fixedbugs/bug123.go
fixedbugs/bug125.go
fixedbugs/bug126.go
fixedbugs/bug127.go
fixedbugs/bug128.go
fixedbugs/bug129.go
fixedbugs/bug130.go
fixedbugs/bug131.go
fixedbugs/bug132.go
fixedbugs/bug133.go
fixedbugs/bug135.go
fixedbugs/bug137.go
fixedbugs/bug139.go
fixedbugs/bug140.go
fixedbugs/bug141.go
fixedbugs/bug142.go
fixedbugs/bug143.go
fixedbugs/bug144.go
fixedbugs/bug145.go
fixedbugs/bug146.go
fixedbugs/bug147.go
fixedbugs/bug148.go
fixedbugs/bug149.go
fixedbugs/bug150.go
fixedbugs/bug151.go
fixedbugs/bug153.go
fixedbugs/bug154.go
fixedbugs/bug155.go
fixedbugs/bug156.go
fixedbugs/bug157.go
fixedbugs/bug158.go
fixedbugs/bug159.go
fixedbugs/bug161.go
fixedbugs/bug163.go
fixedbugs/bug164.go
fixedbugs/bug165.go
fixedbugs/bug166.go
fixedbugs/bug167.go
fixedbugs/bug168.go
fixedbugs/bug170.go
fixedbugs/bug171.go
fixedbugs/bug172.go
fixedbugs/bug173.go
fixedbugs/bug174.go
fixedbugs/bug175.go
fixedbugs/bug176.go
fixedbugs/bug178.go
fixedbugs/bug179.go
fixedbugs/bug181.go
fixedbugs/bug182.go
fixedbugs/bug183.go
fixedbugs/bug185.go
fixedbugs/bug186.go
fixedbugs/bug188.go
fixedbugs/bug189.go
fixedbugs/bug191.go
fixedbugs/bug192.go
fixedbugs/bug194.go
fixedbugs/bug195.go
fixedbugs/bug197.go
fixedbugs/bug200.go
fixedbugs/bug201.go
fixedbugs/bug202.go
fixedbugs/bug203.go
fixedbugs/bug205.go
fixedbugs/bug206.go
func1.go
func2.go
func3.go
func4.go
gc1.go
helloworld.go
import1.go
indirect.go
indirect1.go
initializerr.go
interface/convert1.go
interface/convert2.go
interface/explicit.go
interface/fail.go
interface/pointer.go
interface/receiver1.go
interface/recursive.go
interface/struct.go
iota.go
ken/complit.go
ken/label.go
ken/mfunc.go
ken/simpprint.go
ken/simpswitch.go
ken/simpvar.go
method1.go
method2.go
method3.go
parentype.go
printbig.go
rename1.go
simassign.go
varinit.go
64bit.go
assign.go
blank1.go
bugs/bug136.go
bugs/bug169.go
bugs/bug190.go
bugs/bug193.go
bugs/bug196.go
bugs/bug198.go
chan/perm.go
cmp2.go
cmp3.go
cmp4.go
cmp5.go
const1.go
const2.go
convert3.go
convlit.go
convlit1.go
declbad.go
empty.go
escape1.go
fixedbugs/bug000.go
fixedbugs/bug001.go
fixedbugs/bug002.go
fixedbugs/bug003.go
fixedbugs/bug004.go
fixedbugs/bug005.go
fixedbugs/bug007.go
fixedbugs/bug008.go
fixedbugs/bug009.go
fixedbugs/bug013.go
fixedbugs/bug014.go
fixedbugs/bug015.go
fixedbugs/bug016.go
fixedbugs/bug017.go
fixedbugs/bug020.go
fixedbugs/bug021.go
fixedbugs/bug022.go
fixedbugs/bug023.go
fixedbugs/bug024.go
fixedbugs/bug026.go
fixedbugs/bug030.go
fixedbugs/bug031.go
fixedbugs/bug035.go
fixedbugs/bug036.go
fixedbugs/bug037.go
fixedbugs/bug038.go
fixedbugs/bug039.go
fixedbugs/bug040.go
fixedbugs/bug046.go
fixedbugs/bug048.go
fixedbugs/bug049.go
fixedbugs/bug050.go
fixedbugs/bug051.go
fixedbugs/bug053.go
fixedbugs/bug057.go
fixedbugs/bug058.go
fixedbugs/bug061.go
fixedbugs/bug062.go
fixedbugs/bug063.go
fixedbugs/bug064.go
fixedbugs/bug065.go
fixedbugs/bug066.go
fixedbugs/bug068.go
fixedbugs/bug069.go
fixedbugs/bug070.go
fixedbugs/bug071.go
fixedbugs/bug072.go
fixedbugs/bug073.go
fixedbugs/bug074.go
fixedbugs/bug075.go
fixedbugs/bug076.go
fixedbugs/bug077.go
fixedbugs/bug078.go
fixedbugs/bug080.go
fixedbugs/bug081.go
fixedbugs/bug082.go
fixedbugs/bug083.go
fixedbugs/bug085.go
fixedbugs/bug086.go
fixedbugs/bug087.go
fixedbugs/bug088.go
fixedbugs/bug089.go
fixedbugs/bug090.go
fixedbugs/bug091.go
fixedbugs/bug093.go
fixedbugs/bug094.go
fixedbugs/bug096.go
fixedbugs/bug097.go
fixedbugs/bug098.go
fixedbugs/bug099.go
fixedbugs/bug102.go
fixedbugs/bug103.go
fixedbugs/bug104.go
fixedbugs/bug106.go
fixedbugs/bug107.go
fixedbugs/bug108.go
fixedbugs/bug109.go
fixedbugs/bug110.go
fixedbugs/bug111.go
fixedbugs/bug112.go
fixedbugs/bug113.go
fixedbugs/bug114.go
fixedbugs/bug115.go
fixedbugs/bug116.go
fixedbugs/bug117.go
fixedbugs/bug118.go
fixedbugs/bug119.go
fixedbugs/bug120.go
fixedbugs/bug121.go
fixedbugs/bug122.go
fixedbugs/bug123.go
fixedbugs/bug125.go
fixedbugs/bug126.go
fixedbugs/bug127.go
fixedbugs/bug128.go
fixedbugs/bug129.go
fixedbugs/bug130.go
fixedbugs/bug131.go
fixedbugs/bug132.go
fixedbugs/bug133.go
fixedbugs/bug135.go
fixedbugs/bug137.go
fixedbugs/bug139.go
fixedbugs/bug140.go
fixedbugs/bug141.go
fixedbugs/bug142.go
fixedbugs/bug143.go
fixedbugs/bug144.go
fixedbugs/bug145.go
fixedbugs/bug146.go
fixedbugs/bug147.go
fixedbugs/bug148.go
fixedbugs/bug149.go
fixedbugs/bug150.go
fixedbugs/bug151.go
fixedbugs/bug153.go
fixedbugs/bug154.go
fixedbugs/bug155.go
fixedbugs/bug156.go
fixedbugs/bug157.go
fixedbugs/bug158.go
fixedbugs/bug159.go
fixedbugs/bug161.go
fixedbugs/bug163.go
fixedbugs/bug164.go
fixedbugs/bug165.go
fixedbugs/bug166.go
fixedbugs/bug167.go
fixedbugs/bug168.go
fixedbugs/bug170.go
fixedbugs/bug171.go
fixedbugs/bug172.go
fixedbugs/bug173.go
fixedbugs/bug174.go
fixedbugs/bug175.go
fixedbugs/bug176.go
fixedbugs/bug178.go
fixedbugs/bug179.go
fixedbugs/bug181.go
fixedbugs/bug182.go
fixedbugs/bug183.go
fixedbugs/bug185.go
fixedbugs/bug186.go
fixedbugs/bug188.go
fixedbugs/bug189.go
fixedbugs/bug191.go
fixedbugs/bug192.go
fixedbugs/bug194.go
fixedbugs/bug195.go
fixedbugs/bug197.go
fixedbugs/bug200.go
fixedbugs/bug201.go
fixedbugs/bug202.go
fixedbugs/bug203.go
fixedbugs/bug205.go
fixedbugs/bug206.go
func1.go
func2.go
func3.go
func4.go
gc1.go
helloworld.go
import1.go
indirect.go
indirect1.go
initializerr.go
interface/convert1.go
interface/convert2.go
interface/explicit.go
interface/fail.go
interface/pointer.go
interface/receiver1.go
interface/recursive.go
interface/returntype.go
interface/struct.go
iota.go
ken/complit.go
ken/label.go
ken/mfunc.go
ken/rob1.go
ken/simpbool.go
ken/simpprint.go
ken/simpswitch.go
ken/simpvar.go
method1.go
method2.go
method3.go
parentype.go
printbig.go
rename1.go
simassign.go
test0.go
varinit.go
......@@ -42,7 +42,7 @@ do
export F=$(basename $i .go)
dir=$(dirname $i)
export D=$dir
sed '/^\/\//!q; s|//||g; s|./\$A.out|$E &|' $i >$RUNFILE
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE
then
echo
......
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