有没有办法来编译为ARM,而不是拇指X $ C $的C 4? [英] Is there a way to compile for ARM rather than Thumb in Xcode 4?

查看:443
本文介绍了有没有办法来编译为ARM,而不是拇指X $ C $的C 4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有很多浮点运算的回事苹果正建议进行ARM编译,而不是大拇指。我的整个应用程序几乎是一个大的浮点运算。

Apple is recommending to compiling for ARM rather than thumb if there are many floating point operations going on. My whole app is almost one big floating point operation.

下面是他们的iOS应用开发流程指南在说什么:

Here's what they say in the iOS App Development Workflow Guide:

iOS设备支持两种指令集ARM和Thumb。 X code使用
  默认情况下,Thumb指令,因为用拇指通常会降低
  相对于约35%code尺寸为ARM。有应用
  广泛浮点code,如果他们使用ARM可能会表现得更好
  指令,而不是拇指。您可以关闭拇指为您
  应用程序,所以它编译为ARM,通过设置编译为Thumb
  建立设置为无。

iOS devices support two instruction sets, ARM and Thumb. Xcode uses Thumb instructions by default because using Thumb typically reduces code size by about 35 percent relative to ARM. Applications that have extensive floating-point code might perform better if they use ARM instructions rather than Thumb. You can turn off Thumb for your application, so it compiles for ARM, by setting the Compile for Thumb build setting to No.

不过,我找不到任何编译为Thumb在我的构建设置设置。难道他们改名?或者是现在使用X code 4?

However, I cannot find any "Compile for Thumb" setting in my build settings. Did they rename it? Or is this unavailable now with Xcode 4?

推荐答案

首先,建议不要编译,以提高浮点性能设置Thumb指令才真正适用于旧的ARMv6设备。

First, the advice to not compile for the Thumb instruction set in order to improve floating point performance only really applies to the old ARMv6 devices.

ARMv7的硬件(iPhone 3G S和更新,包括所有的iPad)采用更高效的Thumb-2指令集,这不会遭受同样的排序浮点速度变慢的。对ARMv7版本,它在你建立拇指几乎所有的情况下,建议。我在回答提供有关此更详细一点这里

ARMv7 hardware (iPhone 3G S and newer, including all iPads) uses the more efficient Thumb-2 instruction set, which does not suffer the same sort of floating point slowdowns. For ARMv7 builds, it is recommended in almost all cases that you build for Thumb. I provide a little more detail about this in my answer here.

这可能是为什么这个编译器设置不再公开为常见的选择,因为ARMv7的设备是绝大多数iOS设备在那里。

This might be why this compiler setting is no longer exposed as a common option, because ARMv7 devices are the vast majority of iOS devices out there.

如果您想为您刚建立的ARMv6做到这一点,你可以去你的构建设置和鼠标放在其他C标志选项。点击出现该选项右侧的小加号按钮,添加一个条件ARMv6体系结构。再次这样做是为了创建一个用于ARMv7架构。在ARMv6体系结构,增加额外的编译器标志 -mno拇指(凯文建议)。

If you want to do this for just your ARMv6 builds, you can go to your build settings and mouse over the "Other C Flags" option. Click on the little plus button that appears to the right of this option and add a condition for the ARMv6 architecture. Do this again to create one for the ARMv7 architecture. Under the ARMv6 architecture, add the extra compiler flag of -mno-thumb (as Kevin suggests).

您应该结束了东西,看起来像以下内容:

You should end up with something that looks like the following:

我这样做是我的应用程序之一,因为我没有看到与旧的ARMv6设备上的性能提升。但是,如果不建设为Thumb的ARMv6,所以你要分析这首我的另一应用较慢。

I do this in one of my applications, because I did see a performance boost on the older ARMv6 devices with that. However, another of my applications was slower when not building for Thumb on ARMv6, so you'll want to profile this first.

此外,还有在LLVM编译器3.0目前的错误附带X $ C $ ç4.2 (这已被固定在4.2.1,从我听到),其中浮点计算都在拇指编译错误的ARMv6的。如果你用X code的某个特定版本,你需要做的正确的行为对旧设备。

Additionally, there is currently a bug in the LLVM Compiler 3.0 that ships with Xcode 4.2 (which has since been fixed in 4.2.1, from what I hear) where floating point calculations are compiled wrong under Thumb for ARMv6. If you're using that particular version of Xcode, you'll need to do this for proper behavior on the older devices.

这篇关于有没有办法来编译为ARM,而不是拇指X $ C $的C 4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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