diff options
Diffstat (limited to 'gcc/ira.c')
-rw-r--r-- | gcc/ira.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/gcc/ira.c b/gcc/ira.c index 84d7bc1643b..0f0b70ab473 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -331,9 +331,6 @@ int internal_flag_ira_verbose; /* Dump file of the allocator if it is not NULL. */ FILE *ira_dump_file; -/* Pools for allocnos, copies, allocno live ranges. */ -alloc_pool allocno_pool, copy_pool, allocno_live_range_pool; - /* The number of elements in the following array. */ int ira_spilled_reg_stack_slots_num; @@ -358,9 +355,10 @@ HARD_REG_SET eliminable_regset; of given mode starting with given hard register. */ HARD_REG_SET ira_reg_mode_hard_regset[FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES]; -/* The following two variables are array analogs of the macros - MEMORY_MOVE_COST and REGISTER_MOVE_COST. */ +/* Array analogous to target hook TARGET_MEMORY_MOVE_COST. */ short int ira_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2]; + +/* Array based on TARGET_REGISTER_MOVE_COST. */ move_table *ira_register_move_cost[MAX_MACHINE_MODE]; /* Similar to may_move_in_cost but it is calculated in IRA instead of @@ -527,11 +525,11 @@ setup_class_subset_and_memory_move_costs (void) for (mode = 0; mode < MAX_MACHINE_MODE; mode++) { ira_memory_move_cost[mode][cl][0] = - MEMORY_MOVE_COST ((enum machine_mode) mode, - (enum reg_class) cl, 0); + memory_move_cost ((enum machine_mode) mode, + (enum reg_class) cl, false); ira_memory_move_cost[mode][cl][1] = - MEMORY_MOVE_COST ((enum machine_mode) mode, - (enum reg_class) cl, 1); + memory_move_cost ((enum machine_mode) mode, + (enum reg_class) cl, true); /* Costs for NO_REGS are used in cost calculation on the 1st pass when the preferred register classes are not known yet. In this case we take the best scenario. */ @@ -742,7 +740,7 @@ setup_cover_and_important_classes (void) { int i, j, n, cl; bool set_p; - const enum reg_class *cover_classes; + const reg_class_t *cover_classes; HARD_REG_SET temp_hard_regset2; static enum reg_class classes[LIM_REG_CLASSES + 1]; @@ -1585,12 +1583,8 @@ find_reg_equiv_invariant_const (void) x = XEXP (note, 0); - if (! function_invariant_p (x) - || ! flag_pic - /* A function invariant is often CONSTANT_P but may - include a register. We promise to only pass CONSTANT_P - objects to LEGITIMATE_PIC_OPERAND_P. */ - || (CONSTANT_P (x) && LEGITIMATE_PIC_OPERAND_P (x))) + if (! CONSTANT_P (x) + || ! flag_pic || LEGITIMATE_PIC_OPERAND_P (x)) { /* It can happen that a REG_EQUIV note contains a MEM that is not a legitimate memory operand. As later @@ -1790,8 +1784,7 @@ fix_reg_equiv_init (void) if (reg_equiv_init_size < max_regno) { - reg_equiv_init - = (rtx *) ggc_realloc (reg_equiv_init, max_regno * sizeof (rtx)); + reg_equiv_init = GGC_RESIZEVEC (rtx, reg_equiv_init, max_regno); while (reg_equiv_init_size < max_regno) reg_equiv_init[reg_equiv_init_size++] = NULL_RTX; for (i = FIRST_PSEUDO_REGISTER; i < reg_equiv_init_size; i++) @@ -2370,7 +2363,7 @@ update_equiv_regs (void) recorded_label_ref = 0; reg_equiv = XCNEWVEC (struct equivalence, max_regno); - reg_equiv_init = GGC_CNEWVEC (rtx, max_regno); + reg_equiv_init = ggc_alloc_cleared_vec_rtx (max_regno); reg_equiv_init_size = max_regno; init_alias_analysis (); @@ -3149,8 +3142,19 @@ build_insn_chain (void) if (dump_file) print_insn_chains (dump_file); } - +/* Allocate memory for reg_equiv_memory_loc. */ +static void +init_reg_equiv_memory_loc (void) +{ + max_regno = max_reg_num (); + + /* And the reg_equiv_memory_loc array. */ + VEC_safe_grow (rtx, gc, reg_equiv_memory_loc_vec, max_regno); + memset (VEC_address (rtx, reg_equiv_memory_loc_vec), 0, + sizeof (rtx) * max_regno); + reg_equiv_memory_loc = VEC_address (rtx, reg_equiv_memory_loc_vec); +} /* All natural loops. */ struct loops ira_loops; @@ -3255,6 +3259,8 @@ ira (FILE *f) record_loop_exits (); current_loops = &ira_loops; + init_reg_equiv_memory_loc (); + if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL) fprintf (ira_dump_file, "Building IRA IR\n"); loops_p = ira_build (optimize @@ -3315,13 +3321,8 @@ ira (FILE *f) #endif delete_trivially_dead_insns (get_insns (), max_reg_num ()); - max_regno = max_reg_num (); - /* And the reg_equiv_memory_loc array. */ - VEC_safe_grow (rtx, gc, reg_equiv_memory_loc_vec, max_regno); - memset (VEC_address (rtx, reg_equiv_memory_loc_vec), 0, - sizeof (rtx) * max_regno); - reg_equiv_memory_loc = VEC_address (rtx, reg_equiv_memory_loc_vec); + init_reg_equiv_memory_loc (); if (max_regno != max_regno_before_ira) { |