This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,mips] avoid invalid register for JALR

Sandra Loosemore <> writes:
> When I was trying to benchmark another patch (which I'll be sending 
> along shortly) with CSiBE for -mabi=64, I ran into an assembler error 
> like this:
> /tmp/ccJv2faG.s: Assembler messages:
> /tmp/ccJv2faG.s:1605: Error: a destination register must be supplied
> `jalr $31'

JALR patterns should have an explicit clobber of $31, which I thought
was also supposed to stop $31 from being used as the call address.  E.g.:

int foo (void)
  typedef void (*type) (void);
  register type fn asm ("$31");
  asm ("foo %0" : "=r" (fn));
  fn ();
  return 1;

gives the expected shuffle:

 # 5 "/tmp/foo.c" 1
	foo $31
 # 0 "" 2
	move	$2,$31
	jalr	$2

If you change the asm to some other random register then the JALR
uses it directly.  Do you have a testcase?

> Indeed, GCC is generating invalid code here; the single-operand JALR 
> instruction doesn't permit the use of $31 because it is already the 
> implicit destination register.  The attached patch introduces a new 
> register class JALR_REGS to represent the valid set of registers for 
> this instruction, and modifies the "c" register constraint to use it.
> I had some difficulty in regression-testing this patch because of 
> unrelated problems on trunk in the past week -- at first I was getting 
> ICEs due to a null pointer dereference in tree code, then when I tried 
> again a couple days later trunk was not even building.

Could you give more details?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]