]> Cypherpunks repositories - gostls13.git/commitdiff
sped up optimization by not optimizing
authorKen Thompson <ken@golang.org>
Sun, 30 Aug 2009 03:33:21 +0000 (20:33 -0700)
committerKen Thompson <ken@golang.org>
Sun, 30 Aug 2009 03:33:21 +0000 (20:33 -0700)
very large functions.

R=r
OCL=34080
CL=34080

src/cmd/6g/ggen.c
src/cmd/6g/opt.h
src/cmd/6g/reg.c

index 788e6daa55b7352045960ac9ed29f5b030504fbd..c7a1f2d774948a7bbbab700ada191ac13f84a8c0 100644 (file)
@@ -1175,8 +1175,12 @@ yes:
 }
 
 static int
-regcmp(Node *ra, Node *rb)
+regcmp(const void *va, const void *vb)
 {
+       Node *ra, *rb;
+
+       ra = (Node*)va;
+       rb = (Node*)vb;
        return ra->local - rb->local;
 }
 
index 57bdf4dc5119ac29e29faa94e136076b113b0655..9a8866b8d1492220d6daa09de50bc32859fe01c6 100644 (file)
@@ -137,7 +137,8 @@ void        paint1(Reg*, int);
 uint32 paint2(Reg*, int);
 void   paint3(Reg*, int, int32, int);
 void   addreg(Adr*, int);
-void   dumpit(char *str, Reg *r0);
+void   dumpone(Reg*);
+void   dumpit(char*, Reg*);
 int    noreturn(Prog *p);
 
 /*
index 6503ba9db14d748fba1c66fe8dd22ef9e2af5fb9..b79cd61d863673e168aad54900a24dc864c878dc 100644 (file)
@@ -106,6 +106,16 @@ regopt(Prog *firstp)
                first = 0;
        }
 
+       // count instructions
+       nr = 0;
+       for(p=firstp; p!=P; p=p->link)
+               nr++;
+       // if too big dont bother
+       if(nr >= 10000) {
+               print("********** %S is too big (%d)\n", curfn->nname->sym, nr);
+               return;
+       }
+
        r1 = R;
        firstr = R;
        lastr = R;
@@ -1464,49 +1474,56 @@ BtoF(int32 b)
 }
 
 void
-dumpit(char *str, Reg *r0)
+dumpone(Reg *r)
 {
-       Reg *r, *r1;
        int z;
        Bits bit;
 
+       print("%ld:%P", r->loop, r->prog);
+       for(z=0; z<BITS; z++)
+               bit.b[z] =
+                       r->set.b[z] |
+                       r->use1.b[z] |
+                       r->use2.b[z] |
+                       r->refbehind.b[z] |
+                       r->refahead.b[z] |
+                       r->calbehind.b[z] |
+                       r->calahead.b[z] |
+                       r->regdiff.b[z] |
+                       r->act.b[z] |
+                               0;
+       if(bany(&bit)) {
+               print("\t");
+               if(bany(&r->set))
+                       print(" s:%Q", r->set);
+               if(bany(&r->use1))
+                       print(" u1:%Q", r->use1);
+               if(bany(&r->use2))
+                       print(" u2:%Q", r->use2);
+               if(bany(&r->refbehind))
+                       print(" rb:%Q ", r->refbehind);
+               if(bany(&r->refahead))
+                       print(" ra:%Q ", r->refahead);
+               if(bany(&r->calbehind))
+                       print("cb:%Q ", r->calbehind);
+               if(bany(&r->calahead))
+                       print(" ca:%Q ", r->calahead);
+               if(bany(&r->regdiff))
+                       print(" d:%Q ", r->regdiff);
+               if(bany(&r->act))
+                       print(" a:%Q ", r->act);
+       }
+       print("\n");
+}
+
+void
+dumpit(char *str, Reg *r0)
+{
+       Reg *r, *r1;
+
        print("\n%s\n", str);
        for(r = r0; r != R; r = r->link) {
-               print("%ld:%P", r->loop, r->prog);
-               for(z=0; z<BITS; z++)
-                       bit.b[z] =
-                               r->set.b[z] |
-                               r->use1.b[z] |
-                               r->use2.b[z] |
-                               r->refbehind.b[z] |
-                               r->refahead.b[z] |
-                               r->calbehind.b[z] |
-                               r->calahead.b[z] |
-                               r->regdiff.b[z] |
-                               r->act.b[z] |
-                                       0;
-               if(bany(&bit)) {
-                       print("\t");
-                       if(bany(&r->set))
-                               print(" s:%Q", r->set);
-                       if(bany(&r->use1))
-                               print(" u1:%Q", r->use1);
-                       if(bany(&r->use2))
-                               print(" u2:%Q", r->use2);
-                       if(bany(&r->refbehind))
-                               print(" rb:%Q ", r->refbehind);
-                       if(bany(&r->refahead))
-                               print(" ra:%Q ", r->refahead);
-                       if(bany(&r->calbehind))
-                               print("cb:%Q ", r->calbehind);
-                       if(bany(&r->calahead))
-                               print(" ca:%Q ", r->calahead);
-                       if(bany(&r->regdiff))
-                               print(" d:%Q ", r->regdiff);
-                       if(bany(&r->act))
-                               print(" a:%Q ", r->act);
-               }
-               print("\n");
+               dumpone(r);
                r1 = r->p2;
                if(r1 != R) {
                        print(" pred:");
@@ -1535,6 +1552,7 @@ noreturn(Prog *p)
        if(symlist[0] == S) {
                symlist[0] = pkglookup("throwindex", "sys");
                symlist[0] = pkglookup("throwslice", "sys");
+               symlist[0] = pkglookup("throwinit", "sys");
                symlist[1] = pkglookup("panicl", "sys");
        }