[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-assembly
Subject:    Re: Question about GCC and stack
From:       James Colannino <james () colannino ! org>
Date:       2005-09-12 23:15:52
Message-ID: 43260C28.6020406 () colannino ! org
[Download RAW message or body]

Brian Raiter wrote:

>>The subl instruction is pointless, I dont know why it's inserted. It
>>could be just generic stub code that gcc always inserts for
>>allocating stack variables, but as in this case you dont use any, it
>>allocates $0 bytes...I'm sure someone will correct me if there's a
>>good reason for it :)
>>    
>>
>
>I expect that the instructions obtained by the original poster were
>created by gcc without optimization. Run gcc with -O2 or so would
>probably yield a simpler set of instructions.
>  
>

It was without -O2, but when I used -O2, the code was pretty much the 
same.  The only difference was that instead of moving the value 0 into 
eax, xor eax, eax was used to mask out all the bits (equalling 0, and 
I'm assuming that's probably slightly more efficient than moving a value 
into a register.)  Also, instead of the leave instruction, the ebp and 
esp were manipulated manually, I guess because maybe the leave 
instruction, like the enter instruction, is slower?

James

-- 
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/

"You can only find truth with logic if you have already found truth without it." --G. K. Chesterton

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic