added optimization for indexed pointer load of a constant, e.g.: y = ((unsigned char*)0x100)[i]

This commit is contained in:
Steven Hugg
2019-03-14 07:20:16 -04:00
committed by greg-king5
parent f95481fabf
commit ffc118cd94
3 changed files with 121 additions and 0 deletions

View File

@@ -814,6 +814,7 @@ static OptFunc DOptPtrLoad14 = { OptPtrLoad14, "OptPtrLoad14", 108, 0,
static OptFunc DOptPtrLoad15 = { OptPtrLoad15, "OptPtrLoad15", 86, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrLoad16 = { OptPtrLoad16, "OptPtrLoad16", 100, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrLoad17 = { OptPtrLoad17, "OptPtrLoad17", 190, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrLoad18 = { OptPtrLoad18, "OptPtrLoad18", 100, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrStore1 = { OptPtrStore1, "OptPtrStore1", 65, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrStore2 = { OptPtrStore2, "OptPtrStore2", 65, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrStore3 = { OptPtrStore3, "OptPtrStore3", 100, 0, 0, 0, 0, 0 };
@@ -905,6 +906,7 @@ static OptFunc* OptFuncs[] = {
&DOptPtrLoad15,
&DOptPtrLoad16,
&DOptPtrLoad17,
&DOptPtrLoad18,
&DOptPtrLoad2,
&DOptPtrLoad3,
&DOptPtrLoad4,
@@ -1246,6 +1248,7 @@ static unsigned RunOptGroup1 (CodeSeg* S)
Changes += RunOptFunc (S, &DOptPtrLoad5, 1);
Changes += RunOptFunc (S, &DOptPtrLoad6, 1);
Changes += RunOptFunc (S, &DOptPtrLoad7, 1);
Changes += RunOptFunc (S, &DOptPtrLoad18, 1); /* Before OptPtrLoad11 */
Changes += RunOptFunc (S, &DOptPtrLoad11, 1);
Changes += RunOptFunc (S, &DOptPtrLoad12, 1);
Changes += RunOptFunc (S, &DOptPtrLoad13, 1);