为什么GCC会产生ANDL $ -16? [英] Why does GCC produce ANDL $-16?

查看:374
本文介绍了为什么GCC会产生ANDL $ -16?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助来理解GCC为何这么做

I need some help understanding why GCC is doing

main:
    pushl   %ebp
    movl    %esp, %ebp
    andl    $-16, %esp   # ???
    subl    $48, %esp    # ???
    movl    $8, 16(%esp)        
    movl    $4, 20(%esp)

为什么先减去16然后再减去48? subl $ 64,%esp 会更容易吗?

Why does it first subtract 16 and then subtract 48 again? Wouldn't it be easier to do subl $64, %esp?

推荐答案

andl    $-16, %esp   # ???

上面的行没有从 esp ,但要使其对齐到16字节边界。

下一个是减法,主要是为了保留堆栈上的某些空间。

The above line is not subtracting 16 from esp but to align it to 16 byte boundary.
While the following one is to subtract, mostly for reserving some space on the stack.

subl    $48, %esp    # ???

这篇关于为什么GCC会产生ANDL $ -16?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