Commit 91c4e421 by David Holsgrove Committed by Michael Eager

Add microblaze_legitimate_pic_operand method

Prevents ICE where insn contains an invalid address

	* config/microblaze/microblaze.c (microblaze_valid_pic_const): New 
	(microblaze_legitimate_pic_operand): Likewise
	* config/microblaze/microblaze.h (LEGITIMATE_PIC_OPERAND_P): calls 
	new function microblaze_legitimate_pic_operand
	* config/microblaze/microblaze-protos.h
	(microblaze_legitimate_pic_operand): Declare.

From-SVN: r196434
parent 82f8f53a
2013-03-04 David Holsgrove <david.holsgrove@xilinx.com>
* config/microblaze/microblaze.c (microblaze_valid_pic_const): New
(microblaze_legitimate_pic_operand): Likewise
* config/microblaze/microblaze.h (LEGITIMATE_PIC_OPERAND_P): calls
new function microblaze_legitimate_pic_operand
* config/microblaze/microblaze-protos.h
(microblaze_legitimate_pic_operand): Declare.
2013-03-04 Edgar E. Iglesias <edgar.iglesias@gmail.com>
* config/microblaze/predicates.md (call_insn_simple_operand):
......
......@@ -49,6 +49,7 @@ extern HOST_WIDE_INT microblaze_initial_elimination_offset (int, int);
extern void microblaze_declare_object (FILE *, const char *, const char *,
const char *, int);
extern void microblaze_asm_output_ident (const char *);
extern int microblaze_legitimate_pic_operand (rtx);
#endif /* RTX_CODE */
/* Declare functions in microblaze-c.c. */
......
......@@ -596,6 +596,32 @@ microblaze_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
return microblaze_classify_address (&addr, x, mode, strict);
}
int
microblaze_valid_pic_const (rtx x)
{
switch (GET_CODE (x))
{
case CONST:
case CONST_INT:
case CONST_DOUBLE:
return true;
default:
return false;
}
}
int
microblaze_legitimate_pic_operand (rtx x)
{
struct microblaze_address_info addr;
if (pic_address_needs_scratch (x))
return 0;
if (!microblaze_valid_pic_const(x))
return 0;
return 1;
}
/* Try machine-dependent ways of modifying an illegitimate address
to be legitimate. If we find one, return the new, valid address.
......
......@@ -541,7 +541,7 @@ typedef struct microblaze_args
/* Define this, so that when PIC, reload won't try to reload invalid
addresses which require two reload registers. */
#define LEGITIMATE_PIC_OPERAND_P(X) (!pic_address_needs_scratch (X))
#define LEGITIMATE_PIC_OPERAND_P(X) microblaze_legitimate_pic_operand (X)
#define CASE_VECTOR_MODE (SImode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment