summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorchaoyingfu <chaoyingfu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-23 00:30:39 +0000
committerchaoyingfu <chaoyingfu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-23 00:30:39 +0000
commite397ad8e71a8cf04fb36f26a47107ef2886d7354 (patch)
tree94fb170497e612ea3b6c7e7f3250d4c77df42147 /gcc/varasm.c
parent0601fc49950a9bf79ee80b415bed8aa86dad42e8 (diff)
downloadgcc-e397ad8e71a8cf04fb36f26a47107ef2886d7354.tar.gz
* rtl.c (rtx_code_size): Check CONST_FIXED to calcualte correct sizes
in DEF_RTL_EXPR. (copy_rtx): Handle CONST_FIXED. (rtx_equal_p): Likewise. * rtl.h (fixed_value.h): New include. (rtx_def): Add a new field of fixed_value to u. (XCNMPFV): Define for accessing fixed_value. (CONST_FIXED_VALUE, CONST_FIXED_VALUE_HIGH, CONST_FIXED_VALUE_LOW): Define. * rtl.def (CONST_FIXED): New constant. (SS_MULT, US_MULT, SS_DIV, US_DIV, FRACT_CONVERT, UNSIGNED_FRACT_CONVERT, SAT_FRACT, UNSIGNED_SAT_FRACT, US_NEG, US_ASHIFT): New codes. * doc/rtl.texi (Expressions): Document const_fixed, us_neg, ss_mult, us_mult, ss_div, us_div, us_ashift, fract_convert, sat_fract, unsigned_fract_convert, unsigned_sat_fract): Document them. * varasm.c (assemble_integer): Extend to support fixed-point constants by using different machine classes. (decode_addr_const): Handle FIXED_CST. (const_hash_1): Likewise. (compare_constant): Likewise. (copy_constant): Likewise. (const_rtx_hash_1): Handle CONST_FIXED. (output_constant_pool_2): Handle MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM. (initializer_constant_valid_p): Handle FIXED_CST. (output_constant): Support FIXED_POINT_TYPE. * gengenrtl.c (excluded_rtx): Check CONST_FIXED to exclude. * cse.c (hash_rtx): Support CONST_FIXED. (exp_equiv_p): Likewise. (cannon_reg): Likewise. (fold_rtx): Likewise. (equiv_constant): Likewise. (cse_process_notes_1): Likewise. (count_reg_usage): Likewise. * cselib.c (entry_and_rtx_equal_p): Check CONST_FIXED. (rtx_equal_for_cselib_p): Handle CONST_FIXED. (wrap_constant): Check CONST_FIXED. (cselib_hash_rtx): Support CONST_FIXED. (cselib_subst_to_values): Likewise. * df-scan.c (df_uses_record): Likewise. * gcse.c (want_to_gcse_p): Likewise. (oprs_unchanged_p): Likewise. (oprs_not_set_p): Likewise. (compute_transp): Likewise. (extract_mentioned_regs_helper): Likewise. * genemit.c (gen_exp): Likewise. * local-alloc.c (equiv_init_varies_p): Likewise. (contains_replace_regs): Likewise. (memref_referenced_p): Likewise. * loop-invariant.c (check_maybe_invariant): Likewise. (hash_invariant_expr_1): Likewise. (invariant_expr_equal_p): Likewise. * postreload-gcse.c (oprs_unchanged_p): Likewise. * regclass.c (reg_scan_mark_refs): Likewise. * regrename.c (scan_rtx): Likewise. * resource.c (mark_referenced_resources): Likewise. (mark_set_resources): Likewise. * rtlanal.c (rtx_unstable_p): Likewise. (rtx_varies_p): Likewise. (count_occurrences): Likewise. (reg_mentioned_p): Likewise. (modified_between_p): Likewise. (modified_in_p): Likewise. (volatile_insn_p): Likewise. (volatile_refs_p): Likewise. (side_effects_p): Likewise. (may_trap_p_1): Likewise. (inequality_comparisons_p): Likewise. (computed_jump_p_1): Likewise. (commutative_operand_precedence): Likewise. * sched-deps.c (sched_analyze_2): Likewise. * sched-vis.c (print_value): Likewise. * reload.c (operands_match_p): Likewise. (subst_reg_equivs): Likewise. * reload1.c (eliminate_regs_1): Likewise. (elimination_effects): Likewise. (scan_paradoxical_subregs): Likewise. * alias.c (rtx_equal_for_memref_p): Likewise. * Makefile.in (RTL_BASE_H): Add fixed-value.h. * emit-rtl.c (const_fixed_htab): New hash table. (const_fixed_htab_hash, const_fixed_htab_eq, lookup_const_fixed): Declare. (const_fixed_htab_hash, const_fixed_htab_eq, lookup_const_fixed, const_fixed_from_fixed_value): New functions. (verify_rtx_sharing): Handle CONST_FIXED. (copy_rtx_if_shared_1): Likewise. (reset_used_flags): Likewise. (set_used_flags): Likewise. (copy_insn_1): Likewise. (init_emit_once): Create const_fixed_htab. Store fixed-point scalar and vector zero and one to const_tiny_rtx. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127725 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 2ec4f2b876a..7b31c753c52 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2570,11 +2570,17 @@ assemble_integer (rtx x, unsigned int size, unsigned int align, int force)
enum machine_mode omode, imode;
unsigned int subalign;
unsigned int subsize, i;
+ unsigned char mclass;
subsize = size > UNITS_PER_WORD? UNITS_PER_WORD : 1;
subalign = MIN (align, subsize * BITS_PER_UNIT);
- omode = mode_for_size (subsize * BITS_PER_UNIT, MODE_INT, 0);
- imode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
+ if (GET_CODE (x) == CONST_FIXED)
+ mclass = GET_MODE_CLASS (GET_MODE (x));
+ else
+ mclass = MODE_INT;
+
+ omode = mode_for_size (subsize * BITS_PER_UNIT, mclass, 0);
+ imode = mode_for_size (size * BITS_PER_UNIT, mclass, 0);
for (i = 0; i < size; i += subsize)
{
@@ -2686,6 +2692,7 @@ decode_addr_const (tree exp, struct addr_const *value)
break;
case REAL_CST:
+ case FIXED_CST:
case STRING_CST:
case COMPLEX_CST:
case CONSTRUCTOR:
@@ -2757,6 +2764,9 @@ const_hash_1 (const tree exp)
case REAL_CST:
return real_hash (TREE_REAL_CST_PTR (exp));
+ case FIXED_CST:
+ return fixed_hash (TREE_FIXED_CST_PTR (exp));
+
case STRING_CST:
p = TREE_STRING_POINTER (exp);
len = TREE_STRING_LENGTH (exp);
@@ -2875,6 +2885,13 @@ compare_constant (const tree t1, const tree t2)
return REAL_VALUES_IDENTICAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
+ case FIXED_CST:
+ /* Fixed constants are the same only if the same width of type. */
+ if (TYPE_PRECISION (TREE_TYPE (t1)) != TYPE_PRECISION (TREE_TYPE (t2)))
+ return 0;
+
+ return FIXED_VALUES_IDENTICAL (TREE_FIXED_CST (t1), TREE_FIXED_CST (t2));
+
case STRING_CST:
if (TYPE_MODE (TREE_TYPE (t1)) != TYPE_MODE (TREE_TYPE (t2)))
return 0;
@@ -3001,6 +3018,7 @@ copy_constant (tree exp)
case INTEGER_CST:
case REAL_CST:
+ case FIXED_CST:
case STRING_CST:
return copy_node (exp);
@@ -3395,6 +3413,10 @@ const_rtx_hash_1 (rtx *xp, void *data)
h ^= real_hash (CONST_DOUBLE_REAL_VALUE (x));
break;
+ case CONST_FIXED:
+ h ^= fixed_hash (CONST_FIXED_VALUE (x));
+ break;
+
case CONST_VECTOR:
{
int i;
@@ -3636,11 +3658,19 @@ output_constant_pool_2 (enum machine_mode mode, rtx x, unsigned int align)
case MODE_INT:
case MODE_PARTIAL_INT:
+ case MODE_FRACT:
+ case MODE_UFRACT:
+ case MODE_ACCUM:
+ case MODE_UACCUM:
assemble_integer (x, GET_MODE_SIZE (mode), align, 1);
break;
case MODE_VECTOR_FLOAT:
case MODE_VECTOR_INT:
+ case MODE_VECTOR_FRACT:
+ case MODE_VECTOR_UFRACT:
+ case MODE_VECTOR_ACCUM:
+ case MODE_VECTOR_UACCUM:
{
int i, units;
enum machine_mode submode = GET_MODE_INNER (mode);
@@ -4058,6 +4088,7 @@ initializer_constant_valid_p (tree value, tree endtype)
case INTEGER_CST:
case VECTOR_CST:
case REAL_CST:
+ case FIXED_CST:
case STRING_CST:
case COMPLEX_CST:
return null_pointer_node;
@@ -4381,10 +4412,11 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
+ case FIXED_POINT_TYPE:
if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode,
EXPAND_INITIALIZER),
MIN (size, thissize), align, 0))
- error ("initializer for integer value is too complicated");
+ error ("initializer for integer/fixed-point value is too complicated");
break;
case REAL_TYPE: