diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-19 14:47:15 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-19 14:47:15 +0000 |
commit | f0af5a8826645f54448b3b82f1ab364bd8952562 (patch) | |
tree | f3d03226f923b6c64639256ed34bd193427950a7 /gcc/gcse.c | |
parent | 4d11421ff19618a40d8a8384deffb02182147607 (diff) | |
download | gcc-f0af5a8826645f54448b3b82f1ab364bd8952562.tar.gz |
* alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.c
c-common.c c-decl.c c-incpath.c c-lex.c c-opts.c c-parse.in
c-pragma.c c-typeck.c calls.c cfg.c cfganal.c cfgloop.c cfgrtl.c
collect2.c combine.c conflict.c coverage.c cppexp.c cppfiles.c
cpphash.c cppinit.c cpplex.c cpplib.c cppmacro.c cppspec.c
cpptrad.c cse.c cselib.c dbxout.c defaults.h df.c dominance.c
dwarf2out.c dwarfout.c emit-rtl.c except.c expmed.c expr.c final.c
fix-header.c flow.c fold-const.c function.c gcc.c gccspec.c gcov.c
gcse.c genattr.c genattrtab.c genautomata.c genconditions.c
genemit.c genextract.c genoutput.c genrecog.c gensupport.c
ggc-page.c ggc-simple.c global.c graph.c haifa-sched.c hashtable.c
integrate.c jump.c langhooks.c lcm.c line-map.c local-alloc.c
loop.c mips-tdump.c mips-tfile.c mkdeps.c optabs.c params.c
postreload.c prefix.c print-tree.c protoize.c ra-build.c
ra-colorize.c ra-rewrite.c ra.c recog.c reg-stack.c regclass.c
regmove.c regrename.c reload.c reload1.c reorg.c resource.c
sbitmap.c sched-deps.c sched-rgn.c sched-vis.c sdbout.c
simplify-rtx.c ssa-ccp.c ssa.c stmt.c stor-layout.c timevar.c
tlink.c toplev.c tree-dump.c tree.c unroll.c unwind-dw2-fde.c
varasm.c varray.c vmsdbgout.c xcoffout.c: Remove unnecessary
casts.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69587 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r-- | gcc/gcse.c | 121 |
1 files changed, 57 insertions, 64 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c index 6420faf2a20..3b57aa1a856 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -549,9 +549,9 @@ struct null_pointer_info }; static void compute_can_copy (void); -static char *gmalloc (unsigned int); -static char *grealloc (char *, unsigned int); -static char *gcse_alloc (unsigned long); +static void *gmalloc (unsigned int); +static void *grealloc (void *, unsigned int); +static void *gcse_alloc (unsigned long); static void alloc_gcse_mem (rtx); static void free_gcse_mem (void); static void alloc_reg_set_mem (int); @@ -821,12 +821,11 @@ gcse_main (rtx f, FILE *file) if (changed) { free_modify_mem_tables (); - modify_mem_list - = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); + modify_mem_list = gmalloc (last_basic_block * sizeof (rtx)); canon_modify_mem_list - = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); - memset ((char *) modify_mem_list, 0, last_basic_block * sizeof (rtx)); - memset ((char *) canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); + = gmalloc (last_basic_block * sizeof (rtx)); + memset (modify_mem_list, 0, last_basic_block * sizeof (rtx)); + memset (canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); } free_reg_set_mem (); alloc_reg_set_mem (max_reg_num ()); @@ -954,7 +953,7 @@ can_copy_p (enum machine_mode mode) /* Cover function to xmalloc to record bytes allocated. */ -static char * +static void * gmalloc (unsigned int size) { bytes_used += size; @@ -965,19 +964,19 @@ gmalloc (unsigned int size) We don't record the additional size since we don't know it. It won't affect memory usage stats much anyway. */ -static char * -grealloc (char *ptr, unsigned int size) +static void * +grealloc (void *ptr, unsigned int size) { return xrealloc (ptr, size); } /* Cover function to obstack_alloc. */ -static char * +static void * gcse_alloc (unsigned long size) { bytes_used += size; - return (char *) obstack_alloc (&gcse_obstack, size); + return obstack_alloc (&gcse_obstack, size); } /* Allocate memory for the cuid mapping array, @@ -997,8 +996,8 @@ alloc_gcse_mem (rtx f) max_uid = get_max_uid (); n = (max_uid + 1) * sizeof (int); - uid_cuid = (int *) gmalloc (n); - memset ((char *) uid_cuid, 0, n); + uid_cuid = gmalloc (n); + memset (uid_cuid, 0, n); for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) { if (INSN_P (insn)) @@ -1011,8 +1010,8 @@ alloc_gcse_mem (rtx f) max_cuid = i; n = (max_cuid + 1) * sizeof (rtx); - cuid_insn = (rtx *) gmalloc (n); - memset ((char *) cuid_insn, 0, n); + cuid_insn = gmalloc (n); + memset (cuid_insn, 0, n); for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) if (INSN_P (insn)) CUID_INSN (i++) = insn; @@ -1021,14 +1020,13 @@ alloc_gcse_mem (rtx f) reg_set_bitmap = BITMAP_XMALLOC (); /* Allocate vars to track sets of regs, memory per block. */ - reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (last_basic_block, - max_gcse_regno); + reg_set_in_block = sbitmap_vector_alloc (last_basic_block, max_gcse_regno); /* Allocate array to keep a list of insns which modify memory in each basic block. */ - modify_mem_list = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); - canon_modify_mem_list = (rtx *) gmalloc (last_basic_block * sizeof (rtx)); - memset ((char *) modify_mem_list, 0, last_basic_block * sizeof (rtx)); - memset ((char *) canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); + modify_mem_list = gmalloc (last_basic_block * sizeof (rtx)); + canon_modify_mem_list = gmalloc (last_basic_block * sizeof (rtx)); + memset (modify_mem_list, 0, last_basic_block * sizeof (rtx)); + memset (canon_modify_mem_list, 0, last_basic_block * sizeof (rtx)); modify_mem_list_set = BITMAP_XMALLOC (); canon_modify_mem_list_set = BITMAP_XMALLOC (); } @@ -1195,8 +1193,8 @@ alloc_reg_set_mem (int n_regs) reg_set_table_size = n_regs + REG_SET_TABLE_SLOP; n = reg_set_table_size * sizeof (struct reg_set *); - reg_set_table = (struct reg_set **) gmalloc (n); - memset ((char *) reg_set_table, 0, n); + reg_set_table = gmalloc (n); + memset (reg_set_table, 0, n); gcc_obstack_init (®_set_obstack); } @@ -1221,16 +1219,14 @@ record_one_set (int regno, rtx insn) { int new_size = regno + REG_SET_TABLE_SLOP; - reg_set_table - = (struct reg_set **) grealloc ((char *) reg_set_table, - new_size * sizeof (struct reg_set *)); - memset ((char *) (reg_set_table + reg_set_table_size), 0, + reg_set_table = grealloc (reg_set_table, + new_size * sizeof (struct reg_set *)); + memset (reg_set_table + reg_set_table_size, 0, (new_size - reg_set_table_size) * sizeof (struct reg_set *)); reg_set_table_size = new_size; } - new_reg_info = (struct reg_set *) obstack_alloc (®_set_obstack, - sizeof (struct reg_set)); + new_reg_info = obstack_alloc (®_set_obstack, sizeof (struct reg_set)); bytes_used += sizeof (struct reg_set); new_reg_info->insn = insn; new_reg_info->next = reg_set_table[regno]; @@ -1937,7 +1933,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, if (! found) { - cur_expr = (struct expr *) gcse_alloc (sizeof (struct expr)); + cur_expr = gcse_alloc (sizeof (struct expr)); bytes_used += sizeof (struct expr); if (table->table[hash] == NULL) /* This is the first pattern that hashed to this index. */ @@ -1976,7 +1972,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, else { /* First occurrence of this expression in this basic block. */ - antic_occr = (struct occr *) gcse_alloc (sizeof (struct occr)); + antic_occr = gcse_alloc (sizeof (struct occr)); bytes_used += sizeof (struct occr); /* First occurrence of this expression in any block? */ if (cur_expr->antic_occr == NULL) @@ -2011,7 +2007,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, else { /* First occurrence of this expression in this basic block. */ - avail_occr = (struct occr *) gcse_alloc (sizeof (struct occr)); + avail_occr = gcse_alloc (sizeof (struct occr)); bytes_used += sizeof (struct occr); /* First occurrence of this expression in any block? */ @@ -2058,7 +2054,7 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table *table) if (! found) { - cur_expr = (struct expr *) gcse_alloc (sizeof (struct expr)); + cur_expr = gcse_alloc (sizeof (struct expr)); bytes_used += sizeof (struct expr); if (table->table[hash] == NULL) /* This is the first pattern that hashed to this index. */ @@ -2097,7 +2093,7 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table *table) else { /* First occurrence of this expression in this basic block. */ - cur_occr = (struct occr *) gcse_alloc (sizeof (struct occr)); + cur_occr = gcse_alloc (sizeof (struct occr)); bytes_used += sizeof (struct occr); /* First occurrence of this expression in any block? */ @@ -2286,9 +2282,8 @@ dump_hash_table (FILE *file, const char *name, struct hash_table *table) unsigned int *hash_val; struct expr *expr; - flat_table - = (struct expr **) xcalloc (table->n_elems, sizeof (struct expr *)); - hash_val = (unsigned int *) xmalloc (table->n_elems * sizeof (unsigned int)); + flat_table = xcalloc (table->n_elems, sizeof (struct expr *)); + hash_val = xmalloc (table->n_elems * sizeof (unsigned int)); for (i = 0; i < (int) table->size; i++) for (expr = table->table[i]; expr != NULL; expr = expr->next_same_hash) @@ -2459,8 +2454,7 @@ compute_hash_table_work (struct hash_table *table) /* re-Cache any INSN_LIST nodes we have allocated. */ clear_modify_mem_tables (); /* Some working arrays used to track first and last set in each block. */ - reg_avail_info = (struct reg_avail_info*) - gmalloc (max_gcse_regno * sizeof (struct reg_avail_info)); + reg_avail_info = gmalloc (max_gcse_regno * sizeof (struct reg_avail_info)); for (i = 0; i < max_gcse_regno; ++i) reg_avail_info[i].last_bb = NULL; @@ -2550,7 +2544,7 @@ alloc_hash_table (int n_insns, struct hash_table *table, int set_p) ??? Later take some measurements. */ table->size |= 1; n = table->size * sizeof (struct expr *); - table->table = (struct expr **) gmalloc (n); + table->table = gmalloc (n); table->set_p = set_p; } @@ -2570,8 +2564,7 @@ compute_hash_table (struct hash_table *table) { /* Initialize count of number of entries in hash table. */ table->n_elems = 0; - memset ((char *) table->table, 0, - table->size * sizeof (struct expr *)); + memset (table->table, 0, table->size * sizeof (struct expr *)); compute_hash_table_work (table); } @@ -2842,16 +2835,16 @@ mark_oprs_set (rtx insn) static void alloc_rd_mem (int n_blocks, int n_insns) { - rd_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + rd_kill = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (rd_kill, n_blocks); - rd_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + rd_gen = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (rd_gen, n_blocks); - reaching_defs = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + reaching_defs = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (reaching_defs, n_blocks); - rd_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns); + rd_out = sbitmap_vector_alloc (n_blocks, n_insns); sbitmap_vector_zero (rd_out, n_blocks); } @@ -2969,16 +2962,16 @@ compute_rd (void) static void alloc_avail_expr_mem (int n_blocks, int n_exprs) { - ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_kill = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_kill, n_blocks); - ae_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_gen = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_gen, n_blocks); - ae_in = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_in = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_in, n_blocks); - ae_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs); + ae_out = sbitmap_vector_alloc (n_blocks, n_exprs); sbitmap_vector_zero (ae_out, n_blocks); } @@ -3175,7 +3168,7 @@ expr_reaches_here_p (struct occr *occr, struct expr *expr, basic_block bb, int check_self_loop) { int rval; - char *visited = (char *) xcalloc (last_basic_block, 1); + char *visited = xcalloc (last_basic_block, 1); rval = expr_reaches_here_p_work (occr, expr, bb, check_self_loop, visited); @@ -4591,7 +4584,7 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps) local_cprop_pass (cprop_jumps); /* Determine implicit sets. */ - implicit_sets = (rtx *) xcalloc (last_basic_block, sizeof (rtx)); + implicit_sets = xcalloc (last_basic_block, sizeof (rtx)); find_implicit_sets (); alloc_hash_table (max_cuid, &set_hash_table, 1); @@ -5108,7 +5101,7 @@ static int pre_expr_reaches_here_p (basic_block occr_bb, struct expr *expr, basic_block bb) { int rval; - char *visited = (char *) xcalloc (last_basic_block, 1); + char *visited = xcalloc (last_basic_block, 1); rval = pre_expr_reaches_here_p_work (occr_bb, expr, bb, visited); @@ -5577,7 +5570,7 @@ pre_gcse (void) /* Compute a mapping from expression number (`bitmap_index') to hash table entry. */ - index_map = (struct expr **) xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); + index_map = xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); for (i = 0; i < expr_hash_table.size; i++) for (expr = expr_hash_table.table[i]; expr != NULL; expr = expr->next_same_hash) index_map[expr->bitmap_index] = expr; @@ -5988,7 +5981,7 @@ delete_null_pointer_checks (rtx f ATTRIBUTE_UNUSED) /* Go through the basic blocks, seeing whether or not each block ends with a conditional branch whose condition is a comparison against zero. Record the register compared in BLOCK_REG. */ - block_reg = (unsigned int *) xcalloc (last_basic_block, sizeof (int)); + block_reg = xcalloc (last_basic_block, sizeof (int)); FOR_EACH_BB (bb) { rtx last_insn = bb->end; @@ -6220,7 +6213,7 @@ hoist_code (void) /* Compute a mapping from expression number (`bitmap_index') to hash table entry. */ - index_map = (struct expr **) xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); + index_map = xcalloc (expr_hash_table.n_elems, sizeof (struct expr *)); for (i = 0; i < expr_hash_table.size; i++) for (expr = expr_hash_table.table[i]; expr != NULL; expr = expr->next_same_hash) index_map[expr->bitmap_index] = expr; @@ -6433,7 +6426,7 @@ ldst_entry (rtx x) if (!ptr) { - ptr = (struct ls_expr *) xmalloc (sizeof (struct ls_expr)); + ptr = xmalloc (sizeof (struct ls_expr)); ptr->next = pre_ldst_mems; ptr->expr = NULL; @@ -7079,7 +7072,7 @@ compute_store_table (void) max_gcse_regno = max_reg_num (); - reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (last_basic_block, + reg_set_in_block = sbitmap_vector_alloc (last_basic_block, max_gcse_regno); sbitmap_vector_zero (reg_set_in_block, last_basic_block); pre_ldst_mems = 0; @@ -7379,10 +7372,10 @@ build_store_vectors (void) /* Build the gen_vector. This is any store in the table which is not killed by aliasing later in its block. */ - ae_gen = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + ae_gen = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (ae_gen, last_basic_block); - st_antloc = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + st_antloc = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (st_antloc, last_basic_block); for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr)) @@ -7415,10 +7408,10 @@ build_store_vectors (void) } } - ae_kill = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + ae_kill = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (ae_kill, last_basic_block); - transp = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores); + transp = sbitmap_vector_alloc (last_basic_block, num_stores); sbitmap_vector_zero (transp, last_basic_block); regs_set_in_block = xmalloc (sizeof (int) * max_gcse_regno); |