Useless? PUSH ebp / POP epb with structured array

Everything else that doesn't fall into one of the other PB categories.
technicorn
Enthusiast
Enthusiast
Posts: 105
Joined: Wed Jan 18, 2006 7:40 pm
Location: Hamburg

Useless? PUSH ebp / POP epb with structured array

Post 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!!
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
technicorn
Enthusiast
Enthusiast
Posts: 105
Joined: Wed Jan 18, 2006 7:40 pm
Location: Hamburg

Post 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:
Post Reply