diff options
author | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-17 02:03:52 +0000 |
---|---|---|
committer | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-17 02:03:52 +0000 |
commit | f69bb65a94dd446ed915a76e2fb9fbca3021c320 (patch) | |
tree | 0c35ab6538fcb96aedfb1eebc55dd4b86b30162c /gcc/config/cris/cris.md | |
parent | f01c257a25ffc68ffc0d44a4ed1861038dd8f6a9 (diff) | |
download | gcc-f69bb65a94dd446ed915a76e2fb9fbca3021c320.tar.gz |
PR target/61737.
* config/cris/cris.c (TARGET_LEGITIMATE_CONSTANT_P)
(TARGET_CANNOT_FORCE_CONST_MEM): Define.
(cris_cannot_force_const_mem, cris_legitimate_constant_p): New
functions.
(cris_print_index, cris_print_operand, cris_constant_index_p)
(cris_side_effect_mode_ok): Replace CONSTANT_P with CRIS_CONSTANT_P.
(cris_address_cost): Ditto last CONSTANT_P.
(cris_symbol_type_of): Rename from cris_pic_symbol_type_of. All
callers changed. Yield cris_offsettable_symbol for non-PIC
constant symbolic expressions including labels. Yield cris_unspec
for all unspecs.
(cris_expand_pic_call_address): New parameter MARKERP. Set its
target to pic_offset_table_rtx for calls that will likely go
through PLT, const0_rtx when they can't. All callers changed.
Assert flag_pic. Use CONSTANT_P, not CONSTANT_ADDRESS_P, for
symbolic expressions to be PICified. Remove second, redundant,
assert on can_create_pseudo_p returning non-zero. Use
replace_equiv_address_nv, not replace_equiv_address, for final
operand update.
* config/cris/cris.md ("movsi"): Move variable t to pattern
toplevel. Adjust assert for new cris_symbol_type member. Use
CONSTANT_P instead of CONSTANT_ADDRESS_P.
("*movsi_internal") <case 9>: Make check for valid unspec operands
for lapc stricter.
<case CRIS_UNSPEC_PCREL, CRIS_UNSPEC_PLT_PCREL>: Clear condition
codes.
("call", "call_value"): Use second incoming operand as a marker
for pic-offset-table-register being used.
("*expanded_call_non_v32", "*expanded_call_v32")
("*expanded_call_value_non_v32", "*expanded_call_value_v32"): For
second incoming operand to CALL, match cris_call_type_marker.
("*expanded_call_value_side"): Ditto. Disable before
reload_completed.
("*expanded_call_side"): Ditto. Fix typo in comment.
(moverside, movemside peepholes): Check for CRIS_CONSTANT_P, not
CONSTANT_P.
* config/cris/predicates.md ("cris_call_type_marker"): New predicate.
* config/cris/cris.h (CRIS_CONSTANT_P): New macro.
(enum cris_symbol_type): Rename from cris_pic_symbol_type. All
users changed. Add members cris_offsettable_symbol and
cris_unspec.
(cris_symbol_type): Rename from cris_pic_symbol_type.
* config/cris/constraints.md ("T"): Use CRIS_CONSTANT_P, not
just CONSTANT_P.
* config/cris/cris-protos.h (cris_symbol_type_of,
cris_expand_pic_call_address): Adjust prototypes.
(cris_legitimate_constant_p): New prototype.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212708 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/cris/cris.md')
-rw-r--r-- | gcc/config/cris/cris.md | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 47f64512a6f..18b97878663 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -919,6 +919,8 @@ (match_operand:SI 1 "cris_general_operand_or_symbol" ""))] "" { + enum cris_symbol_type t; + /* If the output goes to a MEM, make sure we have zero or a register as input. */ if (MEM_P (operands[0]) @@ -934,12 +936,12 @@ valid symbol? Can we exclude global PIC addresses with an added offset? */ if (flag_pic - && CONSTANT_ADDRESS_P (operands[1]) + && CONSTANT_P (operands[1]) && !cris_valid_pic_const (operands[1], false)) { - enum cris_pic_symbol_type t = cris_pic_symbol_type_of (operands[1]); + t = cris_symbol_type_of (operands[1]); - gcc_assert (t != cris_no_symbol); + gcc_assert (t != cris_no_symbol && t != cris_offsettable_symbol); if (! REG_S_P (operands[0])) { @@ -1086,7 +1088,12 @@ if (!flag_pic && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == LABEL_REF - || GET_CODE (operands[1]) == CONST)) + || (GET_CODE (operands[1]) == CONST + && (GET_CODE (XEXP (operands[1], 0)) != UNSPEC + || (XINT (XEXP (operands[1], 0), 1) + == CRIS_UNSPEC_PLT_PCREL) + || (XINT (XEXP (operands[1], 0), 1) + == CRIS_UNSPEC_PCREL))))) { /* FIXME: Express this through (set_attr cc none) instead, since we can't express the ``none'' at this point. FIXME: @@ -1169,6 +1176,12 @@ case CRIS_UNSPEC_PCREL: case CRIS_UNSPEC_PLT_PCREL: gcc_assert (TARGET_V32); + /* LAPC doesn't set condition codes; clear them to make the + (equivalence-marked) result of this insn not presumed + present. This instruction can be a PIC symbol load (for + a hidden symbol) which for weak symbols will be followed + by a test for NULL. */ + CC_STATUS_INIT; return "lapc %1,%0"; default: @@ -3710,15 +3723,16 @@ { gcc_assert (MEM_P (operands[0])); if (flag_pic) - cris_expand_pic_call_address (&operands[0]); + cris_expand_pic_call_address (&operands[0], &operands[1]); + else + operands[1] = const0_rtx; }) -;; Accept *anything* as operand 1. Accept operands for operand 0 in -;; order of preference. +;; Accept operands for operand 0 in order of preference. (define_insn "*expanded_call_non_v32" [(call (mem:QI (match_operand:SI 0 "general_operand" "r,Q>,g")) - (match_operand 1 "" "")) + (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM")) (clobber (reg:SI CRIS_SRP_REGNUM))] "!TARGET_V32" "jsr %0") @@ -3727,7 +3741,7 @@ [(call (mem:QI (match_operand:SI 0 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i")) - (match_operand 1 "" "")) + (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM,rM")) (clobber (reg:SI CRIS_SRP_REGNUM))] "TARGET_V32" "@ @@ -3740,19 +3754,21 @@ ;; Parallel when calculating and reusing address of indirect pointer ;; with simple offset. (Makes most sense with PIC.) It looks a bit ;; wrong not to have the clobber last, but that's the way combine -;; generates it (except it doesn' look into the *inner* mem, so this +;; generates it (except it doesn't look into the *inner* mem, so this ;; just matches a peephole2). FIXME: investigate that. (define_insn "*expanded_call_side" [(call (mem:QI (mem:SI (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r, r,r") (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn")))) - (match_operand 2 "" "")) + (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM")) (clobber (reg:SI CRIS_SRP_REGNUM)) (set (match_operand:SI 3 "register_operand" "=*0,r,r") (plus:SI (match_dup 0) (match_dup 1)))] - "!TARGET_AVOID_GOTPLT && !TARGET_V32" + ;; Disabled until after reload until we can avoid an output reload for + ;; operand 3 (being forbidden for call insns). + "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32" "jsr [%3=%0%S1]") (define_expand "call_value" @@ -3764,10 +3780,12 @@ { gcc_assert (MEM_P (operands[1])); if (flag_pic) - cris_expand_pic_call_address (&operands[1]); + cris_expand_pic_call_address (&operands[1], &operands[2]); + else + operands[2] = const0_rtx; }) -;; Accept *anything* as operand 2. The validity other than "general" of +;; The validity other than "general" of ;; operand 0 will be checked elsewhere. Accept operands for operand 1 in ;; order of preference (Q includes r, but r is shorter, faster). ;; We also accept a PLT symbol. We output it as [rPIC+sym:GOTPLT] rather @@ -3776,7 +3794,7 @@ (define_insn "*expanded_call_value_non_v32" [(set (match_operand 0 "nonimmediate_operand" "=g,g,g") (call (mem:QI (match_operand:SI 1 "general_operand" "r,Q>,g")) - (match_operand 2 "" ""))) + (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM"))) (clobber (reg:SI CRIS_SRP_REGNUM))] "!TARGET_V32" "Jsr %1" @@ -3790,12 +3808,14 @@ (mem:SI (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r, r,r") (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn")))) - (match_operand 3 "" ""))) + (match_operand:SI 3 "cris_call_type_marker" "rM,rM,rM"))) (clobber (reg:SI CRIS_SRP_REGNUM)) (set (match_operand:SI 4 "register_operand" "=*1,r,r") (plus:SI (match_dup 1) (match_dup 2)))] - "!TARGET_AVOID_GOTPLT && !TARGET_V32" + ;; Disabled until after reload until we can avoid an output reload for + ;; operand 4 (being forbidden for call insns). + "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32" "Jsr [%4=%1%S2]" [(set_attr "cc" "clobber")]) @@ -3805,7 +3825,7 @@ (call (mem:QI (match_operand:SI 1 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i")) - (match_operand 2 "" ""))) + (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM,rM"))) (clobber (reg:SI 16))] "TARGET_V32" "@ @@ -4827,7 +4847,7 @@ /* Make sure we have canonical RTX so we match the insn pattern - not a constant in the first operand. We also require the order (plus reg mem) to match the final pattern. */ - if (CONSTANT_P (otherop) || MEM_P (otherop)) + if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop)) { operands[7] = operands[1]; operands[8] = otherop; @@ -4878,7 +4898,7 @@ /* Make sure we have canonical RTX so we match the insn pattern - not a constant in the first operand. We also require the order (plus reg mem) to match the final pattern. */ - if (CONSTANT_P (otherop) || MEM_P (otherop)) + if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop)) { operands[7] = operands[1]; operands[8] = otherop; |