| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| X-Injected-Via-Gmane: | http://gmane.org/ |
| To: | cygwin AT cygwin DOT com |
| From: | "Alex Vinokur" <alexvn AT connect DOT to> |
| Subject: | Is a function actually inlined? |
| Date: | Wed, 8 Oct 2003 11:19:27 +0200 |
| Lines: | 127 |
| Message-ID: | <bm0ks2$j8i$2@sea.gmane.org> |
| X-Complaints-To: | usenet AT sea DOT gmane DOT org |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 6.00.2800.1106 |
| X-Mimeole: | Produced By Microsoft MimeOLE V6.00.2800.1106 |
========================================
Windows 2000 Professional
CYGWIN_NT-5.0 1.5.4(0.94/3/2)
GNU gcc version 3.3.1 (cygming special)
GNU nm 2.14.90 20030901
GNU objdump 2.14.90 20030901
=======================================
How can one know if a function requested to be inlined is actually inlined?
Here is an example.
Are the foo2() and foo3() functions actually inlined?
====== 1. C++ code : File t.cpp : BEGIN ======
struct Foo
{
void foo1();
void foo2() {} // requested to be inlined
void foo3();
};
void Foo::foo1() {}
inline void Foo::foo3() {} // requested to be inlined
int main()
{
Foo ins;
ins.foo1();
ins.foo2();
ins.foo3();
return 0;
}
====== 1. C++ code : File t.cpp : END ========
====== 2. Compilation : BEGIN ======
$ g++ -save-temps t.cpp
====== 2. Compilation : END ========
====== 3. Analysis of the t.s file : BEGIN ======
$ grep foo t.s
.globl __ZN3Foo4foo1Ev
.def __ZN3Foo4foo1Ev; .scl 2; .type 32; .endef
__ZN3Foo4foo1Ev:
call __ZN3Foo4foo1Ev
call __ZN3Foo4foo2Ev
call __ZN3Foo4foo3Ev
.section .text$_ZN3Foo4foo2Ev,"x"
.globl __ZN3Foo4foo2Ev
.def __ZN3Foo4foo2Ev; .scl 2; .type 32; .endef
__ZN3Foo4foo2Ev:
.section .text$_ZN3Foo4foo3Ev,"x"
.globl __ZN3Foo4foo3Ev
.def __ZN3Foo4foo3Ev; .scl 2; .type 32; .endef
__ZN3Foo4foo3Ev:
.def __ZN3Foo4foo3Ev; .scl 3; .type 32; .endef
.def __ZN3Foo4foo2Ev; .scl 3; .type 32; .endef
====== 3. Analysis of the t.s file : END ========
====== 4. Use of the nm utility : BEGIN ======
$ nm -C t.o
00000000 b .bss
00000000 d .data
00000000 t .text
00000000 t .text$_ZN3Foo4foo2Ev
00000000 t .text$_ZN3Foo4foo3Ev
00000000 T Foo::foo1()
00000000 T Foo::foo2()
00000000 T Foo::foo3()
U __main
U _alloca
00000006 T main
====== 4. Use of the nm utility : END ========
====== 5. Use of the objdump utility : BEGIN ======
$ objdump -CS t.o | grep foo
00000000 <Foo::foo1()>:
2a: e8 d1 ff ff ff call 0 <Foo::foo1()>
Disassembly of section .text$_ZN3Foo4foo2Ev:
00000000 <Foo::foo2()>:
Disassembly of section .text$_ZN3Foo4foo3Ev:
00000000 <Foo::foo3()>:
$ objdump -CS t.o | grep foo
1a: e8 00 00 00 00 call 1f <main+0x19>
1f: e8 00 00 00 00 call 24 <main+0x1e>
2a: e8 d1 ff ff ff call 0 <Foo::foo1()>
35: e8 00 00 00 00 call 3a <main+0x34>
40: e8 00 00 00 00 call 45 <main+0x3f>
====== 5. Use of the objdump utility : END ========
=====================================
Alex Vinokur
mailto:alexvn AT connect DOT to
http://mathforum.org/library/view/10978.html
=====================================
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |