SH4 inline assemble

来源:互联网 发布:算法概念的卷子 编辑:程序博客网 时间:2024/06/05 21:00

转自:http://msdn.microsoft.com/zh-cn/library/aa448670.aspx

SH4 对于MSVS编译器来说目前并不支持内联汇编

Limitations of the __asm Keyword in SH-4 Inline Assembly (Windows CE 5.0)

Windows CE 5.0
此主题尚未评级 评价此主题
Send Feedback

Source code that uses the __asm instruction cannot be compiled with the /GL - Enable Link-Time Code Generation option. Unlike other target architectures, the SH4 treats the __asm instruction as a special function call; the string containing the instruction is treated as an argument to the function.

Furthermore, the SH-4 front-end treats any function that begins with the __asm string in this way. For example, the following code examples both define inline-asm functions that follow the standard SH4 call conventions.

int asm_int(const char *);float asm_float(const char *);

In the preceding examples, the SH-4 assumes that any return value of __asm_int() is an integer in R0. Similarly, SH-4 assumes the return value for __asm_float() is a floating point number in fr0. Thus, the SH-4 user can have multiple __asm functions that interface with any other code in a predictable manner.

This strategy causes difficulties for Link-time Code Generation (LTCG), because the compiler back-end, which processes the __asmcalls, is invoked after the linker is invoked.

The linker treats all the __asm calls as simply another function call and attempts to resolve all __asm function calls to their definitions.

However, because __asm is not a conventional function, it has no definition: the compiler back-end replaces an __asm function call with SH-4 instructions. Thus, if the user attempts LTCG, the linker generates a linker error that indicates the symbol __asm is not defined.

原创粉丝点击