Re: asm operand requires impossible reload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > When I compile this c-File I get this error in the line, where the macro
> > is used:
> >
> > asm operand requires impossible reload
> >
> > What does this error message mean ?
>
> It means that the compiler was unable to find a register to use.  It's
> a strange error to get for an asm like this.  You may need to put
> together a complete small test case.

I could strip down my file to the attached example. Removing more instructions 
or types causes the error to disappear.
In my last mail I forgot to mention that I use the fr30 version of gcc 4.1.1 
(3.4.6) did not have the problem. The problem is in line 30.

> > If I compile using the -S switch, the generated assembler file looks fine
> > and the inline assembler is inserted right.
>
> That doesn't make sense.  If you get the error without -S, you should
> get the error with -S.

That would indeed be very strange. It was my fault. I was trying with 
different options and missed to delete temporary files. With option -da I get 
files until *.c.58.shorten

As I can imagine not everybody wants to build fr30 gcc to reproduce the error, 
I will post the part of c.58.shorten, that I think is relevant:

(note 188 21 23 ( __chan (expr_list:REG_DEP_TRUE (reg/v/f:SI 9 r9 [orig:43 
__chan ] [43])
    (const_int 0 [0x0]))) NOTE_INSN_VAR_LOCATION)

(note:HI 23 188 24 ("hal_if3.c") 30)

(insn:HI 24 23 122 hal_if3.c:30 (set (reg:SI 1 r1)
        (asm_operands/v:SI ("st   r1, @-r15 ;
mov   ps,     r1 ;
ldi:8 #0x10,  %0 ;
and   r1,     %0 ;
lsr   #1,     %0 ;
ld    @r15+,  r1 ;
andccr #0xef 
") ("=r") 0 []
             [] ("hal_if3.c") 30)) -1 (nil)
    (expr_list:REG_UNUSED (reg:SI 1 r1)
        (nil)))

(note:HI 122 24 147 NOTE_INSN_DELETED)

(insn 147 122 126 (set (reg:SI 2 r2)
        (reg/v/f:SI 9 r9 [orig:43 __chan ] [43])) 6 {movsi_internal} (nil)
    (nil))

You see the inline instructions with the %0 placeholder. What wants the 
compiler to do next ? As I read the RTL the compiler already choose r2 for 
the output variable r. It only has to replace the %0 by r2. What is its 
problem here ? Is there happening another reload pass ?

Thank you very much for your help,

Lars
typedef volatile unsigned int hal_virtual_comm_table_t[8];

typedef void (*__comm_if_putc_t)(void* __ch_data, unsigned char __ch);


static __inline__ void __call_COMM_IF_PUTC(hal_virtual_comm_table_t t, unsigned char _p1_) { void *dp = (void *)t[0];  ((__comm_if_putc_t)(t[3]))(dp, _p1_);  }


extern volatile unsigned int hal_virtual_vector_table[64];

typedef hal_virtual_comm_table_t *__call_if_console_procs_t;
typedef hal_virtual_comm_table_t *__call_if_debug_procs_t;


static __inline__ __call_if_debug_procs_t __call_vv_CYGNUM_CALL_IF_DEBUG_PROCS(void) { return ((__call_if_debug_procs_t)hal_virtual_vector_table[6]); }


static char __mangler_line[100];
static int __mangler_pos = 0;

void
cyg_hal_diag_mangler_gdb_flush(void* __ch_data)
{
    unsigned int old;
    hal_virtual_comm_table_t* __chan = __call_vv_CYGNUM_CALL_IF_DEBUG_PROCS();


    do {
        register int x ;
        asm volatile (
                 "st   r1, @-r15 ;\n"
                 "mov   ps,     r1 ;\n"
                 "ldi:8 #0x10,  %0 ;\n"
                 "and   r1,     %0 ;\n"
                 "lsr   #1,     %0 ;\n"
                 "ld    @r15+,  r1 ;\n"
                 "andccr #0xef \n"
            : "=r" (x) );
        (old) = (x);
    } while (0);
    while(1)
    {
 static const char hex[] = "0123456789ABCDEF";
 unsigned char csum = 0;
 char c1;
 int i;


 csum += 'O';
 for( i = 0; i < __mangler_pos; i++ )
        {
     char ch = __mangler_line[i];
     char h = hex[(ch>>4)&0xF];
     char l = hex[ch&0xF];
     __call_COMM_IF_PUTC(*__chan,h);
     __call_COMM_IF_PUTC(*__chan,l);
     csum += h;
     csum += l;
 }

    nak:

 if( c1 == '+' ) break;

 if( c1 != '-' ) goto nak;
    }

    __mangler_pos = 0;

    do {
        register int x = old;
        asm volatile (
                "CMP #8, %0 ;\n"
                "BEQ 0f ;\n"
                "ANDCCR #0xEF ;\n"
                "BRA 1f;\n" "0:\n"
                "ORCCR #0x10 ;\n"
                "1:\n" : : "r"(x) );
    } while (0);

}

Attachment: pgpiESNYIdXYZ.pgp
Description: PGP signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux