re PR debug/66691 (ICE on valid code at -O3 with -g enabled in simplify_subreg, at...
[gcc.git] / gcc / ira-int.h
index b9b21ba27af32d9fce8b0e0b42917abc50c8a81e..c2853dcdd37946ef894f96ef0a7019854dfad0ba 100644 (file)
@@ -1,5 +1,5 @@
 /* Integrated Register Allocator (IRA) intercommunication header file.
-   Copyright (C) 2006-2013 Free Software Foundation, Inc.
+   Copyright (C) 2006-2015 Free Software Foundation, Inc.
    Contributed by Vladimir Makarov <vmakarov@redhat.com>.
 
 This file is part of GCC.
@@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#ifndef GCC_IRA_INT_H
+#define GCC_IRA_INT_H
+
 #include "cfgloop.h"
 #include "ira.h"
 #include "alloc-pool.h"
@@ -42,9 +45,9 @@ along with GCC; see the file COPYING3.  If not see
    profile driven feedback is available and the function is never
    executed, frequency is always equivalent.  Otherwise rescale the
    edge frequency.  */
-#define REG_FREQ_FROM_EDGE_FREQ(freq)                                     \
-  (optimize_size || (flag_branch_probabilities && !ENTRY_BLOCK_PTR->count) \
-   ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX)                           \
+#define REG_FREQ_FROM_EDGE_FREQ(freq)                             \
+  (optimize_function_for_size_p (cfun)                            \
+   ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX)                   \
    ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1)
 
 /* A modified value of flag `-fira-verbose' used internally.  */
@@ -280,6 +283,9 @@ struct ira_allocno
   /* Mode of the allocno which is the mode of the corresponding
      pseudo-register.  */
   ENUM_BITFIELD (machine_mode) mode : 8;
+  /* Widest mode of the allocno which in at least one case could be
+     for paradoxical subregs where wmode > mode.  */
+  ENUM_BITFIELD (machine_mode) wmode : 8;
   /* Register class which should be used for allocation for given
      allocno.  NO_REGS means that we should use memory.  */
   ENUM_BITFIELD (reg_class) aclass : 16;
@@ -312,7 +318,7 @@ struct ira_allocno
      number (0, ...) - 2.  Value -1 is used for allocnos spilled by the
      reload (at this point pseudo-register has only one allocno) which
      did not get stack slot yet.  */
-  short int hard_regno;
+  signed int hard_regno : 16;
   /* Allocnos with the same regno are linked by the following member.
      Allocnos corresponding to inner loops are first in the list (it
      corresponds to depth-first traverse of the loops).  */
@@ -374,6 +380,8 @@ struct ira_allocno
   /* The number of calls across which it is live, but which should not
      affect register preferences.  */
   int cheap_calls_crossed_num;
+  /* Registers clobbered by intersected calls.  */
+   HARD_REG_SET crossed_calls_clobbered_regs;
   /* Array of usage costs (accumulated and the one updated during
      coloring) for each hard register of the allocno class.  The
      member value can be NULL if all costs are the same and equal to
@@ -417,6 +425,8 @@ struct ira_allocno
 #define ALLOCNO_CALL_FREQ(A) ((A)->call_freq)
 #define ALLOCNO_CALLS_CROSSED_NUM(A) ((A)->calls_crossed_num)
 #define ALLOCNO_CHEAP_CALLS_CROSSED_NUM(A) ((A)->cheap_calls_crossed_num)
+#define ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS(A) \
+  ((A)->crossed_calls_clobbered_regs)
 #define ALLOCNO_MEM_OPTIMIZED_DEST(A) ((A)->mem_optimized_dest)
 #define ALLOCNO_MEM_OPTIMIZED_DEST_P(A) ((A)->mem_optimized_dest_p)
 #define ALLOCNO_SOMEWHERE_RENAMED_P(A) ((A)->somewhere_renamed_p)
@@ -429,6 +439,7 @@ struct ira_allocno
 #define ALLOCNO_BAD_SPILL_P(A) ((A)->bad_spill_p)
 #define ALLOCNO_ASSIGNED_P(A) ((A)->assigned_p)
 #define ALLOCNO_MODE(A) ((A)->mode)
+#define ALLOCNO_WMODE(A) ((A)->wmode)
 #define ALLOCNO_PREFS(A) ((A)->allocno_prefs)
 #define ALLOCNO_COPIES(A) ((A)->allocno_copies)
 #define ALLOCNO_HARD_REG_COSTS(A) ((A)->hard_reg_costs)
@@ -520,7 +531,7 @@ extern ira_object_t *ira_object_id_map;
 /* The size of the previous array.  */
 extern int ira_objects_num;
 
-/* The following structure represents a hard register prefererence of
+/* The following structure represents a hard register preference of
    allocno.  The preference represent move insns or potential move
    insns usually because of two operand insn constraints.  One move
    operand is a hard register.  */
@@ -535,7 +546,7 @@ struct ira_allocno_pref
   int freq;
   /* Given allocno.  */
   ira_allocno_t allocno;
