From: Peter Barada <pbarada@mail.wm.sps.mot.com>
Cc: gcc@gcc.gnu.org
Subject: How are case statements laid out?
Date: Mon, 03 Dec 2001 09:52:00 -0000 [thread overview]
Message-ID: <200112031751.fB3HpxF15273@hyper.wm.sps.mot.com> (raw)
In-Reply-To: <Pine.BSF.4.42.0112031524050.66463-100000@naos.dbai.tuwien.ac.at>
I noticed that the case statement for 68k/Coldfire generates code
along the lines of:
.set .LI87,.+2
move.w .L87-.LI87.b(%pc,%d0.l*2),%d0
ext.l %d0
jmp %pc@(2,%d0:l)
.align 2
.swbeg &10
.L87:
.word .L64-.L87
.word .L65-.L87
.word .L64-.L87
This allows a displacement between .L87 and the start of the case body
to be up to 32767 bytes away(forward or backward since %d0 is
*sign-extended*). If the code is changed to:
.set .LI87,.+2
moveq.l #0,%d0
move.w .L87-.LI87.b(%pc,%d0.l*2),%d0
jmp %pc@(2,%d0:l)
.align 2
.swbeg &10
.L87:
.word .L64-.L87
.word .L65-.L87
.word .L64-.L87
Then the displacement can go *forward* up to 65535 bytes away(since
%d0 is *zero-extended*). My question is whether or not the compiler
*always* places the switch selector before the case body?
--
Peter Barada Peter.Barada@motorola.com
Wizard 781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)
next prev parent reply other threads:[~2001-12-03 17:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-17 15:24 copyright assignment papers Adam Megacz
2001-11-18 5:16 ` Alexandre Petit-Bianco
2001-11-26 17:29 ` Alexandre Petit-Bianco
2001-12-03 6:24 ` Gerald Pfeifer
2001-12-03 9:52 ` Peter Barada [this message]
2001-12-03 14:55 ` How are case statements laid out? Richard Henderson
2001-12-04 7:11 ` Peter Barada
2001-12-04 10:00 ` Richard Henderson
2001-11-26 14:50 ` copyright assignment papers Adam Megacz
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=200112031751.fB3HpxF15273@hyper.wm.sps.mot.com \
--to=pbarada@mail.wm.sps.mot.com \
--cc=gcc@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).