From c185c79706795682a35d3b15df2ff3b7e1f2138b Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 25 Jan 2006 09:10:56 +0000 Subject: rtl.texi (SYMBOL_REF_CONSTANT, [...]): Document. * doc/rtl.texi (SYMBOL_REF_CONSTANT, SYMBOL_REF_DATA): Document. * gengtype.c (adjust_field_rtx_def): Garbage-collect field 2 of a SYMBOL_REF as either a tree or a constant_descriptor_rtx, depending on the value of CONSTANT_POOL_ADDRESS_P. * optabs.c (init_one_libfunc): Nullify SYMBOL_REF_DATA rather than SYMBOL_REF_DECL. * varasm.c (make_decl_rtl, build_constant_desc): Set SYMBOL_REF_DATA rather than SYMBOL_REF_DECL. (rtx_constant_pool): Remove const_rtx_sym_htab. (const_desc_rtx_sym_hash, const_desc_rtx_sym_eq): Delete. (init_varasm_status): Don't initialize const_rtx_sym_htab. (force_const_mem): Point SYMBOL_REF_DATA to the constant pool entry. Remove handling of const_rtx_sym_htab. (find_pool_constant): Delete. (get_pool_constant, get_pool_constant_mark): Use SYMBOL_REF_CONSTANT rather than find_pool_constant. (get_pool_constant_for_function): Delete. (get_pool_mode, mark_constant): Use SYMBOL_REF_CONSTANT rather than find_pool_constant. * rtl.h (rtunion_def): Add rt_constant and rt_ptr fields. (X0CONSTANT, X0PTR, SYMBOL_REF_DATA): New macros. (SYMBOL_REF_DECL): Return NULL if CONSTANT_POOL_ADDRESS_P. (SYMBOL_REF_CONSTANT): New macro. (get_pool_constant_for_function): Delete. * config/i386/winnt.c (i386_pe_mark_dllexport): Set SYMBOL_REF_DATA rather than SYMBOL_REF_DECL. (i386_pe_mark_dllimport): Likewise. * config/rs6000/rs6000.c (rs6000_emit_move): Copy SYMBOL_REF_DATA rather than SYMBOL_REF_DECL. * config/darwin.c (machopic_indirect_data_reference): Likewise. (machopic_indirect_call_target): Likewise. From-SVN: r110210 --- gcc/varasm.c | 57 +++++++-------------------------------------------------- 1 file changed, 7 insertions(+), 50 deletions(-) (limited to 'gcc/varasm.c') diff --git a/gcc/varasm.c b/gcc/varasm.c index 5ca43f6..1a29d27 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -845,7 +845,7 @@ make_decl_rtl (tree decl) x = gen_rtx_SYMBOL_REF (Pmode, name); SYMBOL_REF_WEAK (x) = DECL_WEAK (decl); - SYMBOL_REF_DECL (x) = decl; + SYMBOL_REF_DATA (x) = decl; x = gen_rtx_MEM (DECL_MODE (decl), x); if (TREE_CODE (decl) != FUNCTION_DECL) @@ -2573,7 +2573,7 @@ build_constant_desc (tree exp) /* We have a symbol name; construct the SYMBOL_REF and the MEM. */ symbol = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (label)); SYMBOL_REF_FLAGS (symbol) = SYMBOL_FLAG_LOCAL; - SYMBOL_REF_DECL (symbol) = desc->value; + SYMBOL_REF_DATA (symbol) = desc->value; TREE_CONSTANT_POOL_ADDRESS_P (symbol) = 1; rtl = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp)), symbol); @@ -2751,7 +2751,6 @@ struct rtx_constant_pool GTY(()) constant addresses are restricted so that such constants must be stored in memory. */ htab_t GTY((param_is (struct constant_descriptor_rtx))) const_rtx_htab; - htab_t GTY((param_is (struct constant_descriptor_rtx))) const_rtx_sym_htab; /* Current offset in constant pool (does not include any machine-specific header). */ @@ -2792,23 +2791,6 @@ const_desc_rtx_eq (const void *a, const void *b) return rtx_equal_p (x->constant, y->constant); } -/* Hash and compare functions for const_rtx_sym_htab. */ - -static hashval_t -const_desc_rtx_sym_hash (const void *ptr) -{ - const struct constant_descriptor_rtx *desc = ptr; - return htab_hash_string (XSTR (desc->sym, 0)); -} - -static int -const_desc_rtx_sym_eq (const void *a, const void *b) -{ - const struct constant_descriptor_rtx *x = a; - const struct constant_descriptor_rtx *y = b; - return XSTR (x->sym, 0) == XSTR (y->sym, 0); -} - /* This is the worker function for const_rtx_hash, called via for_each_rtx. */ static int @@ -2912,8 +2894,6 @@ init_varasm_status (struct function *f) pool->const_rtx_htab = htab_create_ggc (31, const_desc_rtx_hash, const_desc_rtx_eq, NULL); - pool->const_rtx_sym_htab = htab_create_ggc (31, const_desc_rtx_sym_hash, - const_desc_rtx_sym_eq, NULL); pool->first = pool->last = NULL; pool->offset = 0; } @@ -2998,14 +2978,10 @@ force_const_mem (enum machine_mode mode, rtx x) the constants pool. */ desc->sym = symbol = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (label)); SYMBOL_REF_FLAGS (symbol) = SYMBOL_FLAG_LOCAL; + SYMBOL_REF_DATA (symbol) = desc; CONSTANT_POOL_ADDRESS_P (symbol) = 1; current_function_uses_const_pool = 1; - /* Insert the descriptor into the symbol cross-reference table too. */ - slot = htab_find_slot (pool->const_rtx_sym_htab, desc, INSERT); - gcc_assert (!*slot); - *slot = desc; - /* Construct the MEM. */ desc->mem = def = gen_const_mem (mode, symbol); set_mem_attributes (def, lang_hooks.types.type_for_mode (mode, 0), 1); @@ -3019,23 +2995,12 @@ force_const_mem (enum machine_mode mode, rtx x) return copy_rtx (def); } -/* Given a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true, return a pointer to - the corresponding constant_descriptor_rtx structure. */ - -static struct constant_descriptor_rtx * -find_pool_constant (struct rtx_constant_pool *pool, rtx sym) -{ - struct constant_descriptor_rtx tmp; - tmp.sym = sym; - return htab_find (pool->const_rtx_sym_htab, &tmp); -} - /* Given a constant pool SYMBOL_REF, return the corresponding constant. */ rtx get_pool_constant (rtx addr) { - return find_pool_constant (cfun->varasm->pool, addr)->constant; + return SYMBOL_REF_CONSTANT (addr)->constant; } /* Given a constant pool SYMBOL_REF, return the corresponding constant @@ -3046,25 +3011,17 @@ get_pool_constant_mark (rtx addr, bool *pmarked) { struct constant_descriptor_rtx *desc; - desc = find_pool_constant (cfun->varasm->pool, addr); + desc = SYMBOL_REF_CONSTANT (addr); *pmarked = (desc->mark != 0); return desc->constant; } -/* Likewise, but for the constant pool of a specific function. */ - -rtx -get_pool_constant_for_function (struct function *f, rtx addr) -{ - return find_pool_constant (f->varasm->pool, addr)->constant; -} - /* Similar, return the mode. */ enum machine_mode get_pool_mode (rtx addr) { - return find_pool_constant (cfun->varasm->pool, addr)->mode; + return SYMBOL_REF_CONSTANT (addr)->mode; } /* Return the size of the constant pool. */ @@ -3208,7 +3165,7 @@ mark_constant (rtx *current_rtx, void *data) if (CONSTANT_POOL_ADDRESS_P (x)) { - struct constant_descriptor_rtx *desc = find_pool_constant (pool, x); + struct constant_descriptor_rtx *desc = SYMBOL_REF_CONSTANT (x); if (desc->mark == 0) { desc->mark = 1; -- cgit v1.1