-  /* All prefernces with the same allocno are linked by the following
+  /* All preferences with the same allocno are linked by the following
      member.  */
   ira_pref_t next_pref;
 };
@@ -567,7 +578,7 @@ struct ira_allocno_copy
      for the copy created to remove register shuffle is NULL.  In last
      case the copy frequency is smaller than the corresponding insn
      execution frequency.  */
-  rtx insn;
+  rtx_insn *insn;
   /* All copies with the same allocno as FIRST are linked by the two
      following members.  */
   ira_copy_t prev_first_allocno_copy, next_first_allocno_copy;
@@ -609,9 +620,9 @@ extern struct ira_spilled_reg_stack_slot *ira_spilled_reg_stack_slots;
    allocnos assigned to hard-registers, cost of the allocnos assigned
    to memory, cost of loads, stores and register move insns generated
    for pseudo-register live range splitting (see ira-emit.c).  */
-extern int ira_overall_cost;
-extern int ira_reg_cost, ira_mem_cost;
-extern int ira_load_cost, ira_store_cost, ira_shuffle_cost;
+extern int64_t ira_overall_cost;
+extern int64_t ira_reg_cost, ira_mem_cost;
+extern int64_t ira_load_cost, ira_store_cost, ira_shuffle_cost;
 extern int ira_move_loops_num, ira_additional_jumps_num;
 
 \f
@@ -687,7 +698,7 @@ extern int ira_move_loops_num, ira_additional_jumps_num;
 #endif
 
 /* The iterator for min/max sets.  */
-typedef struct {
+struct minmax_set_iterator {
 
   /* Array containing the bit vector.  */
   IRA_INT_TYPE *vec;
@@ -706,7 +717,7 @@ typedef struct {
 
   /* The word of the bit vector currently visited.  */
   unsigned IRA_INT_TYPE word;
-} minmax_set_iterator;
+};
 
 /* Initialize the iterator I for bit vector VEC containing minimal and
    maximal values MIN and MAX.  */
@@ -766,6 +777,11 @@ minmax_set_iter_next (minmax_set_iterator *i)
        minmax_set_iter_next (&(ITER)))
 \f
 struct target_ira_int {
+  ~target_ira_int ();
+
+  void free_ira_costs ();
+  void free_register_move_costs ();
+
   /* Initialized once.  It is a maximal possible size of the allocated
      struct costs.  */
   int x_max_struct_costs_size;
@@ -827,11 +843,6 @@ struct target_ira_int {
      unavailable for the allocation.  */
   short x_ira_class_hard_reg_index[N_REG_CLASSES][FIRST_PSEUDO_REGISTER];
 
-  /* Array whose values are hard regset of hard registers available for
-     the allocation of given register class whose HARD_REGNO_MODE_OK
-     values for given mode are zero.  */
-  HARD_REG_SET x_ira_prohibited_class_mode_regs[N_REG_CLASSES][NUM_MACHINE_MODES];
-
   /* Index [CL][M] contains R if R appears somewhere in a register of the form:
 
          (reg:M R'), R' not in x_ira_prohibited_class_mode_regs[CL][M]
@@ -923,8 +934,6 @@ extern struct target_ira_int *this_target_ira_int;
   (this_target_ira_int->x_ira_non_ordered_class_hard_regs)
 #define ira_class_hard_reg_index \
   (this_target_ira_int->x_ira_class_hard_reg_index)
-#define ira_prohibited_class_mode_regs \
-  (this_target_ira_int->x_ira_prohibited_class_mode_regs)
 #define ira_useful_class_mode_regs \
   (this_target_ira_int->x_ira_useful_class_mode_regs)
 #define ira_important_classes_num \
@@ -955,8 +964,8 @@ extern void ira_free_bitmap (bitmap);
 extern void ira_print_disposition (FILE *);
 extern void ira_debug_disposition (void);
 extern void ira_debug_allocno_classes (void);
-extern void ira_init_register_move_cost (enum machine_mode);
-extern void ira_setup_alts (rtx insn, HARD_REG_SET &alts);
+extern void ira_init_register_move_cost (machine_mode);
+extern void ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts);
 extern int ira_get_dup_out_num (int op_num, HARD_REG_SET &alts);
 
 /* ira-build.c */
@@ -1005,9 +1014,11 @@ extern void ira_add_allocno_pref (ira_allocno_t, int, int);
 extern void ira_remove_pref (ira_pref_t);
 extern void ira_remove_allocno_prefs (ira_allocno_t);
 extern ira_copy_t ira_create_copy (ira_allocno_t, ira_allocno_t,
-                                  int, bool, rtx, ira_loop_tree_node_t);
+                                  int, bool, rtx_insn *,
+                                  ira_loop_tree_node_t);
 extern ira_copy_t ira_add_allocno_copy (ira_allocno_t, ira_allocno_t, int,
-                                       bool, rtx, ira_loop_tree_node_t);
+                                       bool, rtx_insn *,
+                                       ira_loop_tree_node_t);
 
 extern int *ira_allocate_cost_vector (reg_class_t);
 extern void ira_free_cost_vector (int *, reg_class_t);
