Skip to content

Commit

Permalink
Merge pull request #4695 from WalterBright/go
Browse files Browse the repository at this point in the history
Remove more ancient stuff from optimizer
  • Loading branch information
yebblies committed May 31, 2015
2 parents 372dc7c + 9ae65e5 commit 43af970
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 59 deletions.
29 changes: 0 additions & 29 deletions src/backend/gdag.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,29 +797,8 @@ STATIC void abewalk(elem *n,vec_t ae,vec_t aeval)
{ elem *e = expnod[i];

if (!e) continue;
#if 1
if (el_appears(e,s))
vec_clearbit(i,ae);
#else
if (OTunary(e->Eoper))
{
if (vec_testbit(e->E1->Eexp,ae))
continue;
}
else if (OTbinary(e->Eoper))
{
if (vec_testbit(e->E1->Eexp,ae) &&
vec_testbit(e->E2->Eexp,ae))
continue;
}
else if (e->Eoper == OPvar)
{ if (e->EV.sp.Vsym != s)
continue;
}
else
continue;
vec_clearbit(i,ae);
#endif
}
}
else /* else ambiguous definition */
Expand All @@ -829,7 +808,6 @@ STATIC void abewalk(elem *n,vec_t ae,vec_t aeval)
vec_subass(ae,vptrkill);
}
/* GEN the lvalue of an assignment operator */
#if 1
if (op == OPeq && (i1 = t->Eexp) != 0 && (i2 = n->E2->Eexp) != 0)
{
if (vec_testbit(i2,ae))
Expand All @@ -841,13 +819,6 @@ STATIC void abewalk(elem *n,vec_t ae,vec_t aeval)
vec_clearbit(i1,aeval);
}
}
#else
if ((OTopeq(op) || op == OPeq || op == OPnegass) && n->E1->Eexp)
{ vec_setbit(t->Eexp,ae);
if (n->E1->Eoper == OPbit)
vec_setbit(n->E1->Eexp,ae);
}
#endif
}
else if (n->Eexp) /* if an AE */
{
Expand Down
2 changes: 1 addition & 1 deletion src/backend/gflow.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 1985-1998 by Symantec
// Copyright (C) 2000-2014 by Digital Mars
// Copyright (C) 2000-2015 by Digital Mars
// All Rights Reserved
// http://www.digitalmars.com
// Written by Walter Bright
Expand Down
12 changes: 5 additions & 7 deletions src/backend/glocal.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 1993-1998 by Symantec
// Copyright (C) 2000-2009 by Digital Mars
// Copyright (C) 2000-2015 by Digital Mars
// All Rights Reserved
// http://www.digitalmars.com
// Written by Walter Bright
Expand All @@ -9,16 +9,12 @@
* For any other uses, please contact Digital Mars.
*/

#if !DEMO && !SPP
#if !SPP

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#if __sun || _MSC_VER
#include <alloca.h>
#endif

#include "cc.h"
#include "global.h"
#include "el.h"
Expand Down Expand Up @@ -82,7 +78,7 @@ void localize()

// Table should not get any larger than the symbol table
locmax = globsym.symmax;
loctab = (loc_t *) alloca(locmax * sizeof(*loctab));
loctab = (loc_t *) malloc(locmax * sizeof(*loctab));

for (b = startblock; b; b = b->Bnext) /* for each block */
{
Expand All @@ -100,6 +96,8 @@ void localize()
local_exp(b->Belem,0);
}
}
free(loctab);
locmax = 0;
}

//////////////////////////////////////
Expand Down
34 changes: 13 additions & 21 deletions src/backend/gloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ STATIC void elimspecwalk(elem **pn);
static bool addblk; /* if TRUE, then we added a block */

/* is elem loop invariant? */
#define isLI(n) ((n)->Nflags & NFLli)
inline int isLI(elem *n) { return n->Nflags & NFLli; }

