<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
The generated code is simple.<BR>
The "problem" is that the "virtual stack" is used for constant folding too.<BR>
Surely it is faster, much smaller, to say:<BR>
mov foo, 3<BR>
<BR>
than <BR>
push 1 <BR>
push 2 <BR>
pop eax <BR>
pop ecx <BR>
add eax, ecx <BR>
mov foo, eax <BR>
<BR>
tempting though.<BR>
<BR>
Really, a lot of what the NT386 backend does is target-independent and could be<BR>
moved either to the frontend or an in-between "cg" layer that is always present.<BR>
<BR>
It also presents a problem for calling functions.<BR>
You can't trivially combine the stacks and still call functions.<BR>
Evaluation of the parameters and actually passing them on the stack<BR>
gets confused. At least in my head.<BR>
Maybe it isn't so hard.<BR>
<BR>
<BR>
- Jay<BR><BR> <BR>> From: hosking@cs.purdue.edu<BR>> Date: Sat, 6 Feb 2010 13:15:37 -0500<BR>> To: jkrell@elego.de<BR>> CC: m3commit@elegosoft.com<BR>> Subject: Re: [M3commit] CVS Update: cm3<BR>> <BR>> Realise also that on modern x86 machines the stack ends up in internal registers anyway. x86 processors these days don't actually execute x86 instructions... ;-)<BR>> <BR>> So, it may not be such a performance loss simply to push/pop on the machine stack. Generating simple code is probably better than more complicated code, because the hardware will still do a good job of executing it.<BR>> <BR>> <BR>> On 6 Feb 2010, at 17:19, Jay Krell wrote:<BR>> <BR>> > CVSROOT: /usr/cvs<BR>> > Changes by: jkrell@birch. 10/02/06 17:19:41<BR>> > <BR>> > Modified files:<BR>> > cm3/m3-sys/m3back/src/: M3x86.m3 <BR>> > <BR>> > Log message:<BR>> > save all registers that are in use to memory (temporaries on the stack) around int64 helper functions; this is not ideal though in practise, the few times I have looked, it isn't many registers, like one; it is probably reasonable to alter the frontend to generate the code in a different order?<BR>> <BR> </body>
</html>