be: get rid of arch_irn_classify callback
authorMatthias Braun <matze@braunis.de>
Thu, 10 Nov 2011 12:57:33 +0000 (13:57 +0100)
committerMatthias Braun <matze@braunis.de>
Thu, 10 Nov 2011 13:17:50 +0000 (14:17 +0100)
ir/be/TEMPLATE/bearch_TEMPLATE.c
ir/be/amd64/bearch_amd64.c
ir/be/arm/bearch_arm.c
ir/be/bearch.c
ir/be/bearch.h
ir/be/benode.c
ir/be/bestat.c
ir/be/bestat.h
ir/be/beverify.c
ir/be/ia32/bearch_ia32.c
ir/be/sparc/bearch_sparc.c

index b6acf78..e67be59 100644 (file)
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
-static arch_irn_class_t TEMPLATE_classify(const ir_node *irn)
-{
-       (void) irn;
-       return arch_irn_class_none;
-}
-
 static ir_entity *TEMPLATE_get_frame_entity(const ir_node *node)
 {
        (void) node;
@@ -88,7 +82,6 @@ static int TEMPLATE_get_sp_bias(const ir_node *irn)
 /* fill register allocator interface */
 
 static const arch_irn_ops_t TEMPLATE_irn_ops = {
-       TEMPLATE_classify,
        TEMPLATE_get_frame_entity,
        TEMPLATE_set_frame_offset,
        TEMPLATE_get_sp_bias,
index 19828fe..11fdf3a 100644 (file)
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
-static arch_irn_class_t amd64_classify(const ir_node *irn)
-{
-       (void) irn;
-       return arch_irn_class_none;
-}
-
 static ir_entity *amd64_get_frame_entity(const ir_node *node)
 {
        if (is_amd64_FrameAddr(node)) {
@@ -113,7 +107,6 @@ static int amd64_get_sp_bias(const ir_node *irn)
 /* fill register allocator interface */
 
 static const arch_irn_ops_t amd64_irn_ops = {
-       amd64_classify,
        amd64_get_frame_entity,
        amd64_set_frame_offset,
        amd64_get_sp_bias,
index 89e01fa..e0291d4 100644 (file)
 #include "arm_emitter.h"
 #include "arm_map_regs.h"
 
-static arch_irn_class_t arm_classify(const ir_node *irn)
-{
-       (void) irn;
-       /* TODO: we should mark reload/spill instructions and classify them here */
-       return arch_irn_class_none;
-}
-
 static ir_entity *arm_get_frame_entity(const ir_node *irn)
 {
        const arm_attr_t *attr = get_arm_attr_const(irn);
@@ -118,7 +111,6 @@ static int arm_get_sp_bias(const ir_node *irn)
 /* fill register allocator interface */
 
 static const arch_irn_ops_t arm_irn_ops = {
-       arm_classify,
        arm_get_frame_entity,
        arm_set_stack_bias,
        arm_get_sp_bias,
index 0548f60..7082648 100644 (file)
@@ -212,12 +212,6 @@ const arch_register_req_t *arch_get_irn_register_req(const ir_node *node)
        return out->req;
 }
 
-arch_irn_class_t arch_irn_classify(const ir_node *node)
-{
-       const arch_irn_ops_t *ops = get_irn_ops(node);
-       return ops->classify(node);
-}
-
 arch_irn_flags_t arch_get_irn_flags(const ir_node *node)
 {
        backend_info_t *info;
index 1cc535d..79bbe84 100644 (file)
@@ -110,19 +110,6 @@ void arch_dump_register_req(FILE *F, const arch_register_req_t *req,
 void arch_dump_register_reqs(FILE *F, const ir_node *node);
 void arch_dump_reqs_and_registers(FILE *F, const ir_node *node);
 
-/**
- * Node classification. Used for statistics and for detecting reload nodes.
- */
-typedef enum arch_irn_class_t {
-       arch_irn_class_none   = 0,
-       arch_irn_class_spill  = 1 << 0,
-       arch_irn_class_reload = 1 << 1,
-       arch_irn_class_remat  = 1 << 2,
-       arch_irn_class_copy   = 1 << 3,
-       arch_irn_class_perm   = 1 << 4
-} arch_irn_class_t;
-ENUM_BITSET(arch_irn_class_t)
-
 void arch_set_frame_offset(ir_node *irn, int bias);
 
 ir_entity *arch_get_frame_entity(const ir_node *irn);
@@ -224,13 +211,6 @@ static inline unsigned arch_get_irn_n_outs(const ir_node *node)
        return (unsigned)ARR_LEN(info->out_infos);
 }
 
-/**
- * Classify a node.
- * @param irn The node.
- * @return A classification of the node.
- */
-arch_irn_class_t arch_irn_classify(const ir_node *irn);
-
 /**
  * Initialize the architecture environment struct.
  * @param isa           The isa which shall be put into the environment.
@@ -376,13 +356,6 @@ struct arch_inverse_t {
 
 struct arch_irn_ops_t {
 
-       /**
-        * Classify the node.
-        * @param irn The node.
-        * @return A classification.
-        */
-       arch_irn_class_t (*classify)(const ir_node *irn);
-
        /**
         * Get the entity on the stack frame this node depends on.
         * @param irn  The node in question.
index 732882b..9d1004c 100644 (file)
@@ -953,17 +953,6 @@ int be_get_IncSP_align(const ir_node *irn)
        return a->align;
 }
 
-static arch_irn_class_t be_node_classify(const ir_node *irn)
-{
-       switch (get_irn_opcode(irn)) {
-               case beo_Spill:  return arch_irn_class_spill;
-               case beo_Reload: return arch_irn_class_reload;
-               case beo_Perm:   return arch_irn_class_perm;
-               case beo_Copy:   return arch_irn_class_copy;
-               default:         return arch_irn_class_none;
-       }
-}
-
 static ir_entity *be_node_get_frame_entity(const ir_node *irn)
 {
        return be_get_frame_entity(irn);
@@ -1004,7 +993,6 @@ static int be_node_get_sp_bias(const ir_node *irn)
 
 /* for be nodes */
 static const arch_irn_ops_t be_node_irn_ops = {
-       be_node_classify,
        be_node_get_frame_entity,
        be_node_set_frame_offset,
        be_node_get_sp_bias,
@@ -1071,12 +1059,6 @@ int be_find_return_reg_input(ir_node *ret, const arch_register_t *reg)
        panic("Tried querying undefined register '%s' at Return", reg->name);
 }
 
-static arch_irn_class_t dummy_classify(const ir_node *node)
-{
-       (void) node;
-       return arch_irn_class_none;
-}
-
 static ir_entity* dummy_get_frame_entity(const ir_node *node)
 {
        (void) node;
@@ -1098,7 +1080,6 @@ static int dummy_get_sp_bias(const ir_node *node)
 
 /* for "middleend" nodes */
 static const arch_irn_ops_t dummy_be_irn_ops = {
-       dummy_classify,
        dummy_get_frame_entity,
        dummy_set_frame_offset,
        dummy_get_sp_bias,
@@ -1178,7 +1159,6 @@ void be_dump_phi_reg_reqs(FILE *F, ir_node *node, dump_reason_t reason)
 }
 
 static const arch_irn_ops_t phi_irn_ops = {
-       dummy_classify,
        dummy_get_frame_entity,
        dummy_set_frame_offset,
        dummy_get_sp_bias,
index abe28ea..bdc8d9d 100644 (file)
@@ -163,19 +163,10 @@ static void node_stat_walker(ir_node *irn, void *data)
                } else {
                        (*stats)[BE_STAT_PHIS]++;
                }
-       } else if (!is_Proj(irn)) {
-               arch_irn_class_t classify = arch_irn_classify(irn);
-
-               if (classify & arch_irn_class_spill)
-                       (*stats)[BE_STAT_SPILLS]++;
-               if (classify & arch_irn_class_reload)
-                       (*stats)[BE_STAT_RELOADS]++;
-               if (classify & arch_irn_class_remat)
-                       (*stats)[BE_STAT_REMATS]++;
-               if (classify & arch_irn_class_copy)
-                       (*stats)[BE_STAT_COPIES]++;
-               if (classify & arch_irn_class_perm)
-                       (*stats)[BE_STAT_PERMS]++;
+       } else if (be_is_Perm(irn)) {
+               (*stats)[BE_STAT_PERMS]++;
+       } else if (be_is_Copy(irn)) {
+               (*stats)[BE_STAT_COPIES]++;
        }
 }
 
@@ -205,9 +196,6 @@ static const char *get_stat_name(enum be_stat_tag_t tag)
        case BE_STAT_MEM_PHIS: return "mem_phis";
        case BE_STAT_COPIES:   return "copies";
        case BE_STAT_PERMS:    return "perms";
-       case BE_STAT_SPILLS:   return "spills";
-       case BE_STAT_RELOADS:  return "reloads";
-       case BE_STAT_REMATS:   return "remats";
        default:               panic("unknown stat tag found");
        }
 }
index 75c1f39..47f984b 100644 (file)
@@ -38,9 +38,6 @@ typedef enum be_stat_tag_t {
        BE_STAT_MEM_PHIS,             /**< memory-phi count */
        BE_STAT_COPIES,               /**< copies */
        BE_STAT_PERMS,                /**< perms */
-       BE_STAT_SPILLS,               /**< spills (also folded spills) */
-       BE_STAT_RELOADS,              /**< reloads (also folded reloads) */
-       BE_STAT_REMATS,               /**< rematerialized nodes */
        BE_STAT_COUNT
 } be_stat_tag_t;
 ENUM_COUNTABLE(be_stat_tag_t)
index f4fc292..1b0441d 100644 (file)
@@ -492,7 +492,7 @@ static void collect_spills_walker(ir_node *node, void *data)
 {
        be_verify_spillslots_env_t *env = (be_verify_spillslots_env_t*)data;
 
-       if (arch_irn_classify(node) & arch_irn_class_reload) {
+       if (be_is_Reload(node)) {
                ir_node *spill = get_memory_edge(node);
                ir_entity *ent;
 
@@ -555,7 +555,7 @@ static void check_lonely_spills(ir_node *node, void *data)
                }
 
                if (spill == NULL) {
-                       ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) not connected to a reaload\n",
+                       ir_fprintf(stderr, "Verify warning: Node %+F in block %+F(%s) not connected to a reload\n",
                                   node, get_nodes_block(node), get_irg_dump_name(env->irg));
                }
        }
index 11cd891..d6f1fc1 100644 (file)
@@ -191,24 +191,6 @@ static ir_node *ia32_get_admissible_noreg(ir_node *irn, int pos)
        }
 }
 
-static arch_irn_class_t ia32_classify(const ir_node *irn)
-{
-       arch_irn_class_t classification = arch_irn_class_none;
-
-       assert(is_ia32_irn(irn));
-
-       if (is_ia32_is_reload(irn))
-               classification |= arch_irn_class_reload;
-
-       if (is_ia32_is_spill(irn))
-               classification |= arch_irn_class_spill;
-
-       if (is_ia32_is_remat(irn))
-               classification |= arch_irn_class_remat;
-
-       return classification;
-}
-
 /**
  * The IA32 ABI callback object.
  */
@@ -633,7 +615,6 @@ static const be_abi_callbacks_t ia32_abi_callbacks = {
 
 /* register allocator interface */
 static const arch_irn_ops_t ia32_irn_ops = {
-       ia32_classify,
        ia32_get_frame_entity,
        ia32_set_frame_offset,
        ia32_get_sp_bias,
index 078fdfa..2801929 100644 (file)
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
-static arch_irn_class_t sparc_classify(const ir_node *node)
-{
-       (void) node;
-       return arch_irn_class_none;
-}
-
 static ir_entity *sparc_get_frame_entity(const ir_node *node)
 {
        if (is_sparc_FrameAddr(node)) {
@@ -128,7 +122,6 @@ static int sparc_get_sp_bias(const ir_node *node)
 /* fill register allocator interface */
 
 const arch_irn_ops_t sparc_irn_ops = {
-       sparc_classify,
        sparc_get_frame_entity,
        sparc_set_frame_offset,
        sparc_get_sp_bias,