/* make elem loop invariant */
#define makeLI(n) ((n)->Nflags |= NFLli)
inline void makeLI(elem *n) { n->Nflags |= NFLli; }

/******************************
* Only variables that could only be unambiguously defined
Expand Down Expand Up @@ -1686,7 +1686,7 @@ STATIC void movelis(elem *n,block *b,loop *l,int *pdomexit)
goto Lret;

#if 0
printf("*pdomexit = %d\n",*pdomexit);
printf("*pdomexit = %d\n",*pdomexit);
if (*pdomexit & 2)
{
// If any indirections, can't LI it
Expand All @@ -1695,8 +1695,8 @@ printf("*pdomexit = %d\n",*pdomexit);
// it pass.
Symbol *s;

printf("looking at:\n");
elem_print(n);
printf("looking at:\n");
elem_print(n);
s = el_basesym(n->E1);
if (s)
{
Expand All @@ -1706,15 +1706,15 @@ elem_print(n);

el = list_elem(nl);
el = el->E2;
elem_print(el);
elem_print(el);
if (el->Eoper == OPind && el_basesym(el->E1) == s)
{
printf(" pass!\n");
printf(" pass!\n");
goto Lpass;
}
}
}
printf(" skip!\n");
printf(" skip!\n");
goto Lret;

Lpass:
Expand Down Expand Up @@ -1988,11 +1988,6 @@ STATIC famlist * newfamlist(tym_t ty)
default:
c.Vlong = 1;
break;
#if 0
default:
printf("ty = x%x\n", tybasic(ty));
assert(0);
#endif
#endif
}
fl->c1 = el_const(ty,&c); /* c1 = 1 */
Expand Down Expand Up @@ -2526,17 +2521,17 @@ STATIC void elimfrivivs(loop *l)
famlist *fl;
int nrefs;

cmes("elimfrivivs()\n");
cmes("elimfrivivs()\n");
/* Compute number of family ivs for biv */
nfams = 0;
for (fl = biv->IVfamily; fl; fl = fl->FLnext)
nfams++;
cmes2("nfams = %d\n",nfams);
cmes2("nfams = %d\n",nfams);

/* Compute number of references to biv */
if (onlyref(biv->IVbasic,l,*biv->IVincr,&nrefs))
nrefs--;
cmes2("nrefs = %d\n",nrefs);
cmes2("nrefs = %d\n",nrefs);
assert(nrefs + 1 >= nfams);
if (nrefs > nfams || // if we won't eliminate the biv
(!I16 && nrefs == nfams))
Expand Down Expand Up @@ -2759,11 +2754,13 @@ STATIC bool funcprev(Iv *biv,famlist *fl)
e2,
el_copytree(fls->c2)));
if (sz < tysize(tymin) && sz == tysize(e1->Ety))
{
#if TARGET_SEGMENTED
flse1->E2 = el_una(OPoffset,fl->FLty,flse1->E2);
#else
assert(0);
#endif
}

flse1 = doptelem(flse1,GOALvalue | GOALagain);
fl->c2 = NULL;
Expand Down Expand Up @@ -2847,13 +2844,8 @@ STATIC void elimbasivs(loop *l)
flty = touns(flty);

if (ref->Eoper >= OPle && ref->Eoper <= OPge &&
#if 1
!(tyuns(ref->E1->Ety) | tyuns(ref->E2->Ety)) &&
tyuns(flty))
#else
(tyuns(ref->E1->Ety) | tyuns(ref->E2->Ety)) !=
tyuns(flty))
#endif
continue;

/* if we have (e relop X), replace it with (X relop e) */
Expand Down
2 changes: 1 addition & 1 deletion src/backend/go.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 1986-1998 by Symantec
// Copyright (C) 2000-2009 by Digital Mars
// Copyright (C) 2000-2015 by Digital Mars
// All Rights Reserved
// http://www.digitalmars.com
// Written by Walter Bright
Expand Down

0 comments on commit 43af970

Please sign in to comment.