renamed all types 'type' to 'ir_type'
[libfirm] / ir / opt / scalar_replace.c
index e820945..8ffa6da 100644 (file)
@@ -64,7 +64,7 @@ typedef struct _path_t {
 
 typedef struct _scalars_t {
   entity *ent;                 /**< A entity for scalar replacement. */
-  type *ent_owner;             /**< The owner of this entity. */
+  ir_type *ent_owner;          /**< The owner of this entity. */
 } scalars_t;
 
 
@@ -126,21 +126,18 @@ static int is_const_sel(ir_node *sel) {
   return 1;
 }
 
-/**
+/*
  * Returns non-zero, if the address of an entity
  * represented by a Sel node (or it's successor Sels) is taken.
- *
- * @param sel  the Sel node
  */
-static int is_address_taken(ir_node *sel)
+int is_address_taken(ir_node *sel)
 {
-  int i, n;
+  int i;
 
   if (! is_const_sel(sel))
     return 1;
 
-  n = get_irn_n_outs(sel);
-  for (i = 0; i < n; ++i) {
+  for (i = get_irn_n_outs(sel) - 1; i >= 0; --i) {
     ir_node *succ = get_irn_out(sel, i);
 
     switch (get_irn_opcode(succ)) {
@@ -271,7 +268,7 @@ static int find_possible_replacements(ir_graph *irg)
 
     if (get_irn_op(succ) == op_Sel) {
       entity *ent = get_Sel_entity(succ);
-      type *ent_type;
+      ir_type *ent_type;
 
       if (get_entity_link(ent) == ADDRESS_TAKEN)
         continue;
@@ -677,7 +674,7 @@ void scalar_replacement_opt(ir_graph *irg)
   ir_mode   **modes;
   set       *set_ent;
   pset      *sels;
-  type      *ent_type;
+  ir_type   *ent_type;
   ir_graph  *rem;
 
   if (! get_opt_scalar_replacement())