Commit 94b01be3 by Jakub Jelinek Committed by Jakub Jelinek

varasm.c (struct varasm_status): Change x_const_rtx_sym_hash_table to array of…

varasm.c (struct varasm_status): Change x_const_rtx_sym_hash_table to array of pool_constnat pointers.

	* varasm.c (struct varasm_status): Change x_const_rtx_sym_hash_table
	to array of pool_constnat pointers.
	(struct pool_constant): Add next_sym and label members.
	(struct pool_sym): Remove.
	(init_varasm_status): Change pool_sym into pool_constant.
	(mark_pool_constant): Mark pc->label string as well.
	(mark_pool_sym_hash_table): Remove.
	(mark_varasm_status): Remove it from caller as well.
	(free_varasm_status): Don't free pool_sym structures.
	(force_const_mem): Don't allocate pool_sym structure, instead
	fill pool->label and chain it into rtx_sym hash table.
	(find_pool_constant, mark_constant_pool): Use pool_constant instead
	of pool_sym.

From-SVN: r37451
parent 716120a7
2000-11-14 Jakub Jelinek <jakub@redhat.com> 2000-11-14 Jakub Jelinek <jakub@redhat.com>
* varasm.c (struct varasm_status): Change x_const_rtx_sym_hash_table
to array of pool_constnat pointers.
(struct pool_constant): Add next_sym and label members.
(struct pool_sym): Remove.
(init_varasm_status): Change pool_sym into pool_constant.
(mark_pool_constant): Mark pc->label string as well.
(mark_pool_sym_hash_table): Remove.
(mark_varasm_status): Remove it from caller as well.
(free_varasm_status): Don't free pool_sym structures.
(force_const_mem): Don't allocate pool_sym structure, instead
fill pool->label and chain it into rtx_sym hash table.
(find_pool_constant, mark_constant_pool): Use pool_constant instead
of pool_sym.
2000-11-14 Jakub Jelinek <jakub@redhat.com>
* reload1.c (emit_input_reload_insns): Honour forcing of constants * reload1.c (emit_input_reload_insns): Honour forcing of constants
into memory by PREFERRED_RELOAD_CLASS NO_REGS. into memory by PREFERRED_RELOAD_CLASS NO_REGS.
......
...@@ -101,7 +101,7 @@ struct varasm_status ...@@ -101,7 +101,7 @@ struct varasm_status
so each function gets its own constants-pool that comes right before so each function gets its own constants-pool that comes right before
it. */ it. */
struct constant_descriptor **x_const_rtx_hash_table; struct constant_descriptor **x_const_rtx_hash_table;
struct pool_sym **x_const_rtx_sym_hash_table; struct pool_constant **x_const_rtx_sym_hash_table;
/* Pointers to first and last constant in pool. */ /* Pointers to first and last constant in pool. */
struct pool_constant *x_first_pool, *x_last_pool; struct pool_constant *x_first_pool, *x_last_pool;
...@@ -184,7 +184,6 @@ static void asm_output_aligned_bss PARAMS ((FILE *, tree, const char *, ...@@ -184,7 +184,6 @@ static void asm_output_aligned_bss PARAMS ((FILE *, tree, const char *,
#endif #endif
#endif /* BSS_SECTION_ASM_OP */ #endif /* BSS_SECTION_ASM_OP */
static void mark_pool_constant PARAMS ((struct pool_constant *)); static void mark_pool_constant PARAMS ((struct pool_constant *));
static void mark_pool_sym_hash_table PARAMS ((struct pool_sym **));
static void mark_const_hash_entry PARAMS ((void *)); static void mark_const_hash_entry PARAMS ((void *));
static void asm_emit_uninitialised PARAMS ((tree, const char*, int, int)); static void asm_emit_uninitialised PARAMS ((tree, const char*, int, int));
...@@ -3220,25 +3219,16 @@ output_constant_def_contents (exp, reloc, labelno) ...@@ -3220,25 +3219,16 @@ output_constant_def_contents (exp, reloc, labelno)
struct pool_constant struct pool_constant
{ {
struct constant_descriptor *desc; struct constant_descriptor *desc;
struct pool_constant *next; struct pool_constant *next, *next_sym;
enum machine_mode mode; char *label;
rtx constant; rtx constant;
enum machine_mode mode;
int labelno; int labelno;
int align; int align;
int offset; int offset;
int mark; int mark;
}; };
/* Structure used to maintain hash table mapping symbols used to their
corresponding constants. */
struct pool_sym
{
char *label;
struct pool_constant *pool;
struct pool_sym *next;
};
/* Hash code for a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true. /* Hash code for a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true.
The argument is XSTR (... , 0) */ The argument is XSTR (... , 0) */
...@@ -3258,8 +3248,8 @@ init_varasm_status (f) ...@@ -3258,8 +3248,8 @@ init_varasm_status (f)
= ((struct constant_descriptor **) = ((struct constant_descriptor **)
xcalloc (MAX_RTX_HASH_TABLE, sizeof (struct constant_descriptor *))); xcalloc (MAX_RTX_HASH_TABLE, sizeof (struct constant_descriptor *)));
p->x_const_rtx_sym_hash_table p->x_const_rtx_sym_hash_table
= ((struct pool_sym **) = ((struct pool_constant **)
xcalloc (MAX_RTX_HASH_TABLE, sizeof (struct pool_sym *))); xcalloc (MAX_RTX_HASH_TABLE, sizeof (struct pool_constant *)));
p->x_first_pool = p->x_last_pool = 0; p->x_first_pool = p->x_last_pool = 0;
p->x_pool_offset = 0; p->x_pool_offset = 0;
...@@ -3276,24 +3266,11 @@ mark_pool_constant (pc) ...@@ -3276,24 +3266,11 @@ mark_pool_constant (pc)
{ {
ggc_mark (pc); ggc_mark (pc);
ggc_mark_rtx (pc->constant); ggc_mark_rtx (pc->constant);
ggc_mark_string (pc->label);
pc = pc->next; pc = pc->next;
} }
} }
/* Mark PPS for GC. */
static void
mark_pool_sym_hash_table (pps)
struct pool_sym **pps;
{
struct pool_sym *ps;
int i;
for (i = 0; i < MAX_RTX_HASH_TABLE; ++i)
for (ps = pps[i]; ps ; ps = ps->next)
ggc_mark_string (ps->label);
}
/* Mark P for GC. */ /* Mark P for GC. */
void void
...@@ -3304,7 +3281,6 @@ mark_varasm_status (p) ...@@ -3304,7 +3281,6 @@ mark_varasm_status (p)
return; return;
mark_pool_constant (p->x_first_pool); mark_pool_constant (p->x_first_pool);
mark_pool_sym_hash_table (p->x_const_rtx_sym_hash_table);
ggc_mark_rtx (p->x_const_double_chain); ggc_mark_rtx (p->x_const_double_chain);
} }
...@@ -3325,7 +3301,6 @@ free_varasm_status (f) ...@@ -3325,7 +3301,6 @@ free_varasm_status (f)
for (i = 0; i < MAX_RTX_HASH_TABLE; ++i) for (i = 0; i < MAX_RTX_HASH_TABLE; ++i)
{ {
struct constant_descriptor* cd; struct constant_descriptor* cd;
struct pool_sym *ps;
cd = p->x_const_rtx_hash_table[i]; cd = p->x_const_rtx_hash_table[i];
while (cd) { while (cd) {
...@@ -3333,13 +3308,6 @@ free_varasm_status (f) ...@@ -3333,13 +3308,6 @@ free_varasm_status (f)
free (cd); free (cd);
cd = next; cd = next;
} }
ps = p->x_const_rtx_sym_hash_table[i];
while (ps) {
struct pool_sym *next = ps->next;
free (ps);
ps = next;
}
} }
free (p->x_const_rtx_hash_table); free (p->x_const_rtx_hash_table);
...@@ -3562,7 +3530,6 @@ force_const_mem (mode, x) ...@@ -3562,7 +3530,6 @@ force_const_mem (mode, x)
if (found == 0) if (found == 0)
{ {
register struct pool_constant *pool; register struct pool_constant *pool;
register struct pool_sym *sym;
int align; int align;
/* No constant equal to X is known to have been output. /* No constant equal to X is known to have been output.
...@@ -3615,11 +3582,9 @@ force_const_mem (mode, x) ...@@ -3615,11 +3582,9 @@ force_const_mem (mode, x)
/* Add label to symbol hash table. */ /* Add label to symbol hash table. */
hash = SYMHASH (found); hash = SYMHASH (found);
sym = (struct pool_sym *) xmalloc (sizeof (struct pool_sym)); pool->label = found;
sym->label = found; pool->next_sym = const_rtx_sym_hash_table[hash];
sym->pool = pool; const_rtx_sym_hash_table[hash] = pool;
sym->next = const_rtx_sym_hash_table[hash];
const_rtx_sym_hash_table[hash] = sym;
} }
/* We have a symbol name; construct the SYMBOL_REF and the MEM. */ /* We have a symbol name; construct the SYMBOL_REF and the MEM. */
...@@ -3653,13 +3618,13 @@ find_pool_constant (f, addr) ...@@ -3653,13 +3618,13 @@ find_pool_constant (f, addr)
struct function *f; struct function *f;
rtx addr; rtx addr;
{ {
struct pool_sym *sym; struct pool_constant *pool;
const char *label = XSTR (addr, 0); const char *label = XSTR (addr, 0);
for (sym = f->varasm->x_const_rtx_sym_hash_table[SYMHASH (label)]; sym; for (pool = f->varasm->x_const_rtx_sym_hash_table[SYMHASH (label)]; pool;
sym = sym->next) pool = pool->next_sym)
if (sym->label == label) if (pool->label == label)
return sym->pool; return pool;
abort (); abort ();
} }
...@@ -3866,7 +3831,7 @@ mark_constant_pool () ...@@ -3866,7 +3831,7 @@ mark_constant_pool ()
not clear that 2'd level references can happen. */ not clear that 2'd level references can happen. */
for (pool = first_pool; pool; pool = pool->next) for (pool = first_pool; pool; pool = pool->next)
{ {
struct pool_sym *sym; struct pool_constant *tem;
const char *label; const char *label;
/* skip unmarked entries; no insn refers to them. */ /* skip unmarked entries; no insn refers to them. */
...@@ -3879,10 +3844,10 @@ mark_constant_pool () ...@@ -3879,10 +3844,10 @@ mark_constant_pool ()
label = XSTR (pool->constant, 0); label = XSTR (pool->constant, 0);
/* Be sure the symbol's value is marked. */ /* Be sure the symbol's value is marked. */
for (sym = const_rtx_sym_hash_table[SYMHASH (label)]; sym; for (tem = const_rtx_sym_hash_table[SYMHASH (label)]; tem;
sym = sym->next) tem = tem->next)
if (sym->label == label) if (tem->label == label)
sym->pool->mark = 1; tem->mark = 1;
/* If we didn't find it, there's something truly wrong here, but it /* If we didn't find it, there's something truly wrong here, but it
will be announced by the assembler. */ will be announced by the assembler. */
} }
......
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