From: dimmy <diwil@mail.ru>
To: gcc@gcc.gnu.org
Subject: Legitimize address, Please HELP!
Date: Wed, 05 Dec 2001 03:36:00 -0000 [thread overview]
Message-ID: <3C0E1421.1080906@mail.ru> (raw)
Fellows,
Sorry bothering you.
I am writing msp430 support and got a question:
How to get rid of operands like:
(mem/s:HI (plus:HI (mem:HI (plus:HI (reg/f:HI 1 r1)
(const_int 18 [0x12])) 0)
(const_int 2 [0x2])) 3))
The CPU core does support (mem:xx (plus reg:xx const_int)), but not the
operand above.
I define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR)
as:
------------------------
#ifdef REG_OK_STRICT
# define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
{ \
if (legitimate_address_p (mode, operand, 1)) \
goto ADDR; \
}
# else
# define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
{ \
if (legitimate_address_p (mode, operand, 0)) \
goto ADDR; \
}
#endif
--------------------------
where legitimate_address_p is defined as follows:
--------------------------
int
legitimate_address_p (mode, operand, strict)
enum machine_mode mode;
rtx operand;
int strict;
{
rtx x = operand;
/* accept @Rn */
if (GET_CODE (operand) == REG
&&(strict ? REG_OK_FOR_BASE_STRICT_P (x)
: REG_OK_FOR_BASE_NOSTRICT_P (x)))
return 1;
/* accept address */
if (CONSTANT_ADDRESS_P (operand))
return 1;
/* accept X(Rn) */
if (GET_CODE (operand) == PLUS
&& GET_CODE (XEXP (operand, 0)) == REG
&& REG_OK_FOR_BASE_P (XEXP (operand, 0))
&& CONSTANT_ADDRESS_P (XEXP (operand, 1)))
return 1;
}
--------------------------
Shall I define something else to prevent invalid address generation or what?
By now I cannot compile only 'unwind-dw2-fde.c' in gcc-3.0/gcc
Everything else seems to be fine!!!
by the way, when I run xgcc, it produces invalid code,
when cc1, it does not want to compile and says:
unwind-dw2-fde.c: In function `search_object':
unwind-dw2-fde.c:930: Unrecognizable insn:
(insn 1212 29 30 (set (reg:HI 14 r14 [49])
(mem/s:HI (plus:HI (mem:HI (plus:HI (reg/f:HI 1 r1)
(const_int 12 [0xc])) 0)
(const_int 10 [0xa])) 13)) -1 (nil)
(nil))
Tricks like if (GET_CODE (operand) == PLUS && GET_CODE (XEXP (operand,
0)) == MEM) return 0; do not help at all.
Thanks in advance,
Dmitry.
next reply other threads:[~2001-12-05 11:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-05 3:36 dimmy [this message]
2001-12-05 7:31 ` Jan Hubicka
2001-12-05 8:23 ` dimmy
2001-12-05 9:16 ` Jan Hubicka
[not found] ` <3C0E6806.3060706@mail.ru>
2001-12-05 9:52 ` Jan Hubicka
2001-12-05 11:14 ` dimmy
2001-12-05 11:23 ` Jan Hubicka
2001-12-05 15:52 ` Richard Henderson
2001-12-06 5:03 dimmy the wild
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=3C0E1421.1080906@mail.ru \
--to=diwil@mail.ru \
--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).