Commit d29b4b1b by Hans-Peter Nilsson Committed by Hans-Peter Nilsson

CRIS prologue as RTL.

	* config/cris/cris-protos.h (cris_emit_movem_store)
	(cris_expand_prologue): Prototype.
	* config/cris/cris.c (struct machine_function): New member
	stdarg_regs.
	(cfa_label_num, cris_target_asm_function_prologue): Remove.
	(TARGET_ASM_FUNCTION_PROLOGUE): Don't override.
	(cris_general_operand_or_gotless_symbol): Accept CRIS_UNSPEC_GOT.
	(cris_load_multiple_op, cris_return_address_on_stack)
	(cris_return_address_on_stack_for_return): ISO-Cify.
	(cris_store_multiple_op): New predicate function.
	(cris_expand_prologue, cris_emit_movem_store): New functions.
	(cris_print_operand) <case 'O'>: Handle modifications other than
	post-increment.
	(cris_symbol, cris_got_symbol): Return 0 for CRIS_UNSPEC_GOT.
	(cris_gotless_symbol): Return 1 for CRIS_UNSPEC_GOT.
	(cris_gen_movem_load): Rearrange slightly to make local variable
	src a parameter, removing osrc.
	(cris_setup_incoming_varargs): Set machine_function member
	stdarg_regs to correspond to the number of registers that need to
	be saved.
	* config/cris/cris.h (EXTRA_CONSTRAINT_S): Accept
	CRIS_UNSPEC_GOT.
	(PREDICATE_CODES): Add cris_store_multiple_op.  Make
	cris_general_operand_or_gotless_symbol accept UNSPEC.
	* config/cris/cris.md (CRIS_UNSPEC_GOT): New constant.
	("*movsi_internal") <alternative 8>: Handle CRIS_UNSPEC_GOT.
	("*cris_store_multiple"): New pattern.  Tweak common comment above
	this and "*cris_load_multiple".
	("prologue"): New define_expand.

