This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Legitimize address, Please HELP!
- From: "dimmy the wild" <diwil at mail dot ru>
- To: rth at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 06 Dec 2001 15:50:51 +0300
- Subject: Re: Legitimize address, Please HELP!
- Reply-to: "dimmy the wild" <diwil at mail dot ru>
Richard,
thanks...
I set it up as:
/* accept X(Rn) : (Rn + X) points to the operand address*/
if (GET_CODE (operand) == PLUS
&& GET_CODE (XEXP (operand, 0)) == REG
&& CONSTANT_ADDRESS_P (XEXP (operand, 1))
&&(strict ? REG_OK_FOR_BASE_STRICT_P (XEXP (operand, 0))
: REG_OK_FOR_BASE_NOSTRICT_P (XEXP (operand, 0)))
)
goto granded;
Did not help eather.
Also, I found, that if fails to compile the following:
static /* inline */ fde *
binary_search_mixed_encoding_fdes (struct object *ob, void *pc)
{
#ifdef WILL_CRASH_IF_NOT_DEFINED
char tt[20];
#endif
struct fde_vector *vec = ob->u.sort; /* THIS LEADS TO INCORRECT CODE */
size_t lo, hi;
#ifdef WILL_CRASH_IF_NOT_DEFINED
/* this is not a part of unwind-dw2-fde.c
but these two dummie calls helping gcc to produce correct code!!!
*/
set(vec->array,&lo,&hi,tt);
reset(vec,tt, lo,hi);
#endif
for (lo = 0, hi = vec->count; lo < hi; )
{
size_t i = (lo + hi) / 2;
fde *f = vec->array[i];
_Unwind_Ptr pc_begin, pc_range;
const char *p;
int encoding;
encoding = get_fde_encoding (f);
p = read_encoded_value_with_base (encoding,
base_from_object (encoding,
ob),
f->pc_begin, &pc_begin);
read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range);
if ((_Unwind_Ptr)pc < pc_begin)
hi = i;
else if ((_Unwind_Ptr)pc >= pc_begin + pc_range )
lo = i + 1;
else
return f;
}
return 0;
}
which is a part of unwind-dw2-fde.c
But, guring gcc build xgcc does not complain about wrong operand (assembler
does), but if I run
cc1 it 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)
One more thing:
The function above is inlined in unwind-dw2-fde.c
Any sort of optimization results as wrong operand,
Absemse of optimization results Unrecognizable insn.
The example above can be compiled without optimization fine.
With -Ox it produces wrong code but does not complain about
wron addressing mode.
Does anybody have any idea why?
If you want I can send you complete sources of the gcc port.
Thanks in advance,
Dmitry.
On Wed, 5 Dec 2001 15:51:13 -0800
Richard Henderson <rth@redhat.com> wrote:
> On Wed, Dec 05, 2001 at 03:33:37PM +0300, dimmy wrote:
> > if (GET_CODE (operand) == PLUS
> > && GET_CODE (XEXP (operand, 0)) == REG
> > && REG_OK_FOR_BASE_P (XEXP (operand, 0))
>
> Should depend on strict here.
>
>
> r~
>
*********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 314-8860, 5585314
*********************************************************************