@@ -1019,7 +1030,6 @@ extern void ira_destroy (void);
 /* ira-costs.c */
 extern void ira_init_costs_once (void);
 extern void ira_init_costs (void);
-extern void ira_finish_costs_once (void);
 extern void ira_costs (void);
 extern void ira_tune_allocno_costs (void);
 
@@ -1071,7 +1081,7 @@ ira_equiv_no_lvalue_p (int regno)
 
 /* Initialize register costs for MODE if necessary.  */
 static inline void
-ira_init_register_move_cost_if_necessary (enum machine_mode mode)
+ira_init_register_move_cost_if_necessary (machine_mode mode)
 {
   if (ira_register_move_cost[mode] == NULL)
     ira_init_register_move_cost (mode);
@@ -1080,10 +1090,10 @@ ira_init_register_move_cost_if_necessary (enum machine_mode mode)
 \f
 
 /* The iterator for all allocnos.  */
-typedef struct {
+struct ira_allocno_iterator {
   /* The number of the current element in IRA_ALLOCNOS.  */
   int n;
-} ira_allocno_iterator;
+};
 
 /* Initialize the iterator I.  */
 static inline void
@@ -1117,10 +1127,10 @@ ira_allocno_iter_cond (ira_allocno_iterator *i, ira_allocno_t *a)
        ira_allocno_iter_cond (&(ITER), &(A));)
 \f
 /* The iterator for all objects.  */
-typedef struct {
+struct ira_object_iterator {
   /* The number of the current element in ira_object_id_map.  */
   int n;
-} ira_object_iterator;
+};
 
 /* Initialize the iterator I.  */
 static inline void
@@ -1154,10 +1164,10 @@ ira_object_iter_cond (ira_object_iterator *i, ira_object_t *obj)
        ira_object_iter_cond (&(ITER), &(OBJ));)
 \f
 /* The iterator for objects associated with an allocno.  */
-typedef struct {
+struct ira_allocno_object_iterator {
   /* The number of the element the allocno's object array.  */
   int n;
-} ira_allocno_object_iterator;
+};
 
 /* Initialize the iterator I.  */
 static inline void
@@ -1191,10 +1201,10 @@ ira_allocno_object_iter_cond (ira_allocno_object_iterator *i, ira_allocno_t a,
 \f
 
 /* The iterator for prefs.  */
-typedef struct {
+struct ira_pref_iterator {
   /* The number of the current element in IRA_PREFS.  */
   int n;
-} ira_pref_iterator;
+};
 
 /* Initialize the iterator I.  */
 static inline void
@@ -1229,10 +1239,10 @@ ira_pref_iter_cond (ira_pref_iterator *i, ira_pref_t *pref)
 \f
 
 /* The iterator for copies.  */
-typedef struct {
+struct ira_copy_iterator {
   /* The number of the current element in IRA_COPIES.  */
   int n;
-} ira_copy_iterator;
+};
 
 /* Initialize the iterator I.  */
 static inline void
@@ -1266,7 +1276,7 @@ ira_copy_iter_cond (ira_copy_iterator *i, ira_copy_t *cp)
        ira_copy_iter_cond (&(ITER), &(C));)
 \f
 /* The iterator for object conflicts.  */
-typedef struct {
+struct ira_object_conflict_iterator {
 
   /* TRUE if the conflicts are represented by vector of allocnos.  */
   bool conflict_vec_p;
@@ -1293,7 +1303,7 @@ typedef struct {
   /* The word of bit vector currently visited.  It is defined only if
      OBJECT_CONFLICT_VEC_P is FALSE.  */
   unsigned IRA_INT_TYPE word;
-} ira_object_conflict_iterator;
+};
 
 /* Initialize the iterator I with ALLOCNO conflicts.  */
 static inline void
@@ -1377,7 +1387,7 @@ ira_object_conflict_iter_cond (ira_object_conflict_iterator *i,
    starting with HARD_REGNO and containing value of MODE are in set
    HARD_REGSET.  */
 static inline bool
-ira_hard_reg_set_intersection_p (int hard_regno, enum machine_mode mode,
+ira_hard_reg_set_intersection_p (int hard_regno, machine_mode mode,
                                 HARD_REG_SET hard_regset)
 {
   int i;
@@ -1405,7 +1415,7 @@ hard_reg_set_size (HARD_REG_SET set)
    HARD_REGNO and containing value of MODE are fully in set
    HARD_REGSET.  */
 static inline bool
-ira_hard_reg_in_set_p (int hard_regno, enum machine_mode mode,
+ira_hard_reg_in_set_p (int hard_regno, machine_mode mode,
                       HARD_REG_SET hard_regset)
 {
   int i;
@@ -1497,3 +1507,5 @@ ira_allocate_and_set_or_copy_costs (int **vec, enum reg_class aclass,
 
 extern rtx ira_create_new_reg (rtx);
 extern int first_moveable_pseudo, last_moveable_pseudo;
+
+#endif /* GCC_IRA_INT_H */