内联一个.s文件的函数? [英] inline a function from a .s file?

查看:136
本文介绍了内联一个.s文件的函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


是否可以内联一个主要的<。

文件(即sqrtl的优化版本)中声明的函数br />
程序循环?


i使用intel c / c ++编译器如下:


icc -O3 sqrtlof.c dbl_ext_sqrt.s -o sqrtlof


但objdump -d显示仍然调用函数dbl_ext_sqrt()和编译器报告

>
表示该功能无法内联,因为

其外部:


INLINING REPORT :(主要)

>
-dbl_ext_sqrt(EXTERN)


i将函数定义为''static inline''。


时的行为完全相同我在同一台机器上使用gcc。


regars,

cjm

- < br>
上帝拯救女王

和她的法西斯政权 - Sex Pistols

解决方案

文章< sl ******************** ****@s2.enemy.org>,

Chris J. Mutter< cj ******** @ s2.enemy.orgwrote:


>是否可以在主要的程序循环中内联在.s
文件中声明的函数(即sqrtl的优化版本)?



这是你需要在新闻组中询问的东西

,它知道你的编译器。标准

C语言对.s文件一无所知

-

原型是其克隆的超类型。 - maplesoft


Chris J. Mutter写道:


你好,


是否可以在主要的
程序循环中内联在.s

文件(即sqrtl的优化版本)中声明的函数?


i使用了intel c / c ++编译器,如下所示:


icc -O3 sqrtlof.c dbl_ext_sqrt.s -o sqrtlof


这是胡说八道。如果您在

另一个文件中定义它,那么您如何期望编译器内联该函数




你应该阅读你的编译器的文档

1)找出在

c函数中使用汇编的方法

2)写你的使用这样的内联汇编程序的函数

asm(" movl foo,eax");

或编译器文档告诉你的任何内容(参见步骤1)。

3)声明你的功能


静态内联myasmfn(int n)

{

asm(" movl %eax,%ecx");

...

}


和*可以*工作。


在文章< f1 ********* @ canopus.cc.umanitoba.ca>中,

Walter Roberson< ro * *****@ibd.nrc-cnrc.gc.cawrote:


>在文章< sl *********** *************@s2.enemy.org> ;,
Chris J. Mutter< cj ******** @ s2.enemy.orgwrote:


>>是否可以内联在.s
文件中声明的函数(即主要程序循环中的sqrtl的优化版本?


这是你需要在新闻组中询问的东西,它知道你的编译器。标准的C语言对.s文件一无所知。



IOW,这里没有人对你或你的问题嗤之以鼻。


您可能会发现以下部分或全部链接有助于理解

为何如此:

http://en.wikipedia.org/wiki/Aspergers
http://en.wikipedia.org/wiki/Clique
http://en.wikipedia.org/wiki/C_programming_language


hello,

is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?

i used the intel c/c++ compiler as follows:

icc -O3 sqrtlof.c dbl_ext_sqrt.s -o sqrtlof

but objdump -d showed that there is still a call to
the function dbl_ext_sqrt() and the compiler report
states that the function could not be inlined because
its extern:

INLINING REPORT: (main)

-dbl_ext_sqrt(EXTERN)

i defined the function as ''static inline''.

exactly the same behaviour when i use gcc on the same
machine.

regars,
cjm
--
"God save the queen
and her fascist regime" -- Sex Pistols

解决方案

In article <sl************************@s2.enemy.org>,
Chris J. Mutter <cj********@s2.enemy.orgwrote:

>is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?

That''s something you need to ask about in a newsgroup
that knows something about your compiler(s). The standard
C language doesn''t know anything about .s files
--
Prototypes are supertypes of their clones. -- maplesoft


Chris J. Mutter wrote:

hello,

is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?

i used the intel c/c++ compiler as follows:

icc -O3 sqrtlof.c dbl_ext_sqrt.s -o sqrtlof

This is nonsense. How do you expect that that function
will be inlined by the compiler if you define it in
another file?

You should read the documentation of your compiler to
1) Figure out what is the method for using assembly within a
c function
2) Write your function using inline assembler like this
asm("movl foo,eax");
or whatever the compiler docs tell you (see step 1).
3) declare your function

static inline myasmfn(int n)
{
asm("movl %eax,%ecx");
...
}

and that *could* work.


In article <f1*********@canopus.cc.umanitoba.ca>,
Walter Roberson <ro******@ibd.nrc-cnrc.gc.cawrote:

>In article <sl************************@s2.enemy.org>,
Chris J. Mutter <cj********@s2.enemy.orgwrote:

>>is it possible to inline a function declared in a .s
file (i.e. a optimized version of sqrtl) within a main
program loop?


That''s something you need to ask about in a newsgroup
that knows something about your compiler(s). The standard
C language doesn''t know anything about .s files

IOW, nobody here gives a shit about you or your problems.

You may find some or all of the following links helpful in understanding
why this is so:

http://en.wikipedia.org/wiki/Aspergers
http://en.wikipedia.org/wiki/Clique
http://en.wikipedia.org/wiki/C_programming_language


这篇关于内联一个.s文件的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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