<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
I'm thinking m3back could use multiple passes.<BR>
<BR>
<BR>There a few reasons, things that would be easier/possible if it had them.<BR>
<BR>
<BR>I know adding passes will slow it down, but I suspect it will still be<BR>about as pleasantly fast as it is now.<BR>
<BR>
<BR>
The optimizations I have in mind:<BR> inlining, including where function definitions come after the call <BR> I think inlining where the "small" functions come first is doable in pass,<BR> but not if uses come before calls.<BR>
<BR>
<BR> not saving unused registers<BR> This only a small optimization and could probably be done in one<BR> pass if m3objfile got a "memmove" operation. Well, I already<BR> have the optimization in somewhat, but it involves nop-ing out<BR> code instead of removing it completely.<BR>
<BR>
<BR> dead store removal, and then removing the resulting dead code to compute the value<BR>
<BR> <BR>
possibly better register allocation -- e.g. based on noticing which<BR> variables are used often, or based on how they are used, for example<BR> if a variable (or expression/temporary) ends serving a shift count,<BR> we should favor putting it in ecx up front, instead of moving it to<BR> ecx later, but we don't generally know this till too late<BR>
<BR>
<BR>
As I understand, m3middle already has the notion of "recording"<BR> and "playing back" calls to the M3CG interface.<BR>
That seems like a good starting point?<BR>
<BR>
<BR>Some optimizations can be made via "CG to CG" transforms.<BR>
<BR>
<BR>However I think in general I think the required design would include:<BR> - ability to add in "private operations"; maybe <BR> - ability to add "private data" to existing operations<BR> A very simple one is annotate functions with required frame size.<BR> This isn't currently known until the end of the function.<BR>
- clearly, ability to remove operations <BR>
<BR>
<BR>Can/should we somehow augment m3middle in support of this line of thinking?<BR>
<BR>
<BR>Or is that just not the way to go?<BR>Each backend should have its own internal representation and loop over it?<BR>
<BR> - Jay<BR><BR> </body>
</html>