public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Josef Angermeier <sijoange@cip.informatik.uni-erlangen.de>
To: gcc-help@gcc.gnu.org
Subject: gcc's x86 "RET"-machine instruction optimization
Date: Mon, 01 Aug 2005 13:56:00 -0000	[thread overview]
Message-ID: <20050801135646.GC11284@faui00i.informatik.uni-erlangen.de> (raw)


Hello

Im trying to write a script which patches gcc's assembler output (-S
option) in that way, that those functions which are exported (.gobl
asm-directive) return with a near-jump instead of a
near-return-instruction. (Im writing a BIOS for a virtual machine...)

So i fist that it would be an easy task to replace all
"retl"-instructions by "lretw" ones in gcc's asm code. But then now im
facing a problem:

C code like that:
kbd.c:

bios_16_xxxx(struct regs *regs)
{
	if (AH == 0x00) {
		bios_16_00xx(regs);
	} else {
		....
	}
}

kbd.s

bios_16_xxxx:
.LCFI71:
	...
	jmp	bios_16_00xx
.L105:
	...
	lretw		(PATCHED RETURN)


....


bios_16_00xx:
.LFB59:
	...
	ret


GCC uses a jmp-instruction instead of a call one, so 'speeds up' execution by
saving the execution of bios_16_xxxx's return instruction (lretw one). This of course
ruins my efforts. Therfore i'd like to know how this optimization is called, and if
there is any gcc option to disable this particular optimization.

Big thanks in advance
josef

             reply	other threads:[~2005-08-01 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-01 13:56 Josef Angermeier [this message]
2005-08-01 17:19 ` Ian Lance Taylor
2005-08-01 19:01   ` Josef Angermeier

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=20050801135646.GC11284@faui00i.informatik.uni-erlangen.de \
    --to=sijoange@cip.informatik.uni-erlangen.de \
    --cc=gcc-help@gcc.gnu.org \
    /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).