|Jack W. Crenshaw - Any clues how to optimize ? firstname.lastname@example.org (XlatB) (1999-04-09)|
|Re: Jack W. Crenshaw - Any clues how to optimize ? email@example.com (Torben Mogensen) (1999-04-18)|
|Re: Jack W. Crenshaw - Any clues how to optimize ? firstname.lastname@example.org (David Whitten) (1999-04-18)|
|Re: Jack W. Crenshaw - Any clues how to optimize ? email@example.com (1999-04-19)|
|Re: Jack W. Crenshaw - Any clues how to optimize ? firstname.lastname@example.org (Bill A.) (1999-04-22)|
|Re: Jack W. Crenshaw - Any clues how to optimize ? email@example.com (Anders Holtsberg) (1999-05-03)|
|Re: Jack W. Crenshaw - Any clues how to optimize ? firstname.lastname@example.org (1999-05-07)|
|From:||"Bill A." <email@example.com>|
|Date:||22 Apr 1999 02:30:28 -0400|
|Organization:||Posted via RemarQ Communities, Inc.|
>In an ideal world, you can make the peep-hole optimizer look for the
>patterns to match in a table and get the 'translation' from the table
>as well. Generally, you may have to get the translation from a
>function call that looks at the pattern and the code that matched it
>and generates a 'translation' that fills in the blanks in the
>generated code from looking at the sequence/data that filled those
>blanks in the original code.
I did a peephole optmizer that had "don't care" strings in the search
patterns and then used what was matched there in the replacement
strings. I used /x80 for variable item number 1, /x81 for 2, and so
on. This significantly reduced the size of the table and eliminated
enumerating all registers in a common optimization string. For
"MOV \x80,0" would pair up with "XOR \x80,\x80"
So MOV BX,0 would become XOR BX,BX and MOV CL,0 would become XOR CL,CL.
"MOV \x80,\x81", "PUSH \x80", "MOV \x80,\x81", "PUSH \x80" was replaced
with "MOV \x80,\x81", "PUSH \x80", "PUSH \x80"
As you can see, this covers many many combinations of a double load
and push of the same item - regardless of what was loaded. You can
carry this pretty far and even match two consecutive adds and combine
them into a assembly-time additin. For these cases, I used \xC0 as
above which meant match any constant value at this position. Having
this mechanism allows you to even detect the load of 0 and 1 and
change the pattern to an INCrement.
Return to the
Search the comp.compilers archives again.