Page 1 of 1

Useless? PUSH ebp / POP epb with structured array

Posted: Sun Mar 12, 2006 1:30 am
by technicorn
Hi,

when I compile this

Code: Select all

Structure st2
  l1.l[10]
EndStructure

v3.st2

i = 5
v3\l1[i] = 34
the asm look like this:

LEA ebp,[v_v3]
PUSH ebp
MOV eax,dword [v_i]
SAL eax,2
POP ebp
ADD ebp,eax
MOV dword [ebp],34

I can't see any use for the PUSH/POP?!

And wouldn't

MOV dword [ebp + eax*4],34

instead of

SAL eax,2
ADD epb,eax
MOV dword [ebp],34

be faster?

Beside that, you have improved the code generation a lot since PB3 Fred!!

Posted: Mon Mar 13, 2006 1:37 pm
by Fred
You're right, there is still some case where unneeded push/pop arise, but i think we can't consider this as bugs, so i will move the topic to 'general discussion' ;).

It will be probably enhanced in a later version, some part of the compiler pipeline can be improved in this sens.

Posted: Mon Mar 13, 2006 3:50 pm
by technicorn
Hi Fred,

I didn't mean to call this a bug, I simply didn't know where to post such
things so that you read them :wink: