shithub: mc

Download patch

ref: fae722321786ec15d722917c95dce8b648eaf326
parent: 637b1e8cb316cff76682b868012904e77040f034
author: Ori Bernstein <[email protected]>
date: Wed Jun 13 13:32:17 EDT 2012

Don't allocate as many registers.

    We were allocating physical regs every time we entered selexpr().
    We don't need to do that.

--- a/8/regalloc.c
+++ b/8/regalloc.c
@@ -72,7 +72,7 @@
 Loc *locreg(Mode m)
 {
     Loc *l;
-    static long nextpseudo;
+    static long nextpseudo = 0;
 
     l = zalloc(sizeof(Loc));
     l->type = Locreg;
@@ -83,11 +83,13 @@
 
 Loc *locphysreg(Reg r)
 {
-    Loc *l;
+    static Loc *physregs[Nreg] = {0,};
 
-    l = locreg(regmodes[r]);
-    l->reg.colour = r;
-    return l;
+    if (physregs[r])
+        return physregs[r];
+    physregs[r] = locreg(regmodes[r]);
+    physregs[r]->reg.colour = r;
+    return physregs[r];
 }
 
 Loc *locmem(long disp, Loc *base, Loc *idx, Mode mode)