From-SVN: r98103
parent a6dfafa0
2005-04-13 Hans-Peter Nilsson <hp@axis.com> 2005-04-13 Hans-Peter Nilsson <hp@axis.com>
CRIS prologue as RTL.
* config/cris/cris-protos.h (cris_emit_movem_store)
(cris_expand_prologue): Prototype.
* config/cris/cris.c (struct machine_function): New member
stdarg_regs.
(cfa_label_num, cris_target_asm_function_prologue): Remove.
(TARGET_ASM_FUNCTION_PROLOGUE): Don't override.
(cris_general_operand_or_gotless_symbol): Accept CRIS_UNSPEC_GOT.
(cris_load_multiple_op, cris_return_address_on_stack)
(cris_return_address_on_stack_for_return): ISO-Cify.
(cris_store_multiple_op): New predicate function.
(cris_expand_prologue, cris_emit_movem_store): New functions.
(cris_print_operand) <case 'O'>: Handle modifications other than
post-increment.
(cris_symbol, cris_got_symbol): Return 0 for CRIS_UNSPEC_GOT.
(cris_gotless_symbol): Return 1 for CRIS_UNSPEC_GOT.
(cris_gen_movem_load): Rearrange slightly to make local variable
src a parameter, removing osrc.
(cris_setup_incoming_varargs): Set machine_function member
stdarg_regs to correspond to the number of registers that need to
be saved.
* config/cris/cris.h (EXTRA_CONSTRAINT_S): Accept
CRIS_UNSPEC_GOT.
(PREDICATE_CODES): Add cris_store_multiple_op. Make
cris_general_operand_or_gotless_symbol accept UNSPEC.
* config/cris/cris.md (CRIS_UNSPEC_GOT): New constant.
("*movsi_internal") <alternative 8>: Handle CRIS_UNSPEC_GOT.
("*cris_store_multiple"): New pattern. Tweak common comment above
this and "*cris_load_multiple".
("prologue"): New define_expand.
* config/cris/cris.md ("epilogue"): Conditionalize on * config/cris/cris.md ("epilogue"): Conditionalize on
TARGET_PROLOGUE_EPILOGUE. TARGET_PROLOGUE_EPILOGUE.
......
...@@ -45,9 +45,11 @@ extern void cris_asm_output_symbol_ref (FILE *, rtx); ...@@ -45,9 +45,11 @@ extern void cris_asm_output_symbol_ref (FILE *, rtx);
extern bool cris_output_addr_const_extra (FILE *, rtx); extern bool cris_output_addr_const_extra (FILE *, rtx);
extern int cris_cfun_uses_pic_table (void); extern int cris_cfun_uses_pic_table (void);
extern rtx cris_gen_movem_load (rtx, rtx, int); extern rtx cris_gen_movem_load (rtx, rtx, int);
extern rtx cris_emit_movem_store (rtx, rtx, int, bool);
#endif /* RTX_CODE */ #endif /* RTX_CODE */
extern void cris_asm_output_label_ref (FILE *, char *); extern void cris_asm_output_label_ref (FILE *, char *);
extern void cris_target_asm_named_section (const char *, unsigned int, tree); extern void cris_target_asm_named_section (const char *, unsigned int, tree);
extern void cris_expand_prologue (void);
extern void cris_expand_epilogue (void); extern void cris_expand_epilogue (void);
extern void cris_expand_return (bool); extern void cris_expand_return (bool);
extern bool cris_return_address_on_stack_for_return (void); extern bool cris_return_address_on_stack_for_return (void);
......
...@@ -854,8 +854,13 @@ enum reg_class ...@@ -854,8 +854,13 @@ enum reg_class
&& BIAP_INDEX_P (XEXP (XEXP (X, 0), 0)))))) \ && BIAP_INDEX_P (XEXP (XEXP (X, 0), 0)))))) \
) )
#define EXTRA_CONSTRAINT_S(X) \ /* We're kind of out of constraints, so we use "S" for both gotless
(flag_pic && CONSTANT_P (X) && cris_gotless_symbol (X)) symbols and the GOT-address load. Both must go in a general register
only: for pre-V32, arithmetic is done on the destination. */
#define EXTRA_CONSTRAINT_S(X) \
(flag_pic \
&& ((CONSTANT_P (X) && cris_gotless_symbol (X)) \
|| (GET_CODE (X) == UNSPEC && XINT ((X), 1) == CRIS_UNSPEC_GOT)))
#define EXTRA_CONSTRAINT_U(X) \ #define EXTRA_CONSTRAINT_U(X) \
(flag_pic && CONSTANT_P (X) && cris_got_symbol (X)) (flag_pic && CONSTANT_P (X) && cris_got_symbol (X))
...@@ -1629,6 +1634,8 @@ struct cum_args {int regs;}; ...@@ -1629,6 +1634,8 @@ struct cum_args {int regs;};
{MEM}}, \ {MEM}}, \
{"cris_load_multiple_op", \ {"cris_load_multiple_op", \
{PARALLEL}}, \ {PARALLEL}}, \
{"cris_store_multiple_op", \
{PARALLEL}}, \
{"cris_bdap_operand", \ {"cris_bdap_operand", \
{SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \ {SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \
CONST_DOUBLE, CONST, SIGN_EXTEND}}, \ CONST_DOUBLE, CONST, SIGN_EXTEND}}, \
...@@ -1637,7 +1644,7 @@ struct cum_args {int regs;}; ...@@ -1637,7 +1644,7 @@ struct cum_args {int regs;};
CONST_DOUBLE, CONST, SIGN_EXTEND, MULT}}, \ CONST_DOUBLE, CONST, SIGN_EXTEND, MULT}}, \
{"cris_general_operand_or_gotless_symbol", \ {"cris_general_operand_or_gotless_symbol", \
{CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \ {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
LABEL_REF, SUBREG, REG, MEM}}, \ LABEL_REF, SUBREG, REG, MEM, UNSPEC}}, \
{"cris_general_operand_or_symbol", \ {"cris_general_operand_or_symbol", \
{CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \ {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
LABEL_REF, SUBREG, REG, MEM}}, \ LABEL_REF, SUBREG, REG, MEM}}, \
......
...@@ -59,11 +59,12 @@ ...@@ -59,11 +59,12 @@
;; 0 PLT reference from call expansion: operand 0 is the address, ;; 0 PLT reference from call expansion: operand 0 is the address,
;; the mode is VOIDmode. Always wrapped in CONST. ;; the mode is VOIDmode. Always wrapped in CONST.
;; 1 Stack frame deallocation barrier. ;; 1 Stack frame deallocation barrier.
;; 2 The address of the global offset table as a source operand.
(define_constants (define_constants
[(CRIS_UNSPEC_PLT 0) [(CRIS_UNSPEC_PLT 0)
(CRIS_UNSPEC_FRAME_DEALLOC 1)]) (CRIS_UNSPEC_FRAME_DEALLOC 1)
(CRIS_UNSPEC_GOT 2)])
;; Register numbers. ;; Register numbers.
(define_constants (define_constants
...@@ -1067,21 +1068,33 @@ ...@@ -1067,21 +1068,33 @@
} }
return \"move.d %1,%0\"; return \"move.d %1,%0\";
case 8: case 8:
/* FIXME: Try and split this into pieces GCC makes better code of, /* FIXME: Try and split this into pieces GCC makes better code of,
than this multi-insn pattern. Synopsis: wrap the GOT-relative than this multi-insn pattern. Synopsis: wrap the GOT-relative
symbol into an unspec, and when PIC, recognize the unspec symbol into an unspec, and when PIC, recognize the unspec
everywhere a symbol is normally recognized. (The PIC register everywhere a symbol is normally recognized. (The PIC register
should be recognized by GCC as pic_offset_table_rtx when needed should be recognized by GCC as pic_offset_table_rtx when needed
and similar for PC.) Each component can then be optimized with and similar for PC.) Each component can then be optimized with
the rest of the code; it should be possible to have a constant the rest of the code; it should be possible to have a constant
term added on an unspec. Don't forget to add a REG_EQUAL (or term added on an unspec. Don't forget to add a REG_EQUAL (or
is it REG_EQUIV) note to the destination. It might not be is it REG_EQUIV) note to the destination. It might not be
worth it. Measure. worth it. Measure.
Note that the 'v' modifier makes PLT references be output as Note that the 'v' modifier makes PLT references be output as
sym:PLT rather than [rPIC+sym:GOTPLT]. */ sym:PLT rather than [rPIC+sym:GOTPLT]. */
return \"move.d %v1,%0\;add.d %P1,%0\"; if (GET_CODE (operands[1]) == UNSPEC
&& XINT (operands[1], 1) == CRIS_UNSPEC_GOT)
{
/* We clobber cc0 rather than set it to GOT. Should not
matter, though. */
CC_STATUS_INIT;
if (REGNO (operands[0]) != PIC_OFFSET_TABLE_REGNUM)
abort ();
return \"move.d $pc,%0\;sub.d .:GOTOFF,%0\";
}
return \"move.d %v1,%0\;add.d %P1,%0\";
default: default:
return \"BOGUS: %1 to %0\"; return \"BOGUS: %1 to %0\";
...@@ -1387,8 +1400,8 @@ ...@@ -1387,8 +1400,8 @@
move %1,%0" move %1,%0"
[(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no,yes,yes,yes,no,yes,no")]) [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no,yes,yes,yes,no,yes,no")])
;; Note that the order of the registers is the reverse of that of the ;; Note that the memory layout of the registers is the reverse of that
;; standard pattern "load_multiple". ;; of the standard patterns "load_multiple" and "store_multiple".
(define_insn "*cris_load_multiple" (define_insn "*cris_load_multiple"
[(match_parallel 0 "cris_load_multiple_op" [(match_parallel 0 "cris_load_multiple_op"
[(set (match_operand:SI 1 "register_operand" "=r,r") [(set (match_operand:SI 1 "register_operand" "=r,r")
...@@ -1404,6 +1417,15 @@ ...@@ -1404,6 +1417,15 @@
;; FIXME: temporary change until all insn lengths are correctly ;; FIXME: temporary change until all insn lengths are correctly
;; described. FIXME: have better target control over bb-reorder. ;; described. FIXME: have better target control over bb-reorder.
(set_attr "length" "0")]) (set_attr "length" "0")])
(define_insn "*cris_store_multiple"
[(match_parallel 0 "cris_store_multiple_op"
[(set (match_operand:SI 2 "memory_operand" "=Q,m")
(match_operand:SI 1 "register_operand" "r,r"))])]
""
"movem %o0,%O0"
[(set_attr "cc" "none")
(set_attr "slottable" "yes,no")])
;; Sign- and zero-extend insns with standard names. ;; Sign- and zero-extend insns with standard names.
...@@ -3515,6 +3537,11 @@ ...@@ -3515,6 +3537,11 @@
(const_string "no") (const_string "no")
(const_string "has_slot")))]) (const_string "has_slot")))])
(define_expand "prologue"
[(const_int 0)]
"TARGET_PROLOGUE_EPILOGUE"
"cris_expand_prologue (); DONE;")
;; Note that the (return) from the expander itself is always the last ;; Note that the (return) from the expander itself is always the last
;; insn in the epilogue. ;; insn in the epilogue.
(define_expand "epilogue" (define_expand "epilogue"
......
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