提示帧指针 [英] Ommiting frame pointer

查看:64
本文介绍了提示帧指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好 -


我被告知为了提高效率,我们应该总是编译

代码,框架指针无效(-fomit-frame-pointer) ,还有 - 管。


这是什么原因?为什么它会产生更好的可执行文件?

有哪些情况不起作用或者不是最好的事情?


我也不明白为什么不总是让位置独立代码

(-fPIC)?


谢谢。

Hello -

I have been told that for extra efficiency we should always compile
code with frame pointer ommited (-fomit-frame-pointer), also -pipe.

What is the reason for this? Why does it make a better executable? Are
there situations where it doesn''t work or isn''t the best thing to do?

Also I don''t understand why not always make Position Independent Code
(-fPIC)?

Thanks.

推荐答案

在文章< sl ******************* @ nospam.invalid>,

Brian< tr * *@nospam.comwrote:
In article <sl*******************@nospam.invalid>,
Brian <tr**@nospam.comwrote:

>我被告知为了提高效率,我们应该总是用框架指针编译代码(-fomit-frame) -pointer)
>I have been told that for extra efficiency we should always compile
code with frame pointer ommited (-fomit-frame-pointer)



不使用帧指针使得额外的寄存器可用于其他

使用,这可以加快少数寄存器处理器的速度(特别是在x86处理器上的
)。使用一个可以使调试更容易,虽然我认为gdb可以做大多数事情没有一个。

Not using a frame pointer makes an extra register available for other
uses, which speeds things up on processors with few registers (in
particular, on x86 processors). Using one can make debugging easier,
though I think gdb can do most things without one.


也-pipe。
also -pipe.



这个gcc选项只使用编译器阶段之间的管道而不是

临时文件。它可能会加快编译速度,但在现有系统上可能不会很多。

This gcc option just uses pipes between compiler stages instead of
temporary files. It might speed up compilation a little but probably
not a lot on current systems.


>我也不明白为什么并不总是制定位置独立代码(-fPIC)?
>Also I don''t understand why not always make Position Independent Code
(-fPIC)?



大多数

系统的位置无关代码可能会稍微慢一些,这只是因为额外的间接性。共享

库需要它。


您可以在特定于gcc的组中获得更详细或准确的答案。


- Richard

-

:wq

Position independent code is likely to be somewhat slower on most
systems, just because of extra indirections. It''s needed for shared
libraries.

You may get more detailed or accurate answers in a gcc-specific group.

-- Richard
--
:wq


Brian< tr ** @ nospam.com写道:
Brian <tr**@nospam.comwrites:

我被告知为了提高效率,我们应该总是使用框架指针编译

代码(-fomit- - 指针),也是-pipe。


这是什么原因?为什么它会产生更好的可执行文件?

有哪些情况不起作用或者不是最好的事情?


我也不明白为什么不始终使位置独立代码

(-fPIC)?
I have been told that for extra efficiency we should always compile
code with frame pointer ommited (-fomit-frame-pointer), also -pipe.

What is the reason for this? Why does it make a better executable? Are
there situations where it doesn''t work or isn''t the best thing to do?

Also I don''t understand why not always make Position Independent Code
(-fPIC)?



comp.unix.programmer或gnu.gcc.help是更好的地方

问这些问题,因为他们处理的事情是不是由标准C定义的


-

Ben Pfaff
http://benpfaff.org


不使用帧指针可以使用额外的寄存器其他
Not using a frame pointer makes an extra register available for other

使用,这可以加速几乎没有寄存器的处理器(特别是在x86处理器上的b $ b)。
uses, which speeds things up on processors with few registers (in
particular, on x86 processors).



我还没有看到对现代x86 CPU的影响了。这个数字

的寄存器

与gcc代码生成器无关紧要(即使

amd64

没有显着的性能提升)。

I haven''t seen any influence on modern x86 CPU''s anymore. The number
of registers
does simply not matter with the gcc code generator at the moment (even
amd64
has no significant performance improvement).


另外我不明白为什么不总是使位置独立代码

(-fPIC)?
Also I don''t understand why not always make Position Independent Code
(-fPIC)?



大多数

系统的位置无关代码可能会稍微慢一些,这只是因为额外的间接性。共享

库需要它。


Position independent code is likely to be somewhat slower on most
systems, just because of extra indirections. It''s needed for shared
libraries.



仅限x86。 amd64有指令指针相对操作所以



没有额外的间接。

Only on x86. amd64 has Instruction pointer relative operations so
there is
no extra indirection.


这篇关于提示帧指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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