Add a new parameter to the function output_return_instruction to handle simple...

Add a new parameter to the function output_return_instruction to handle
simple cases of return when no epilogue needs to be printed out.

gcc/ 

2012-06-18  Ian Bolton  <ian.bolton@arm.com>
            Sameera Deshpande  <sameera.deshpande@arm.com>
            Greta Yorsh  <greta.yorsh@arm.com>

        * config/arm/arm-protos.h (output_return_instruction): New parameter and
	int to bool change of parameter types.
        * config/arm/arm.c (output_return_instruction): Likewise.
        * config/arm/arm.md (arm_simple_return): New pattern.
        (arm_return, cond_return, cond_return_inverted): Add new arguments.
        * config/arm/thumb2.md (thumb2_return): Update condition and code.


Co-Authored-By: Greta Yorsh <greta.yorsh@arm.com>
Co-Authored-By: Sameera Deshpande <sameera.deshpande@arm.com>

From-SVN: r188743
This commit is contained in:
Ian Bolton 2012-06-18 17:57:06 +00:00 committed by Greta Yorsh
parent d461c88a25
commit f79b86a43e
5 changed files with 43 additions and 18 deletions

View File

@ -1,3 +1,14 @@
2012-06-18 Ian Bolton <ian.bolton@arm.com>
Sameera Deshpande <sameera.deshpande@arm.com>
Greta Yorsh <greta.yorsh@arm.com>
* config/arm/arm-protos.h (output_return_instruction): New parameter and
int to bool change of parameter types.
* config/arm/arm.c (output_return_instruction): Likewise.
* config/arm/arm.md (arm_simple_return): New pattern.
(arm_return, cond_return, cond_return_inverted): Add new arguments.
* config/arm/thumb2.md (thumb2_return): Update condition and code.
2012-06-18 Ian Bolton <ian.bolton@arm.com>
Sameera Deshpande <sameera.deshpande@arm.com>
Greta Yorsh <greta.yorsh@arm.com>

View File

@ -148,7 +148,7 @@ extern int arm_address_offset_is_imm (rtx);
extern const char *output_add_immediate (rtx *);
extern const char *arithmetic_instr (rtx, int);
extern void output_ascii_pseudo_op (FILE *, const unsigned char *, int);
extern const char *output_return_instruction (rtx, int, int);
extern const char *output_return_instruction (rtx, bool, bool, bool);
extern void arm_poke_function_name (FILE *, const char *);
extern void arm_final_prescan_insn (rtx);
extern int arm_debugger_arg_offset (int, rtx);

View File

@ -15516,9 +15516,11 @@ arm_get_vfp_saved_size (void)
/* Generate a function exit sequence. If REALLY_RETURN is false, then do
everything bar the final return instruction. */
everything bar the final return instruction. If simple_return is true,
then do not output epilogue, because it has already been emitted in RTL. */
const char *
output_return_instruction (rtx operand, int really_return, int reverse)
output_return_instruction (rtx operand, bool really_return, bool reverse,
bool simple_return)
{
char conditional[10];
char instr[100];
@ -15561,7 +15563,7 @@ output_return_instruction (rtx operand, int really_return, int reverse)
offsets = arm_get_frame_offsets ();
live_regs_mask = offsets->saved_regs_mask;
if (live_regs_mask)
if (!simple_return && live_regs_mask)
{
const char * return_reg;
@ -15689,7 +15691,7 @@ output_return_instruction (rtx operand, int really_return, int reverse)
{
/* The return has already been handled
by loading the LR into the PC. */
really_return = 0;
return "";
}
}

View File

@ -8519,7 +8519,7 @@
arm_ccfsm_state += 2;
return \"\";
}
return output_return_instruction (const_true_rtx, TRUE, FALSE);
return output_return_instruction (const_true_rtx, true, false, false);
}"
[(set_attr "type" "load1")
(set_attr "length" "12")
@ -8540,7 +8540,7 @@
arm_ccfsm_state += 2;
return \"\";
}
return output_return_instruction (operands[0], TRUE, FALSE);
return output_return_instruction (operands[0], true, false, false);
}"
[(set_attr "conds" "use")
(set_attr "length" "12")
@ -8561,13 +8561,30 @@
arm_ccfsm_state += 2;
return \"\";
}
return output_return_instruction (operands[0], TRUE, TRUE);
return output_return_instruction (operands[0], true, true, false);
}"
[(set_attr "conds" "use")
(set_attr "length" "12")
(set_attr "type" "load1")]
)
(define_insn "*arm_simple_return"
[(simple_return)]
"TARGET_ARM"
"*
{
if (arm_ccfsm_state == 2)
{
arm_ccfsm_state += 2;
return \"\";
}
return output_return_instruction (const_true_rtx, true, false, true);
}"
[(set_attr "type" "branch")
(set_attr "length" "4")
(set_attr "predicable" "yes")]
)
;; Generate a sequence of instructions to determine if the processor is
;; in 26-bit or 32-bit mode, and return the appropriate return address
;; mask.

View File

@ -635,17 +635,12 @@
(set_attr "length" "20")]
)
;; Note: this is not predicable, to avoid issues with linker-generated
;; interworking stubs.
(define_insn "*thumb2_return"
[(return)]
"TARGET_THUMB2 && USE_RETURN_INSN (FALSE)"
"*
{
return output_return_instruction (const_true_rtx, TRUE, FALSE);
}"
[(set_attr "type" "load1")
(set_attr "length" "12")]
[(simple_return)]
"TARGET_THUMB2"
"* return output_return_instruction (const_true_rtx, true, false, true);"
[(set_attr "type" "branch")
(set_attr "length" "4")]
)
(define_insn_and_split "thumb2_eh_return"