This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.3: inline-asm problems
> On Fri, Mar 21, 2003 at 08:45:10PM +0100, Jan Hubicka wrote:
> > What about making the error message of ellimination to look like error
> > message of reload? (ie when the instruction is bogus do not abort but
> > spit out something like "inconsistent asm operand constraints").
>
> I've mentioned this before. I think it's a good idea.
Fri Mar 21 21:51:00 CET 2003 Jan Hubicka <jh at suse dot cz>
PR inline-asm/7916
* function.c (instantiate_virtual_regs_lossage): New function.
(instantiate_virtual_regs_1): Use it.
(instantiate_virtual_regs): Do not continue in substition when insn has
been deleted.
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.409
diff -c -3 -p -r1.409 function.c
*** function.c 18 Mar 2003 19:49:41 -0000 1.409
--- function.c 21 Mar 2003 20:50:50 -0000
*************** static void compute_insns_for_mem PARAMS
*** 295,300 ****
--- 295,301 ----
static void prepare_function_start PARAMS ((void));
static void do_clobber_return_reg PARAMS ((rtx, void *));
static void do_use_return_reg PARAMS ((rtx, void *));
+ static void instantiate_virtual_regs_lossage PARAMS ((rtx));
/* Pointer to chain of `struct function' for containing functions. */
static GTY(()) struct function *outer_function_chain;
*************** instantiate_virtual_regs (fndecl, insns)
*** 3540,3545 ****
--- 3541,3548 ----
|| GET_CODE (insn) == CALL_INSN)
{
instantiate_virtual_regs_1 (&PATTERN (insn), insn, 1);
+ if (INSN_DELETED_P (insn))
+ continue;
instantiate_virtual_regs_1 (®_NOTES (insn), NULL_RTX, 0);
/* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE. */
if (GET_CODE (insn) == CALL_INSN)
*************** instantiate_new_reg (x, poffset)
*** 3712,3717 ****
--- 3715,3732 ----
return new;
}
+ static void
+ instantiate_virtual_regs_lossage (insn)
+ rtx insn;
+ {
+ if (asm_noperands (PATTERN (insn)) >= 0)
+ {
+ error_for_asm (insn, "impossible constraint in `asm'");
+ delete_insn (insn);
+ }
+ else
+ abort ();
+ }
/* Given a pointer to a piece of rtx and an optional pointer to the
containing object, instantiate any virtual registers present in it.
*************** instantiate_virtual_regs_1 (loc, object,
*** 3747,3752 ****
--- 3762,3770 ----
x = *loc;
if (x == 0)
return 1;
+ /* We may detect invalid asm statements and deleted them. */
+ if (object && INSN_P (object) && INSN_DELETED_P (object))
+ return 1;
code = GET_CODE (x);
*************** instantiate_virtual_regs_1 (loc, object,
*** 3785,3791 ****
/* The only valid sources here are PLUS or REG. Just do
the simplest possible thing to handle them. */
if (GET_CODE (src) != REG && GET_CODE (src) != PLUS)
! abort ();
start_sequence ();
if (GET_CODE (src) != REG)
--- 3803,3812 ----
/* The only valid sources here are PLUS or REG. Just do
the simplest possible thing to handle them. */
if (GET_CODE (src) != REG && GET_CODE (src) != PLUS)
! {
! instantiate_virtual_regs_lossage (object);
! return 1;
! }
start_sequence ();
if (GET_CODE (src) != REG)
*************** instantiate_virtual_regs_1 (loc, object,
*** 3801,3807 ****
if (! validate_change (object, &SET_SRC (x), temp, 0)
|| ! extra_insns)
! abort ();
return 1;
}
--- 3822,3828 ----
if (! validate_change (object, &SET_SRC (x), temp, 0)
|| ! extra_insns)
! instantiate_virtual_regs_lossage (object);
return 1;
}
*************** instantiate_virtual_regs_1 (loc, object,
*** 3911,3917 ****
emit_insn_before (seq, object);
if (! validate_change (object, loc, temp, 0)
&& ! validate_replace_rtx (x, temp, object))
! abort ();
}
}
--- 3932,3941 ----
emit_insn_before (seq, object);
if (! validate_change (object, loc, temp, 0)
&& ! validate_replace_rtx (x, temp, object))
! {
! instantiate_virtual_regs_lossage (object);
! return 1;
! }
}
}
*************** instantiate_virtual_regs_1 (loc, object,
*** 4067,4073 ****
emit_insn_before (seq, object);
if (! validate_change (object, loc, temp, 0)
&& ! validate_replace_rtx (x, temp, object))
! abort ();
}
}
--- 4091,4097 ----
emit_insn_before (seq, object);
if (! validate_change (object, loc, temp, 0)
&& ! validate_replace_rtx (x, temp, object))
! instantiate_virtual_regs_lossage (object);
}
}