public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Brian Dessent <brian@dessent.net>
To: John Fine <johnsfine@verizon.net>
Cc: VM <mayeski@gmail.com>, gcc-help@gcc.gnu.org
Subject: Re: how to pass params to inline functions by reference or value?
Date: Fri, 11 Apr 2008 11:57:00 -0000	[thread overview]
Message-ID: <47FE8AB6.979D0821@dessent.net> (raw)
In-Reply-To: <47FE27E0.1020205@verizon.net>

John Fine wrote:

> All that assumes the compiler really does take your suggestion of
> "inline".  As someone else already mentioned, "inline" is just a
> suggestion.  If the code weren't inlined then the optimizer could not
> avoid the copy operation.

That is what "static inline" or "__attribute__((always_inline))" is for.

Tony Wetmore wrote:

> I have used the following command-line in the past to generate assembly
> alisting files (with integrated source):
> 
>    gcc -c -g -O3 -Wa,-adhls=func.list func.c
> 
> As part of the assembly process, the "func.list" file is generated,
> containing the source and assembly, like so:

That is one way, you can also use objdump:

objdump -drwS func.o

This of course requires that func.o was compiled with debug info (-g),
otherwise there's no source line information.  Note that when looking at
the disassembly output of an unlinked object it's easy to get confused
if you don't pay attention to relocs, as e.g. jump targets and function
calls are all encoded as zero in the opcode, as the linker has not run
yet.  But the actual symbolic location is encoded in the reloc, and with
-r objdump should make this clear enough.

Brian

      reply	other threads:[~2008-04-10 21:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10  5:55 VM
2008-04-10 13:32 ` Ted Byers
2008-04-10 13:37   ` Vincent Mayeski
2008-04-10 14:45     ` Ted Byers
2008-04-10 15:11     ` Eljay Love-Jensen
2008-04-10 15:37       ` Vincent Mayeski
2008-04-10 21:39         ` Tony Wetmore
2008-04-10 15:33 ` John Fine
2008-04-11 11:57   ` Brian Dessent [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47FE8AB6.979D0821@dessent.net \
    --to=brian@dessent.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=johnsfine@verizon.net \
    --cc=mayeski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).