From: dimmy <diwil@mail.ru>
To: Jan Hubicka <jh@suse.cz>
Cc: gcc@gcc.gnu.org
Subject: Re: Legitimize address, Please HELP!
Date: Wed, 05 Dec 2001 08:23:00 -0000 [thread overview]
Message-ID: <3C0E5775.1040904@mail.ru> (raw)
In-Reply-To: <20011205163059.M30680@atrey.karlin.mff.cuni.cz>
Jan,
return is not missing.
Even some improvements to legitimate_address_p
such as:
-------------------
int
legitimate_address_p (mode, operand, strict)
enum machine_mode mode;
rtx operand;
int strict;
{
rtx xfoob, x = operand;
if (GET_CODE (operand) == PLUS
&& ((GET_CODE (XEXP (operand, 0)) == MEM )
||GET_CODE (XEXP (operand, 1)) == MEM )
)
{
fprintf(stderr,"interesting address mode\n");
goto fail;
}
xfoob = XEXP (operand, 0);
if (GET_CODE (operand) == MEM
&& GET_CODE (xfoob) == PLUS
&& GET_CODE (XEXP (xfoob, 0)) == MEM)
{
fprintf(stderr,"Super interesting address mode\n");
goto fail;
}
if (GET_CODE (operand) == PLUS
&& GET_CODE (XEXP (operand, 0)) == PLUS)
return 0;
/* accept @Rn */
if (GET_CODE (operand) == REG
&&(strict ? REG_OK_FOR_BASE_STRICT_P (x)
: REG_OK_FOR_BASE_NOSTRICT_P (x)))
goto granded;
/* accept address */
if (CONSTANT_ADDRESS_P (operand))
goto granded;
/* 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))
)
goto granded;
fail:
return 0;
granded:
fprintf(stderr,"legitimate_address_p --- Ok\n");
return 1;
}
do not help.
I thought that it might be cause I defined
frame_pointer_regnum equial to stack pointer.
Now I assigned frame_pointer_regnum to another register and still got
the same error.
This happens only when frame pointer required.
here is the part of RTL dump:
(jump_insn/i 451 450 452 (set (pc)
(if_then_else (ne (cc0)
(const_int 0 [0x0]))
(label_ref 380)
(pc))) 127 {bne} (nil)
(expr_list:REG_BR_PROB (const_int 6001 [0x1771])
(nil)))
*****************/
jne .L402 ; .L402
/*****************
(insn/i 457 946 458 (set (mem/s:HI (plus:HI (reg/v:HI 6 r6 [136])
(const_int 2 [0x2])) 0)
(plus:HI (mem/s:HI (plus:HI (reg/v:HI 6 r6 [136])
(const_int 2 [0x2])) 0)
(mem/s:HI (plus:HI (mem:HI (plus:HI (reg/f:HI 4 r4)
(const_int 22 [0x16])) 0)
(const_int 2 [0x2])) 0))) 37 {*addhi3_3} (nil)
(expr_list:REG_DEAD (reg/v:HI 6 r6 [136])
(nil)))
*****************/
add 2(22(r4)), 2(r6) ; ----- INVALID!!
;; will be output as: add 2(r675750800), 2(r6)
.L401:
/*****************
(insn/i 461 460 462 (set (reg:HI 15 r15)
(mem/s:HI (plus:HI (reg/f:HI 4 r4)
(const_int 2 [0x2])) 0)) 26 {*movhi3} (nil)
(nil))
*****************/
mov 2(r4), r15
So, thank you anyway.
Dmitry
Jan Hubicka wrote:
>>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;
>>
>Missing return 0;
>
>>}
>>--------------------------
>>
>>Shall I define something else to prevent invalid address generation or what?
>>
>
>It is normal for invalid addresses to be generated and rejected
>during the compilation.
>If you want to do some special tricks, you may define LEGITIMIZE
>macros, but in your case, it the default behaviour is most probably
>OK. I guess only problem is the missing return :)
>
>Honza
>
>
next prev parent reply other threads:[~2001-12-05 16:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-05 3:36 dimmy
2001-12-05 7:31 ` Jan Hubicka
2001-12-05 8:23 ` dimmy [this message]
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=3C0E5775.1040904@mail.ru \
--to=diwil@mail.ru \
--cc=gcc@gcc.gnu.org \
--cc=jh@suse.cz \
/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).