diff options
author | Marek Michalkiewicz <marekm@linux.org.pl> | 2000-12-11 13:46:57 +0100 |
---|---|---|
committer | Denis Chertykov <denisc@gcc.gnu.org> | 2000-12-11 15:46:57 +0300 |
commit | 89741abb8de53230e18c5b0da69dabb008898119 (patch) | |
tree | dbbb383d3f8229ddbe9d463a55bd94bfdfefe270 /gcc | |
parent | 0e41aa7ac45bbfe4850ec38a5523c3aecfeefd8c (diff) | |
download | gcc-89741abb8de53230e18c5b0da69dabb008898119.zip gcc-89741abb8de53230e18c5b0da69dabb008898119.tar.gz gcc-89741abb8de53230e18c5b0da69dabb008898119.tar.bz2 |
avr.c (compare_condition, [...]): New functions.
* config/avr/avr.c (compare_condition, compare_sign_p): New functions.
(compare_diff_p, compare_eq_p): Call compare_condition.
(out_tsthi, out_tstsi): Call compare_sign_p.
(avr_progmem_p): Check for error_mark_node.
From-SVN: r38190
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 55 |
2 files changed, 44 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 04abbf4..728a444 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2000-12-05 Marek Michalkiewicz <marekm@linux.org.pl> + + * config/avr/avr.c (compare_condition, compare_sign_p): New functions. + (compare_diff_p, compare_eq_p): Call compare_condition. + (out_tsthi, out_tstsi): Call compare_sign_p. + (avr_progmem_p): Check for error_mark_node. + 2000-12-11 Neil Booth <neilb@earthling.net> * cpperror.c (print_location): New function. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index b696e55..3de0440 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -52,6 +52,8 @@ static const char * cond_string PARAMS ((enum rtx_code)); static int avr_num_arg_regs PARAMS ((enum machine_mode, tree)); static int out_adj_frame_ptr PARAMS ((FILE *, int)); static int out_set_stack_ptr PARAMS ((FILE *, int, int)); +static RTX_CODE compare_condition PARAMS ((rtx insn)); +static int compare_sign_p PARAMS ((rtx insn)); static int reg_was_0 PARAMS ((rtx insn, rtx op)); static int io_address_p PARAMS ((rtx x, int size)); void debug_hard_reg_set PARAMS ((HARD_REG_SET set)); @@ -2606,39 +2608,52 @@ frame_pointer_required_p () || get_frame_size () > 0); } -/* Return 1 if the next insn is a JUMP_INSN with condition (GT,LE,GTU,LTU) */ +/* Returns the condition of compare insn INSN, or UNKNOWN. */ -int -compare_diff_p (insn) +static RTX_CODE +compare_condition (insn) rtx insn; { rtx next = next_real_insn (insn); RTX_CODE cond = UNKNOWN; - if (GET_CODE (next) == JUMP_INSN) + if (next && GET_CODE (next) == JUMP_INSN) { rtx pat = PATTERN (next); rtx src = SET_SRC (pat); - rtx t = XEXP (src,0); + rtx t = XEXP (src, 0); cond = GET_CODE (t); } + return cond; +} + +/* Returns nonzero if INSN is a tst insn that only tests the sign. */ + +static int +compare_sign_p (insn) + rtx insn; +{ + RTX_CODE cond = compare_condition (insn); + return (cond == GE || cond == LT); +} + +/* Returns nonzero if the next insn is a JUMP_INSN with a condition + that needs to be swapped (GT, GTU, LE, LEU). */ + +int +compare_diff_p (insn) + rtx insn; +{ + RTX_CODE cond = compare_condition (insn); return (cond == GT || cond == GTU || cond == LE || cond == LEU) ? cond : 0; } -/* Returns nonzero if INSN is a compare insn with the EQ or NE condition */ +/* Returns nonzero if INSN is a compare insn with the EQ or NE condition. */ int compare_eq_p (insn) rtx insn; { - rtx next = next_real_insn (insn); - RTX_CODE cond = UNKNOWN; - if (GET_CODE (next) == JUMP_INSN) - { - rtx pat = PATTERN (next); - rtx src = SET_SRC (pat); - rtx t = XEXP (src,0); - cond = GET_CODE (t); - } + RTX_CODE cond = compare_condition (insn); return (cond == EQ || cond == NE); } @@ -2650,12 +2665,13 @@ out_tsthi (insn, l) rtx insn; int *l; { - if (!compare_eq_p (insn) && !compare_diff_p (insn)) + if (compare_sign_p (insn)) { if (l) *l = 1; return AS1 (tst,%B0); } - if (reg_unused_after (insn, SET_SRC (PATTERN (insn)))) + if (reg_unused_after (insn, SET_SRC (PATTERN (insn))) + && compare_eq_p (insn)) { /* faster than sbiw if we can clobber the operand */ if (l) *l = 1; @@ -2679,7 +2695,7 @@ out_tstsi (insn, l) rtx insn; int *l; { - if (!compare_eq_p (insn) && !compare_diff_p(insn)) + if (compare_sign_p (insn)) { if (l) *l = 1; return AS1 (tst,%D0); @@ -4655,6 +4671,9 @@ avr_progmem_p (decl) a = TREE_TYPE(a); while (TREE_CODE (a) == ARRAY_TYPE); + if (a == error_mark_node) + return 0; + if (NULL_TREE != lookup_attribute ("progmem", TYPE_ATTRIBUTES (a))) return 1; |