Machine Code..._(re)
Thu, 5 Jun 1997 14:10:06 +0300 (EET DST)
On Fri, 2 May 1997, PredatorZeta wrote:
> 1)_The reserved word "result" ISN'T explained properly in the info
> documentation. (at least in
> my version!!???). It work, but with this stupid warning:
'result' is not a reserved word. In extended pascal, you may
declare a return variable, which in this case happens
to be called 'result'.
> Warning: return value of function not assigned
>
> I think because GPC can't consider the Asm assignment as a real
> assignment....
Right, gpc does not handle this properly. But I had
the impression the compiler flow analysis would recognize
this, if the output section of the asm() uses the result
variable...
> 2)_The code outputted from your proc with -O2 switch activated is:
>
> 1 pushl %ebp
> 2 movl %esp,%ebp
> 3 subl $12,%esp
> 4 movl %ecx,-4(%ebp)
> 5 movl 8(%ebp),%edx
> /APP
> 6 inb %dx, %al
> /NOAPP
> 7 movb %al,-5(%ebp)
> 8 movb -5(%ebp),%al |
> 9 leave
> 10 ret
>
> =8-||||| AAAAAAAARRRRGGGHHH!!!8-)) Whatta the lines 7 and 8 do??????
> NOTHING!!!
> If I cutout these lines the code works IDeNtIcAL!! Also this cost >3<
> clock cycles on Pentium, for the AGI stall...
I think this is because the return value of the function
is declared volatile to prevent optimization screwing
it up. I remember having problems with this, so please don't
remove the volatile stuff until the real problem is tracked.
In this case (when the return variable exists) the code
is of course quite stupid. (but I don't remember the intel
assembler well enough to be sure about the problem)
Juki
jtv@hut.fi
ps. Thanks for the asm manual! Although quite PC specific ":-)"
it is a lot simpler to understand than the GCC documentation.
Please keep working with it.
Jukka Virtanen (jtv@cc.hut.fi)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es