Normalisierung der Zugriffsfunktionen,
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Thu, 11 Jul 2002 10:27:12 +0000 (10:27 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Thu, 11 Jul 2002 10:27:12 +0000 (10:27 +0000)
frame und global type sind nicht mehr in irp_types

[r439]

24 files changed:
ir/ana/cgana.c
ir/ir/ircgcons.c
ir/ir/ircgcons.h
ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irdump.c
ir/ir/irgopt.c
ir/ir/irgraph.c
ir/ir/irgraph.h
ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/irnode_t.h
ir/ir/irop.h
ir/ir/iropt.c
ir/ir/irprog.c
ir/ir/irprog.h
ir/ir/irprog_t.h
ir/ir/irvrfy.c
ir/ir/old_fctnames.h
ir/tr/entity.c
ir/tr/entity.h
ir/tr/type.c
ir/tr/type.h
ir/tr/typewalk.c

index baa7059..cc48252 100644 (file)
@@ -48,7 +48,7 @@ static entity * get_implementation(type * class, entity * method) {
       return e;
     }
   }
-  for (i = get_class_n_supertype(class) - 1; i >= 0; --i) {
+  for (i = get_class_n_supertypes(class) - 1; i >= 0; --i) {
     entity * e = get_implementation(get_class_supertype(class, i), method);
     if (e) {
       return e;
index af162c2..871156a 100644 (file)
@@ -252,7 +252,7 @@ static void prepare_irg_end(ir_graph * irg, irg_data_t * data) {
     }
   }
   if (n_ret > 0) {
-    int n_res = get_method_n_res(get_entity_type(get_irg_ent(irg)));
+    int n_res = get_method_n_ress(get_entity_type(get_irg_ent(irg)));
     ir_node ** in = NEW_ARR_F(ir_node *, n_ret);
     /* block */
     for (i = n_ret - 1; i >= 0; --i) {
index 4c2bd41..12137a3 100644 (file)
@@ -15,8 +15,8 @@
 #include "entity.h"
 
 
-/* Aufbau der interprozeduralen Darstellung. Das Analyseergebnis muss
- * in den Call-Operationen gespeichert sein. */
+/* Aufbau der interprozeduralen Darstellung.  In den Call-Operationen
+ * mussen alle potentialen callees gespeichert sein. */
 void cg_construct(int arr_len, entity ** free_methods_arr);
 
 
index 33c63c8..8c0ad84 100644 (file)
@@ -555,7 +555,6 @@ new_rd_Sel (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store, ir_node
   memcpy (&r_in[2], in, sizeof (ir_node *) * arity);
   res = new_ir_node (db, irg, block, op_Sel, mode_p, r_arity, r_in);
 
-  res->attr.s.ltyp = static_linkage;
   res->attr.s.ent = ent;
 
   res = optimize (res);
index 5d90e01..7633c84 100644 (file)
@@ -1346,7 +1346,10 @@ void switch_block (ir_node *target);   */
 ir_node *new_Block(int arity, ir_node **in);
 ir_node *new_Start  (void);
 ir_node *new_End    (void);
+ir_node *new_EndReg (void);
+ir_node *new_EndExcept(void);
 ir_node *new_Jmp    (void);
+ir_node *new_Break  (void);
 ir_node *new_Cond   (ir_node *c);
 ir_node *new_Return (ir_node *store, int arity, ir_node **in);
 ir_node *new_Raise  (ir_node *store, ir_node *obj);
@@ -1358,6 +1361,7 @@ ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity, ir_node **in,
 ir_node *new_InstOf (ir_node *store, ir_node *objptr, type *ent);
 ir_node *new_Call   (ir_node *store, ir_node *callee, int arity, ir_node **in,
                     type *type);
+ir_node *new_CallBegin(ir_node *callee);
 ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
 ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
 ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
@@ -1386,16 +1390,12 @@ ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
                     type *free_type);
 ir_node *new_Sync   (int arity, ir_node **in);
 ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
+ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
 ir_node *new_defaultProj (ir_node *arg, long max_proj);
 ir_node *new_Tuple  (int arity, ir_node **in);
 ir_node *new_Id     (ir_node *val, ir_mode *mode);
 ir_node *new_Bad    (void);
 ir_node *new_Unknown(void);
-ir_node *new_CallBegin(ir_node *callee);
-ir_node *new_EndReg (void);
-ir_node *new_EndExcept(void);
-ir_node *new_Break (void);
-ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
 
 /***********************************************************************/
 /* The comfortable interface.                                          */
index af3680d..802bd5b 100644 (file)
@@ -763,18 +763,18 @@ dump_type_info (type_or_ent *tore, void *env) {
       switch (get_type_tpop_code(tp)) {
       case tpo_class:
        {
-         for (i=0; i < get_class_n_supertype(tp); i++)
+         for (i=0; i < get_class_n_supertypes(tp); i++)
            xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                      TYPE_SUPER_EDGE_ATTR "}\n",
                      tp, get_class_supertype(tp, i));
-         for (i=0; i < get_class_n_member(tp); i++)
+         for (i=0; i < get_class_n_members(tp); i++)
            xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                      TYPE_MEMBER_EDGE_ATTR "}\n",
                      tp, get_class_member(tp, i));
        } break;
       case tpo_struct:
        {
-         for (i=0; i < get_struct_n_member(tp); i++)
+         for (i=0; i < get_struct_n_members(tp); i++)
            xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                      TYPE_MEMBER_EDGE_ATTR "}\n",
                      tp, get_struct_member(tp, i));
@@ -785,7 +785,7 @@ dump_type_info (type_or_ent *tore, void *env) {
            xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                      METH_PAR_EDGE_ATTR "}\n",
                      tp, get_method_param_type(tp, i), i);
-         for (i = 0; i < get_method_n_res(tp); i++)
+         for (i = 0; i < get_method_n_ress(tp); i++)
            xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                      METH_RES_EDGE_ATTR "}\n",
                      tp, get_method_res_type(tp, i), i);
index c987158..6b37758 100644 (file)
@@ -482,7 +482,7 @@ void inline_method(ir_node *call, ir_graph *called_graph) {
   /*** Replicate local entities of the called_graph ***/
   /* copy the entities. */
   called_frame = get_irg_frame_type(called_graph);
-  for (i = 0; i < get_class_n_member(called_frame); i++) {
+  for (i = 0; i < get_class_n_members(called_frame); i++) {
     entity *new_ent, *old_ent;
     old_ent = get_class_member(called_frame, i);
     new_ent = copy_entity_own(old_ent, get_cur_frame_type());
@@ -521,7 +521,7 @@ void inline_method(ir_node *call, ir_graph *called_graph) {
   end_bl = get_new_node(get_irg_end_block(called_graph));
   end = get_new_node(get_irg_end(called_graph));
   arity = get_irn_arity(end_bl);    /* arity = n_exc + n_ret  */
-  n_res = get_method_n_res(get_Call_type(call));
+  n_res = get_method_n_ress(get_Call_type(call));
 
   res_pred = (ir_node **) malloc (n_res * sizeof (ir_node *));
   cf_pred = (ir_node **) malloc (arity * sizeof (ir_node *));
index 687c80a..e1f6735 100644 (file)
@@ -16,7 +16,7 @@
 
 # include "ircons.h"
 # include "irgraph_t.h"
-# include "irprog.h"
+# include "irprog_t.h"
 # include "iropt_t.h"
 # include "array.h"
 # include "irgmod.h"
@@ -45,6 +45,7 @@ void free_Phi_in_stack(Phi_in_stack *s);
 ir_graph *
 new_ir_graph (entity *ent, int n_loc)
 {
+  int i;
   ir_graph *res;
   ir_node *first_block;
   ir_node *projX;
@@ -87,14 +88,16 @@ new_ir_graph (entity *ent, int n_loc)
   res->outs_state = no_outs;
   res->dom_state = no_dom;
 
-  /** Type inforamtion for the procedure of the graph **/
+  /** Type information for the procedure of the graph **/
   res->ent = ent;
   set_entity_irg(ent, res);
 
   /** A type that represents the stack frame.  A class type so that it can
       contain "inner" methods as in Pascal. **/
   res->frame_type = new_type_class(mangle(get_entity_ident(ent),
-       id_from_str(FRAME_TP_SUFFIX, strlen(FRAME_TP_SUFFIX))));
+         id_from_str(FRAME_TP_SUFFIX, strlen(FRAME_TP_SUFFIX))));
+  /* Remove type from type list.  Must be treated differently than other types. */
+  remove_irp_type_from_list(res->frame_type);
 
   /** Nodes needed in every graph **/
   res->end_block = new_immBlock ();
@@ -360,7 +363,7 @@ is_frame_type(type *ftp) {
 }
 
 int
-get_irg_n_loc (ir_graph *irg)
+get_irg_n_locs (ir_graph *irg)
 {
 #if PRECISE_EXC_CONTEXT
   return irg->n_loc - 1 - 1;
index 9d24aa9..79fb16a 100644 (file)
@@ -94,7 +94,15 @@ ir_graph *new_ir_graph (entity *ent, int n_loc);
    graph, nor the entity standing for this graph. */
 void free_ir_graph (ir_graph *irg);
 
-/* access routines for all ir_graph attributes */
+/** access routines for all ir_graph attributes **/
+entity  *get_irg_ent (ir_graph *irg);
+void     set_irg_ent (ir_graph *irg, entity *ent);
+
+type    *get_irg_frame_type (ir_graph *irg);
+void     set_irg_frame_type (ir_graph *irg, type *ftp);
+/* To test for a frame type */
+int      is_frame_type(type *ftp);
+
 ir_node *get_irg_start_block (ir_graph *irg);
 void     set_irg_start_block (ir_graph *irg, ir_node *node);
 
@@ -107,6 +115,7 @@ void     set_irg_end_block (ir_graph *irg, ir_node *node);
 ir_node *get_irg_end (ir_graph *irg);
 void     set_irg_end (ir_graph *irg, ir_node *node);
 
+/* @@@ oblivious, no more supported. */
 ir_node *get_irg_cstore (ir_graph *irg);
 void     set_irg_cstore (ir_graph *irg, ir_node *node);
 
@@ -119,6 +128,9 @@ void     set_irg_globals (ir_graph *irg, ir_node *node);
 ir_node *get_irg_args (ir_graph *irg);
 void     set_irg_args (ir_graph *irg, ir_node *node);
 
+ir_node *get_irg_current_block (ir_graph *irg);
+void     set_irg_current_block (ir_graph *irg, ir_node *node);
+
 /* Use new_Bad() instead!! */
 ir_node *get_irg_bad (ir_graph *irg);
 void     set_irg_bad (ir_graph *irg, ir_node *node);
@@ -127,29 +139,15 @@ void     set_irg_bad (ir_graph *irg, ir_node *node);
 ir_node *get_irg_unknown (ir_graph *irg);
 void     set_irg_unknown (ir_graph *irg, ir_node *node);
 
-ir_node *get_irg_current_block (ir_graph *irg);
-void     set_irg_current_block (ir_graph *irg, ir_node *node);
-
-entity  *get_irg_ent (ir_graph *irg);
-void     set_irg_ent (ir_graph *irg, entity *ent);
-
-type    *get_irg_frame_type (ir_graph *irg);
-void     set_irg_frame_type (ir_graph *irg, type *ftp);
-/* To test for a frame type */
-int      is_frame_type(type *ftp);
-
-/* Use not encouraged, internal of Phi construction algorithm. */
-int      get_irg_n_loc (ir_graph *irg);
-void     set_irg_n_loc (ir_graph *irg, int n_loc);
-
+int      get_irg_n_locs (ir_graph *irg);
 
 /********************************************************************************/
 /* States of an ir_graph.                                                       */
 /********************************************************************************/
 
-/* An ir_graph can have different states.  These states represent the analysis
+/** An ir_graph can have different states.  These states represent the analysis
    information associated with the graph.  Optimizations invalidate these
-   states.  */
+   states.  **/
 
 /* state: phase values: phase_building, phase_high, phase_low.
    The irg is in phase_building during construction of the irgraph.  It is in
@@ -167,7 +165,7 @@ irg_phase_state get_irg_phase_state (ir_graph *irg);
 void set_irg_phase_low(ir_graph *irg);
 
 /* state: pinned
-   The graph is "pinned" if all nodes are accosiated with a basic block.
+   The graph is "pinned" if all nodes are associated with a basic block.
    It is in state "floats" if nodes are in arbitrary blocks.  In state
    "floats" the block predecessor is set in all nodes, but this can be an
    invalid block, i.e., the block is not a dominator of all the uses of
index fff2831..b67c1f7 100644 (file)
@@ -378,12 +378,12 @@ irn_not_visited  (ir_node *node) {
 }
 
 INLINE void
-set_irn_link (ir_node *node, ir_node *link) {
+set_irn_link (ir_node *node, void *link) {
   assert (node);
   node->link = link;
 }
 
-INLINE ir_node *
+INLINE void *
 get_irn_link (ir_node *node) {
   assert (node);
   return node->link;
@@ -496,13 +496,6 @@ get_Block_n_cfgpreds (ir_node *node) {
   return (get_irn_arity(node));
 }
 
-/*
-INLINE void
-set_Block_n_cfgpreds (ir_node *node, int n_preds) {
-  assert ((node->op == op_Block));
-}
-*/
-
 INLINE ir_node *
 get_Block_cfgpred (ir_node *node, int pos) {
   assert (node->op == op_Block);
@@ -671,8 +664,20 @@ set_End_keepalive(ir_node *end, int pos, ir_node *ka) {
 
 INLINE void
 free_End (ir_node *end) {
+  assert (end->op == op_End);
   /* DEL_ARR_F(end->in);   GL @@@ tut nicht ! */
-  end->in = NULL;   /* @@@ make sure we get an error if we use the in array afterwards ... */
+  end->in = NULL;   /* @@@ make sure we get an error if we use the
+                      in array afterwards ... */
+}
+
+ir_graph *get_EndReg_irg (ir_node *end) {
+  assert (end->op == op_EndReg);
+  return end->attr.end.irg;
+}
+
+ir_graph *get_EndExcept_irg  (ir_node *end) {
+  assert (end->op == op_EndReg);
+  return end->attr.end.irg;
 }
 
 /*
@@ -743,7 +748,7 @@ set_Return_mem (ir_node *node, ir_node *mem) {
 }
 
 INLINE int
-get_Return_n_res (ir_node *node) {
+get_Return_n_ress (ir_node *node) {
   assert (node->op == op_Return);
   return (get_irn_arity(node) - RETURN_RESULT_OFFSET);
 }
@@ -752,7 +757,7 @@ INLINE ir_node **
 get_Return_res_arr (ir_node *node)
 {
   assert ((node->op == op_Return));
-  if (get_Return_n_res(node) > 0)
+  if (get_Return_n_ress(node) > 0)
     return (ir_node **)&(get_irn_in(node)[1 + RETURN_RESULT_OFFSET]);
   else
     return NULL;
@@ -768,7 +773,7 @@ set_Return_n_res (ir_node *node, int results) {
 INLINE ir_node *
 get_Return_res (ir_node *node, int pos) {
   assert (node->op == op_Return);
-  assert (get_Return_n_res(node) > pos);
+  assert (get_Return_n_ress(node) > pos);
   return get_irn_n(node, pos + RETURN_RESULT_OFFSET);
 }
 
@@ -892,7 +897,7 @@ set_Sel_ptr (ir_node *node, ir_node *ptr) {
 }
 
 INLINE int
-get_Sel_n_index (ir_node *node) {
+get_Sel_n_indexs (ir_node *node) {
   assert (node->op == op_Sel);
   return (get_irn_arity(node) - SEL_INDEX_OFFSET);
 }
@@ -901,19 +906,12 @@ INLINE ir_node **
 get_Sel_index_arr (ir_node *node)
 {
   assert ((node->op == op_Sel));
-  if (get_Sel_n_index(node) > 0)
+  if (get_Sel_n_indexs(node) > 0)
     return (ir_node **)& get_irn_in(node)[SEL_INDEX_OFFSET + 1];
   else
     return NULL;
 }
 
-/*
-INLINE void
-set_Sel_n_index (ir_node *node, int n_index) {
-  assert (node->op == op_Sel);
-}
-*/
-
 INLINE ir_node *
 get_Sel_index (ir_node *node, int pos) {
   assert (node->op == op_Sel);
@@ -938,18 +936,6 @@ set_Sel_entity (ir_node *node, entity *ent) {
   node->attr.s.ent = ent;
 }
 
-INLINE linkage_type
-get_Sel_linkage_type (ir_node *node) {
-  assert (node->op == op_Sel);
-  return node->attr.s.ltyp;
-}
-
-INLINE void
-set_Sel_linkage_type (ir_node *node, linkage_type lt) {
-  assert (node->op == op_Sel);
-  node->attr.s.ltyp = lt;
-}
-
 type *
 get_InstOf_ent (ir_node *node) {
   assert (node->op = op_InstOf);
@@ -1091,6 +1077,27 @@ void remove_Call_callee_arr(ir_node * node) {
   node->attr.call.callee_arr = NULL;
 }
 
+ir_node * get_CallBegin_ptr (ir_node *node) {
+  assert(node->op == op_CallBegin);
+  return get_irn_n(node, 0);
+}
+void set_CallBegin_ptr (ir_node *node, ir_node *ptr) {
+  assert(node->op == op_CallBegin);
+  set_irn_n(node, 0, ptr);
+}
+ir_graph * get_CallBegin_irg (ir_node *node) {
+  assert(node->op == op_CallBegin);
+  return node->attr.callbegin.irg;
+}
+ir_node * get_CallBegin_call (ir_node *node) {
+  assert(node->op == op_CallBegin);
+  return node->attr.callbegin.call;
+}
+void  set_CallBegin_call (ir_node *node, ir_node *call) {
+  assert(node->op == op_CallBegin);
+  node->attr.callbegin.call = call;
+}
+
 INLINE ir_node *
 get_Add_left (ir_node *node) {
   assert (node->op == op_Add);
@@ -2057,16 +2064,25 @@ set_Id_pred (ir_node *node, ir_node *pred) {
 
 
 INLINE ir_node *
-get_Filter_pred(ir_node *node) {
+get_Filter_pred (ir_node *node) {
   assert(node->op == op_Filter);
   return node->in[1];
 }
-
+INLINE void
+set_Filter_pred (ir_node *node, ir_node *pred) {
+  assert(node->op == op_Filter);
+  node->in[1] = pred;
+}
 INLINE long
 get_Filter_proj(ir_node *node) {
   assert(node->op == op_Filter);
   return node->attr.filter.proj;
 }
+INLINE void
+set_Filter_proj (ir_node *node, long proj) {
+  assert(node->op == op_Filter);
+  node->attr.filter.proj = proj;
+}
 
 void set_Filter_cg_pred_arr(ir_node * node, int arity, ir_node ** in) {
   assert(node->op == op_Filter);
index 52967ac..ec12f7a 100644 (file)
@@ -57,8 +57,6 @@ typedef struct ir_node ir_node;
 
 /* returns the number of predecessors without the block predecessor: */
 int                  get_irn_arity         (ir_node *node);
-/* returns the array with the ins: */
-INLINE ir_node     **get_irn_in            (ir_node *node);
 /* Replaces the old in array by a new one that will contain the ins given in
    the parameters.  Conserves the block predecessor.  It copies the array passed.
    This function is necessary to ajust in arrays of blocks, calls and phis.
@@ -95,13 +93,16 @@ INLINE void          set_irn_visited (ir_node *node, unsigned long visited);
 INLINE unsigned long get_irn_visited (ir_node *node);
 /* Sets visited to get_irg_visited(current_ir_graph) */
 INLINE void          mark_irn_visited (ir_node *node);
-/* Returns 1 of visited < get_irg_visited(current_ir_graph).  */
+/* Returns 1 if visited < get_irg_visited(current_ir_graph).  */
 INLINE int           irn_not_visited  (ir_node *node);
-INLINE void          set_irn_link          (ir_node *node, ir_node *link);
-INLINE ir_node      *get_irn_link          (ir_node *node);
+INLINE void          set_irn_link          (ir_node *node, void *link);
+INLINE void         *get_irn_link          (ir_node *node);
 /* Outputs a unique number for this node if libfirm is compiled for
-   debugging, else returns 0. */
+   debugging, (configure with --enable-debug) else returns 0. */
 INLINE long get_irn_node_nr(ir_node *node);
+/* Returns the ir_graph this node belongs to. Only valid for
+ * CallBegin, EndReg and EndExcept */
+INLINE ir_graph *get_irn_irg(ir_node *node);
 /*****/
 
 /* irnode constructor                                             */
@@ -142,9 +143,9 @@ typedef enum {
   pns_args              /* Projection on all arguments */
 } pns_number;
 
+/* @@@ no more supported  */
 INLINE ir_node **get_Block_cfgpred_arr (ir_node *node);
 int              get_Block_n_cfgpreds (ir_node *node);
-/* INLINE void    set_Block_n_cfgpreds (ir_node *node, int n_preds); */
 INLINE ir_node  *get_Block_cfgpred (ir_node *node, int pos);
 INLINE void      set_Block_cfgpred (ir_node *node, int pos, ir_node *pred);
 INLINE bool      get_Block_matured (ir_node *node);
@@ -154,17 +155,15 @@ INLINE void      set_Block_block_visited (ir_node *node, unsigned long visit);
 /* For this current_ir_graph must be set. */
 INLINE void      mark_Block_block_visited(ir_node *node);
 INLINE int       Block_not_block_visited(ir_node *node);
-INLINE ir_node  *get_Block_graph_arr (ir_node *node, int pos);
-INLINE void      set_Block_graph_arr (ir_node *node, int pos, ir_node *value);
 
-/* exc handling */
+/* exc handling @@@ ajacs specific -- not supported */
 void     set_Block_exc     (ir_node*, exc_t);
 exc_t    get_Block_exc     (ir_node*);
 
 void     set_Node_exc      (ir_node*, exc_t);
 exc_t    get_Node_exc      (ir_node*);
 
-/* handler handling */
+/* handler handling  @@@ ajacs specific -- not supported  */
 void     set_Block_handler (ir_node*, ir_node*);
 ir_node* get_Block_handler (ir_node*);
 
@@ -175,6 +174,7 @@ ir_node* get_Node_handler  (ir_node*);
  * both views. */
 void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in);
 void set_Block_cg_cfgpred(ir_node * node, int pos, ir_node * pred);
+/* @@@ not supported */
 ir_node ** get_Block_cg_cfgpred_arr(ir_node * node);
 int get_Block_cg_n_cfgpreds(ir_node * node);
 void remove_Block_cg_cfgpred_arr(ir_node * node);
@@ -188,6 +188,10 @@ INLINE void set_End_keepalive(ir_node *end, int pos, ir_node *ka);
    free_End frees these data structures. */
 INLINE void free_End (ir_node *end);
 
+ir_graph *get_EndReg_irg (ir_node *end);
+
+ir_graph *get_EndExcept_irg  (ir_node *end);
+
 /* We distinguish three kinds of Cond nodes.  These can be distinguished
    by the mode of the selector operand and an internal flag of type cond_kind.
    First we distinguish binary Conds and switch Conds.
@@ -222,8 +226,7 @@ INLINE void      set_Cond_kind (ir_node *node, cond_kind kind);
 INLINE ir_node  *get_Return_mem (ir_node *node);
 INLINE void      set_Return_mem (ir_node *node, ir_node *mem);
 INLINE ir_node **get_Return_res_arr (ir_node *node);
-INLINE int       get_Return_n_res (ir_node *node);
-/*INLINE void     set_Return_n_res (ir_node *node, int results); */
+INLINE int       get_Return_n_ress (ir_node *node);
 INLINE ir_node  *get_Return_res (ir_node *node, int pos);
 INLINE void      set_Return_res (ir_node *node, int pos, ir_node *res);
 
@@ -266,21 +269,13 @@ INLINE void     set_Sel_mem (ir_node *node, ir_node *mem);
 INLINE ir_node *get_Sel_ptr (ir_node *node);  /* ptr to the object to select from */
 INLINE void     set_Sel_ptr (ir_node *node, ir_node *ptr);
 INLINE ir_node **get_Sel_index_arr (ir_node *node);
-INLINE int      get_Sel_n_index (ir_node *node);
-/*INLINE void     set_Sel_n_index (ir_node *node, int n_index); */
+INLINE int      get_Sel_n_indexs (ir_node *node);
 INLINE ir_node *get_Sel_index (ir_node *node, int pos);
 INLINE void     set_Sel_index (ir_node *node, int pos, ir_node *index);
 INLINE entity  *get_Sel_entity (ir_node *node); /* entity to select */
 INLINE void     set_Sel_entity (ir_node *node, entity *ent);
-typedef enum {
-  static_linkage,       /* entity is used internal and not visible out of this
-                          file/class. */
-  external_linkage,     /* */
-  no_linkage
-} linkage_type;
-INLINE linkage_type get_Sel_linkage_type (ir_node *node);
-INLINE void     set_Sel_linkage_type (ir_node *node, linkage_type lt);
 
+/* @@@ ajacs specific node -- not supported */
 type           *get_InstOf_ent   (ir_node*);
 void            set_InstOf_ent   (ir_node*, type*);
 ir_node        *get_InstOf_obj   (ir_node*);
@@ -294,19 +289,22 @@ INLINE ir_node *get_Call_ptr (ir_node *node);
 INLINE void     set_Call_ptr (ir_node *node, ir_node *ptr);
 INLINE ir_node **get_Call_param_arr (ir_node *node);
 INLINE int      get_Call_n_params (ir_node *node);
-INLINE int      get_Call_arity (ir_node *node);
-/* INLINE void     set_Call_arity (ir_node *node, ir_node *arity); */
 INLINE ir_node *get_Call_param (ir_node *node, int pos);
 INLINE void     set_Call_param (ir_node *node, int pos, ir_node *param);
 INLINE type    *get_Call_type (ir_node *node);
 INLINE void     set_Call_type (ir_node *node, type *type);
-
 /* Set, get and remove the callee-analysis. */
 int get_Call_n_callees(ir_node * node);
 entity * get_Call_callee(ir_node * node, int pos);
 void set_Call_callee_arr(ir_node * node, int n, entity ** arr);
 void remove_Call_callee_arr(ir_node * node);
 
+ir_node * get_CallBegin_ptr (ir_node *node);
+void set_CallBegin_ptr (ir_node *node, ir_node *ptr);
+ir_graph *get_CallBegin_irg (ir_node *node);
+ir_node *get_CallBegin_call (ir_node *node);
+void set_CallBegin_call (ir_node *node, ir_node *call);
+
 /* For unary and binary arithmetic operations the access to the
    operands can be factored out.  Left is the first, right the
    second arithmetic value  as listed in tech report 1999-44.
@@ -441,10 +439,17 @@ INLINE void     set_Conv_op (ir_node *node, ir_node *op);
 
 INLINE ir_node **get_Phi_preds_arr (ir_node *node);
 INLINE int       get_Phi_n_preds (ir_node *node);
-/* INLINE void     set_Phi_n_preds (ir_node *node, int n_preds); */
 INLINE ir_node  *get_Phi_pred (ir_node *node, int pos);
 INLINE void      set_Phi_pred (ir_node *node, int pos, ir_node *pred);
 
+INLINE ir_node  *get_Filter_pred(ir_node *node);
+INLINE void      set_Filter_pred(ir_node *node, ir_node *pred);
+INLINE long      get_Filter_proj(ir_node *node);
+INLINE void      set_Filter_proj(ir_node *node, long proj);
+/* set the interprocedural predecessors */
+void             set_Filter_cg_pred_arr(ir_node * node, int arity, ir_node ** in);
+void             set_Filter_cg_pred(ir_node * node, int pos, ir_node * pred);
+
 INLINE ir_node *get_Load_mem (ir_node *node);
 INLINE void     set_Load_mem (ir_node *node, ir_node *mem);
 INLINE ir_node *get_Load_ptr (ir_node *node);
@@ -481,7 +486,6 @@ INLINE void     set_Free_type (ir_node *node, type *type);
 
 INLINE ir_node **get_Sync_preds_arr (ir_node *node);
 INLINE int       get_Sync_n_preds (ir_node *node);
-/* INLINE void     set_Sync_n_preds (ir_node *node, int n_preds); */
 INLINE ir_node  *get_Sync_pred (ir_node *node, int pos);
 INLINE void      set_Sync_pred (ir_node *node, int pos, ir_node *pred);
 
@@ -492,23 +496,12 @@ INLINE void      set_Proj_proj (ir_node *node, long proj);
 
 INLINE ir_node **get_Tuple_preds_arr (ir_node *node);
 INLINE int       get_Tuple_n_preds (ir_node *node);
-/* INLINE void     set_Tuple_n_preds (ir_node *node, int n_preds); */
 INLINE ir_node  *get_Tuple_pred (ir_node *node, int pos);
 INLINE void      set_Tuple_pred (ir_node *node, int pos, ir_node *pred);
 
 INLINE ir_node  *get_Id_pred (ir_node *node);
 INLINE void      set_Id_pred (ir_node *node, ir_node *pred);
 
-INLINE ir_node  *get_Filter_pred(ir_node *node);
-INLINE long      get_Filter_proj(ir_node *node);
-/* set the interprocedural predecessors */
-void             set_Filter_cg_pred_arr(ir_node * node, int arity, ir_node ** in);
-void             set_Filter_cg_pred(ir_node * node, int pos, ir_node * pred);
-
-/* Returns the ir_graph this node belongs to. Only valid for
- * CallBegin, EndReg and EndExcept */
-INLINE ir_graph *get_irn_irg(ir_node *node);
-
 /*****/
 
 /****s* irnode/other2
index 88b9b75..c0c67ff 100644 (file)
@@ -61,7 +61,6 @@ typedef struct {
 /* Sel attributes */
 typedef struct {
   entity *ent;          /* entity to select */
-  linkage_type ltyp;    /* linkage type of the entity */
 } sel_attr;
 
 typedef struct {
@@ -116,6 +115,7 @@ typedef union {
   symconst_attr  i;     /* For SymConst. */
   sel_attr       s;     /* For Sel. */
   call_attr      call;  /* For Call: pointer to the type of the method to call */
+  callbegin_attr callbegin; /* For CallBegin */
   alloc_attr     a;     /* For Alloc. */
   io_attr               io;    /* For InstOf */
   type          *f;     /* For Free. */
@@ -125,10 +125,9 @@ typedef union {
                               predecessors. If this attribute is set, the Phi
                               node takes the role of the obsolete Phi0 node,
                               therefore the name. */
-  long           proj;  /* For Proj: contains the result position to project */
+  long           proj;   /* For Proj: contains the result position to project */
   filter_attr    filter;    /* For Filter */
   end_attr       end;       /* For EndReg, EndExcept */
-  callbegin_attr callbegin; /* For CallBegin */
 #if PRECISE_EXC_CONTEXT
   struct ir_node **frag_arr; /* For Phi node construction in case of exceptions
                               for nodes Store, Load, Div, Mod, Quot, DivMod. */
@@ -146,7 +145,7 @@ struct ir_node {
   ir_mode *mode;           /* Mode of this node. */
   unsigned long visited;   /* visited counter for walks of the graph */
   struct ir_node **in;     /* array with predecessors / operands */
-  struct ir_node *link;    /* for linking nodes somehow to a list, e.g.
+  void *link;              /* to attach additional information to the node, e.g.
                               used while construction to link Phi0 nodes and
                              during optimization to link to nodes that
                              shall replace a node. */
@@ -172,6 +171,9 @@ copy_attrs (ir_node *old, ir_node *new);
 /* @@@@ brauchen wir dienoch? dann fliegt ev. das xprint raus?*/
 int ir_node_print (XP_PAR1, const xprintf_info *, XP_PARN);
 
+/* Returns the array with the ins.  The content of the array may not be
+   changed.  */
+ir_node     **get_irn_in            (ir_node *node);
 
 /** access attributes directly **/
 INLINE tarval       *get_irn_const_attr    (ir_node *node);
index a3d36fa..965828a 100644 (file)
@@ -93,15 +93,14 @@ extern ir_op *op_EndReg;
 extern ir_op *op_EndExcept;
 
 
+/* Returns the ident for the opcode name */
+ident *get_op_ident     (ir_op *op);
 /* Returns the string for the opcode. */
-const char *get_op_name      (ir_op *op);
+const char *get_op_name (ir_op *op);
 
 /* Returns the enum for the opcode */
 opcode get_op_code      (ir_op *op);
 
-/* Returns the ident for the opcode name */
-ident *get_op_ident     (ir_op *op);
-
 typedef enum {
   floats = 0,    /* Nodes of this opcode can be placed in any basic block. */
   pinned           /* Nodes must remain in this basic block. */
@@ -112,12 +111,11 @@ op_pinned get_op_pinned (ir_op *op);
    for Block, Phi and control flow nodes. */
 void      set_op_pinned(ir_op *op, op_pinned pinned);
 
-/* Returns the attribute size of nodes of this opcode.
-   Use not encouraged, internal feature. */
-int    get_op_attr_size (ir_op *op);
-
 /* Returns true if op is one of Start, End, Jmp, Cond, Return, Raise or Bad. */
 int is_cfopcode(ir_op *op);
 
+/* Returns the attribute size of nodes of this opcode.
+   @@@ Use not encouraged, internal feature. */
+int    get_op_attr_size (ir_op *op);
 
 # endif /* _IROP_H_ */
index 43e6d35..e3b9d84 100644 (file)
@@ -823,14 +823,6 @@ vt_cmp (const void *elt, const void *key)
       (get_irn_mode(a) != get_irn_mode(b))) return 1;
 
   /* compare if a's in and b's in are equal */
-  /* GL: we optimize only nodes with in arrays of fixed sizes.
-  if (get_irn_arity (a) != -2) {
-    ins = get_irn_arity (a);
-    if (ins != get_irn_arity (b)) return 1;
-    ain = get_irn_in (a);
-    bin = get_irn_in (b);
-  }
-  */
   if (get_irn_arity (a) != get_irn_arity(b))
     return 1;
 
@@ -867,8 +859,7 @@ vt_cmp (const void *elt, const void *key)
       || (get_irn_sel_attr(a).ent->name != get_irn_sel_attr(b).ent->name)
       || (get_irn_sel_attr(a).ent->owner != get_irn_sel_attr(b).ent->owner)
       || (get_irn_sel_attr(a).ent->ld_name != get_irn_sel_attr(b).ent->ld_name)
-      || (get_irn_sel_attr(a).ent->type != get_irn_sel_attr(b).ent->type)
-      || (get_irn_sel_attr(a).ltyp != get_irn_sel_attr(b).ltyp);
+      || (get_irn_sel_attr(a).ent->type != get_irn_sel_attr(b).ent->type);
   case iro_Phi:
     return get_irn_phi_attr (a) != get_irn_phi_attr (b);
   default: ;
index 0f96982..be5ca48 100644 (file)
@@ -42,8 +42,10 @@ ir_prog *new_ir_prog (void) {
   res->types  = NEW_ARR_F (type *, 1);
   res->glob_type = new_type_class(id_from_str (GLOBAL_TYPE_NAME,
                                               strlen(GLOBAL_TYPE_NAME)));
-  /* @@@ Das ist hier das 2. mal!!  */
-  add_irp_type(res->glob_type);
+  /* Remove type from type list.  Must be treated differently than other types. */
+  remove_irp_type_from_list(res->glob_type);
+  /* @@@ Das ist hier das 2. mal!!
+     add_irp_type(res->glob_type);  */
 
   res->const_code_irg = new_const_code_irg();
 
@@ -80,8 +82,7 @@ void add_irp_irg(ir_graph *irg) {
   ARR_APP1 (ir_graph *, irp->graphs, irg);
 }
 
-/* Removes irg from the list or irgs, shrinks the list by one.
-   @@@ does not work properly. */
+/* Removes irg from the list or irgs, shrinks the list by one. */
 void remove_irp_irg(ir_graph *irg){
   int i;
   assert(irg);
@@ -123,6 +124,25 @@ void add_irp_type(type *typ) {
   ARR_APP1 (type *, irp->types, typ);
 }
 
+INLINE void remove_irp_type_from_list (type *typ) {
+  int i;
+  assert(typ);
+  for (i = 1; i < (ARR_LEN (irp->types)); i++) {
+    if (irp->types[i] == typ) {
+      for(; i < (ARR_LEN (irp->types)) - 1; i++) {
+       irp->types[i] = irp->types[i+1];
+      }
+      ARR_SETLEN(type*, irp->types, (ARR_LEN(irp->types)) - 1);
+      break;
+    }
+  }
+}
+
+void remove_irp_type(type *typ) {
+  remove_irp_type_from_list (typ);
+  free_type(typ);
+}
+
 int get_irp_n_types (void) {
   assert (irp && irp->types);
   /* Strangely the first element of the array is NULL.  Why??  */
index af1cb9f..6e2c249 100644 (file)
@@ -78,6 +78,9 @@ void      set_irp_irg(int pos, ir_graph *irg);
 
 /* Adds type to the list of types in irp. */
 void  add_irp_type(type *typ);
+/* Removes type from the list of types, deallocates it and
+   shrinks the list by one. */
+void  remove_irp_type(type *typ);
 int   get_irp_n_types();
 type *get_irp_type(int pos);
 void  set_irp_type(int pos, type *typ);
@@ -96,7 +99,9 @@ type *get_glob_type(void);
  *   ir_graph *get_const_code_irg();
  * NOTE
  *   Do not use any access function for this graph, do not generate code
- *   for this graph.
+ *   for this graph.  This graph contains only one block.  The constant
+ *   expressions may not contain control flow.  See also copy_const_code
+ *   in entity.h.
  */
 ir_graph *get_const_code_irg();
 
index 1a86d56..ca2f661 100644 (file)
@@ -27,6 +27,8 @@ struct ir_prog {
 #endif
 };
 
+void remove_irp_type_from_list (type *typ);
+
 #ifdef DEBUG_libfirm
 /* Returns a new, unique number to number nodes or the like. */
 int get_irp_new_node_nr();
index 7251867..a3f420f 100644 (file)
@@ -16,6 +16,9 @@
 # include "irvrfy.h"
 # include "irgwalk.h"
 
+/* @@@ replace use of array "in" by access functions. */
+ir_node **get_irn_in (ir_node *node);
+
 INLINE static void
 vrfy_Proj_proj(ir_node *p) {
   ir_node *pred;
@@ -115,7 +118,7 @@ vrfy_Proj_proj(ir_node *p) {
       assert (proj >= 0 && mode_is_data(mode) &&
              "wrong Proj from Proj from Call");
       mt = get_Call_type(pred);
-      assert(proj < get_method_n_res(mt) &&
+      assert(proj < get_method_n_ress(mt) &&
             "More Projs for results than results in type.");
       assert(mode == get_type_mode(get_method_res_type(mt, proj)) &&
       "Mode of Proj from Call doesn't match mode of result type.");
@@ -177,6 +180,12 @@ irn_vrfy (ir_node *n)
            mymode == mode_X && "Jmp node"
           );
     break;
+  case iro_Break:
+    assert (
+           /* Jmp: BB --> X */
+           mymode == mode_X && "Jmp node"
+          );
+    break;
   case iro_Cond:
     op1mode = get_irn_mode(in[1]);
     assert (
@@ -198,9 +207,9 @@ irn_vrfy (ir_node *n)
     assert ( mymode == mode_X );   /* result X */
     /* Compare returned results with result types of method type */
     mt = get_entity_type(get_irg_ent(current_ir_graph));
-    assert(get_Return_n_res(n) == get_method_n_res(mt) &&
+    assert(get_Return_n_ress(n) == get_method_n_ress(mt) &&
             "Number of results for Return doesn't match number of results in type.");
-    for (i = 0; i < get_Return_n_res(n); i++)
+    for (i = 0; i < get_Return_n_ress(n); i++)
       assert((get_irn_mode(get_Return_res(n, i))
              == get_type_mode(get_method_res_type(mt, i))) &&
             "Mode of result for Return doesn't match mode of result type.");
@@ -423,7 +432,7 @@ irn_vrfy (ir_node *n)
     /* Phi: BB x dataM^n --> dataM */
     /* for some reason "<=" aborts. Is there a problem with get_store? */
     for (i=1; i < get_irn_arity(n); i++) {
-      if (!is_Bad(in[i]))
+      if (!is_Bad(in[i]) && (get_irn_op(in[i]) != op_Unknown))
        assert ( get_irn_mode(in[i]) == mymode  && "Phi node");
     };
     assert ( mode_is_dataM(mymode)  && "Phi node");
index ebc714f..9dfde31 100644 (file)
 #define __OLD_FCTNAMES_H__
 
 /* irgraph */
-#define get_irg_params     get_irg_n_loc
+#define get_irg_params     get_irg_n_locs
+#define get_irg_n_loc      get_irg_n_locs
 #define set_irg_params     set_irg_n_loc
 
+/* irnode.h */
+#define get_Return_n_res   get_Return_n_ress
+#define get_Sel_n_index    get_Sel_n_indexs
 
 /* irmode.h */
 #define get_ident_of_mode     get_mode_ident
@@ -30,5 +34,9 @@
 /* type.h */
 #define get_type_nameid(_t_)     get_type_ident(_t_)
 #define set_type_nameid(_t_,_i_) set_type_ident(_t_,_i_)
+#define get_class_n_member    get_class_n_members
+#define get_class_n_subtype   get_class_n_subtypes
+#define get_class_n_supertype get_class_n_supertypes
+#define get_struct_n_member   get_struct_n_members
 
 #endif
index c4bbdf1..8b79c9f 100644 (file)
@@ -256,11 +256,13 @@ set_entity_variability (entity *ent, ent_variability var){
 
 INLINE ent_volatility
 get_entity_volatility (entity *ent) {
+  assert (ent);
   return ent->volatility;
 }
 
 INLINE void
 set_entity_volatility (entity *ent, ent_volatility vol) {
+  assert (ent);
   ent->volatility = vol;
 }
 
@@ -273,6 +275,7 @@ get_entity_peculiarity (entity *ent) {
 INLINE void
 set_entity_peculiarity (entity *ent, peculiarity pec) {
   assert (ent);
+  /* @@@ why peculiarity only for methods? */
   assert (is_method_type(ent->type));
   ent->peculiarity = pec;
 }
@@ -311,13 +314,6 @@ ir_node *copy_const_value(ir_node *n) {
   return nn;
 }
 
-/* Copies the value represented by the entity to current_block
-   in current_ir_graph. */
-ir_node *copy_atomic_ent_value(entity *ent) {
-  assert(ent && is_atomic_entity(ent) && (ent->variability != uninitialized));
-  return copy_const_value(ent->value);
-}
-
 /* A value of a compound entity is a pair of value and the corresponding member of
    the compound. */
 INLINE void
@@ -329,7 +325,7 @@ add_compound_ent_value(entity *ent, ir_node *val, entity *member) {
 
 /* Copies the firm subgraph referenced by val to const_code_irg and adds
    the node as constant initialization to ent.
-   The subgraph may not contain control flow operations. */
+   The subgraph may not contain control flow operations.
 INLINE void
 copy_and_add_compound_ent_value(entity *ent, ir_node *val, entity *member) {
   ir_graph *rem = current_ir_graph;
@@ -340,7 +336,7 @@ copy_and_add_compound_ent_value(entity *ent, ir_node *val, entity *member) {
   val = copy_const_value(val);
   add_compound_ent_value(ent, val, member);
   current_ir_graph = rem;
-}
+  }*/
 
 INLINE int
 get_compound_ent_n_values(entity *ent) {
@@ -354,12 +350,12 @@ get_compound_ent_value(entity *ent, int pos) {
   return ent->values[pos+1];
 }
 
-/* Copies the value i of the entity to current_block in current_ir_graph. */
+/* Copies the value i of the entity to current_block in current_ir_graph.
 ir_node *
 copy_compound_ent_value(entity *ent, int pos) {
   assert(ent && is_compound_entity(ent) && (ent->variability != uninitialized));
   return copy_const_value(ent->values[pos+1]);
-}
+  }*/
 
 INLINE entity   *
 get_compound_ent_value_member(entity *ent, int pos) {
index 4f91854..df94376 100644 (file)
@@ -137,6 +137,7 @@ entity     *copy_entity_name (entity *old, ident *new_name);
 /** manipulate fields of entity **/
 const char *get_entity_name     (entity *ent);
 ident      *get_entity_ident    (entity *ent);
+
 /* returns the mangled name of the entity.  If the mangled name is
    set it returns the existing name.  Else it generates a name
    with mangle_entity() and remembers this new name internally. */
@@ -144,11 +145,6 @@ ident      *get_entity_ld_ident (entity *ent);
 void        set_entity_ld_ident (entity *ent, ident *ld_ident);
 const char *get_entity_ld_name (entity *end);
 
-/*
-char       *get_entity_ld_name  (entity *ent);
-void        set_entity_ld_name  (entity *ent, char *ld_name);
-*/
-
 type       *get_entity_owner (entity *ent);
 /* Sets the owner field in entity to owner. */
 void        set_entity_owner (entity *ent, type *owner);
@@ -208,10 +204,29 @@ typedef enum {
 ent_volatility get_entity_volatility (entity *ent);
 void           set_entity_volatility (entity *ent, ent_volatility vol);
 
+/* Only set if layout = fixed. */
+int       get_entity_offset (entity *ent);
+void      set_entity_offset (entity *ent, int offset);
+
+/* A link to store intermediate information */
+void*   get_entity_link(entity *ent);
+void    set_entity_link(entity *ent, void *l);
+
+/** Fields of method entities **/
+/* The entity knows the corresponding irg if the entity is a method.
+   This allows to get from a Call to the called irg.
+   Only entities of peculiarity "existent" can have a corresponding irg,
+   else the field is fixed to NULL.  (Get returns NULL, set asserts.) */
+ir_graph *get_entity_irg(entity *ent);
+void      set_entity_irg(entity *ent, ir_graph *irg);
+
 /* For the definition of enumeration peculiarity see type.h */
 peculiarity get_entity_peculiarity (entity *ent);
 void        set_entity_peculiarity (entity *ent, peculiarity pec);
 
+/** Representation of constant values of entites **/
+/* Set current_ir_graph to get_const_code_irg() to generate a constant
+   expression. */
 /* Copies a firm subgraph that complies to the restrictions for
    constant expressions to current_block in current_ir_graph. */
 ir_node *copy_const_value(ir_node *n);
@@ -219,15 +234,10 @@ ir_node *copy_const_value(ir_node *n);
 /* Set has no effect for entities of type method. */
 ir_node *get_atomic_ent_value(entity *ent);
 void     set_atomic_ent_value(entity *ent, ir_node *val);
-/* Copies the value represented by the entity to current_block
-   in current_ir_graph. @@@ oblivious, use copy_const_vallue */
-ir_node *copy_atomic_ent_value(entity *ent);
 
-/* A value of a compound entity is a pair of value and the corresponding
+/* A value of a compound entity is a pair of value and the corresponding
    member of the compound. */
 void     add_compound_ent_value(entity *ent, ir_node *val, entity *member);
-/* oblivious, use copy_const_value @@@ */
-void     copy_and_add_compound_ent_value(entity *ent, ir_node *val, entity *member);
 int      get_compound_ent_n_values(entity *ent);
 ir_node *get_compound_ent_value(entity *ent, int pos);
 entity  *get_compound_ent_value_member(entity *ent, int pos);
@@ -239,13 +249,8 @@ void     set_compound_ent_value(entity *ent, ir_node *val, entity *member, int p
    fits into the given array size.  Does not test whether the
    values have the proper mode for the array. */
 void set_array_entity_values(entity *ent, tarval **values, int num_vals);
-/* Copies the value pos of the entity to current_block in current_ir_graph. */
-ir_node *copy_compound_ent_value(entity *ent, int pos);
-
-/* Only set if layout = fixed. */
-int       get_entity_offset (entity *ent);
-void      set_entity_offset (entity *ent, int offset);
 
+/** Fields of entities with a class type as owner **/
 /* Overwrites is a field that specifies that an access to the overwritten
    entity in the supertype must use this entity.  It's a list as with
    multiple inheritance several enitites can be overwritten.  This field
@@ -259,23 +264,12 @@ void    add_entity_overwrites   (entity *ent, entity *overwritten);
 int     get_entity_n_overwrites (entity *ent);
 entity *get_entity_overwrites   (entity *ent, int pos);
 void    set_entity_overwrites   (entity *ent, int pos, entity *overwritten);
+
 void    add_entity_overwrittenby   (entity *ent, entity *overwrites);
 int     get_entity_n_overwrittenby (entity *ent);
 entity *get_entity_overwrittenby   (entity *ent, int pos);
 void    set_entity_overwrittenby   (entity *ent, int pos, entity *overwrites);
 
-/* A link to store intermediate information */
-void*   get_entity_link(entity *ent);
-void    set_entity_link(entity *ent, void *l);
-
-/* The entity knows the corresponding irg if the entity is a method.
-   This allows to get from a Call to the called irg.
-   Only entities of peculiarity "existent" can have a corresponding irg,
-   else the field is fixed to NULL.  (Get returns NULL, set asserts.) */
-ir_graph *get_entity_irg(entity *ent);
-void      set_entity_irg(entity *ent, ir_graph *irg);
-
-
 /* Returns true if the type of the entity is a primitive, pointer
    enumeration or method type. */
 int is_atomic_entity(entity *ent);
index 0892353..2dcdfbf 100644 (file)
 
 unsigned long type_visited;
 
+void        free_type(type *tp) {
+  /* @@@ not implemented */
+}
+
 INLINE type *
 new_type(tp_op *type_op, ir_mode *mode, ident* name) {
   type *res;
@@ -190,7 +194,7 @@ set_type_state(type *tp, type_state state) {
       {
        assert(get_type_size(tp) > -1);
        if (tp != get_glob_type())
-         for (i = 0; i < get_class_n_member(tp); i++) {
+         for (i = 0; i < get_class_n_members(tp); i++) {
            assert(get_entity_offset(get_class_member(tp, i)) > -1);
            assert(is_method_type(get_entity_type(get_class_member(tp, i))) ||
                   (get_entity_allocation(get_class_member(tp, i)) == automatic_allocated));
@@ -200,7 +204,7 @@ set_type_state(type *tp, type_state state) {
     case tpo_struct:
       {
        /* assert(get_type_size(tp) > -1);    @@@ lowerfirm geht nicht durch */
-       for (i = 0; i < get_struct_n_member(tp); i++) {
+       for (i = 0; i < get_struct_n_members(tp); i++) {
          assert(get_entity_offset(get_struct_member(tp, i)) > -1);
          assert((get_entity_allocation(get_struct_member(tp, i)) == automatic_allocated));
        }
@@ -273,23 +277,24 @@ INLINE void free_class_attrs(type *clss) {
   DEL_ARR_F(clss->attr.ca.subtypes);
   DEL_ARR_F(clss->attr.ca.supertypes);
 }
+
 /* manipulate private fields of class type  */
 void    add_class_member   (type *clss, entity *member) {
   assert(clss && (clss->type_op == type_class));
   ARR_APP1 (entity *, clss->attr.ca.members, member);
 }
-int     get_class_n_member (type *clss) {
+int     get_class_n_members (type *clss) {
   assert(clss && (clss->type_op == type_class));
   return (ARR_LEN (clss->attr.ca.members))-1;
 }
 entity *get_class_member   (type *clss, int pos) {
   assert(clss && (clss->type_op == type_class));
-  assert(pos >= 0 && pos < get_class_n_member(clss));
+  assert(pos >= 0 && pos < get_class_n_members(clss));
   return clss->attr.ca.members[pos+1];
 }
 void    set_class_member   (type *clss, entity *member, int pos) {
   assert(clss && (clss->type_op == type_class));
-  assert(pos >= 0 && pos < get_class_n_member(clss));
+  assert(pos >= 0 && pos < get_class_n_members(clss));
   clss->attr.ca.members[pos+1] = member;
 }
 void    set_class_members  (type *clss, entity **members, int arity) {
@@ -318,24 +323,24 @@ void    add_class_subtype   (type *clss, type *subtype) {
   int i;
   assert(clss && (clss->type_op == type_class));
   ARR_APP1 (type *, clss->attr.ca.subtypes, subtype);
-  for (i = 0; i < get_class_n_supertype(subtype); i++)
+  for (i = 0; i < get_class_n_supertypes(subtype); i++)
     if (get_class_supertype(subtype, i) == clss)
       /* Class already registered */
       return;
   ARR_APP1 (type *, subtype->attr.ca.supertypes, clss);
 }
-int     get_class_n_subtype (type *clss) {
+int     get_class_n_subtypes (type *clss) {
   assert(clss && (clss->type_op == type_class));
   return (ARR_LEN (clss->attr.ca.subtypes))-1;
 }
 type   *get_class_subtype   (type *clss, int pos) {
   assert(clss && (clss->type_op == type_class));
-  assert(pos >= 0 && pos < get_class_n_subtype(clss));
+  assert(pos >= 0 && pos < get_class_n_subtypes(clss));
   return clss->attr.ca.subtypes[pos+1] = skip_tid(clss->attr.ca.subtypes[pos+1]);
 }
 void    set_class_subtype   (type *clss, type *subtype, int pos) {
   assert(clss && (clss->type_op == type_class));
-  assert(pos >= 0 && pos < get_class_n_subtype(clss));
+  assert(pos >= 0 && pos < get_class_n_subtypes(clss));
   clss->attr.ca.subtypes[pos+1] = subtype;
 }
 void    remove_class_subtype(type *clss, type *subtype) {
@@ -355,24 +360,24 @@ void    add_class_supertype   (type *clss, type *supertype) {
   assert(clss && (clss->type_op == type_class));
   assert(supertype && (supertype -> type_op == type_class));
   ARR_APP1 (type *, clss->attr.ca.supertypes, supertype);
-  for (i = 0; i < get_class_n_subtype(supertype); i++)
+  for (i = 0; i < get_class_n_subtypes(supertype); i++)
     if (get_class_subtype(supertype, i) == clss)
       /* Class already registered */
       return;
   ARR_APP1 (type *, supertype->attr.ca.subtypes, clss);
 }
-int     get_class_n_supertype (type *clss) {
+int     get_class_n_supertypes (type *clss) {
   assert(clss && (clss->type_op == type_class));
   return (ARR_LEN (clss->attr.ca.supertypes))-1;
 }
 type   *get_class_supertype   (type *clss, int pos) {
   assert(clss && (clss->type_op == type_class));
-  assert(pos >= 0 && pos < get_class_n_supertype(clss));
+  assert(pos >= 0 && pos < get_class_n_supertypes(clss));
   return clss->attr.ca.supertypes[pos+1] = skip_tid(clss->attr.ca.supertypes[pos+1]);
 }
 void    set_class_supertype   (type *clss, type *supertype, int pos) {
   assert(clss && (clss->type_op == type_class));
-  assert(pos >= 0 && pos < get_class_n_supertype(clss));
+  assert(pos >= 0 && pos < get_class_n_supertypes(clss));
   clss->attr.ca.supertypes[pos+1] = supertype;
 }
 void    remove_class_supertype(type *clss, type *supertype) {
@@ -393,6 +398,7 @@ INLINE peculiarity get_class_peculiarity (type *clss) {
 }
 INLINE void        set_class_peculiarity (type *clss, peculiarity pec) {
   assert(clss && (clss->type_op == type_class));
+  assert(pec != inherited);  /* There is no inheritance of types in libFirm. */
   clss->attr.ca.peculiarity = pec;
 }
 
@@ -427,25 +433,26 @@ INLINE void free_struct_attrs (type *strct) {
   assert(strct && (strct->type_op == type_struct));
   DEL_ARR_F(strct->attr.sa.members);
 }
+
 /* manipulate private fields of struct */
+int     get_struct_n_members (type *strct) {
+  assert(strct && (strct->type_op == type_struct));
+  return (ARR_LEN (strct->attr.sa.members))-1;
+}
 void    add_struct_member   (type *strct, entity *member) {
   assert(strct && (strct->type_op == type_struct));
   assert(get_type_tpop(get_entity_type(member)) != type_method);
     /*    @@@ lowerfirm geht nicht durch */
   ARR_APP1 (entity *, strct->attr.sa.members, member);
 }
-int     get_struct_n_member (type *strct) {
-  assert(strct && (strct->type_op == type_struct));
-  return (ARR_LEN (strct->attr.sa.members))-1;
-}
 entity *get_struct_member   (type *strct, int pos) {
   assert(strct && (strct->type_op == type_struct));
-  assert(pos >= 0 && pos < get_struct_n_member(strct));
+  assert(pos >= 0 && pos < get_struct_n_members(strct));
   return strct->attr.sa.members[pos+1];
 }
 void    set_struct_member   (type *strct, int pos, entity *member) {
   assert(strct && (strct->type_op == type_struct));
-  assert(pos >= 0 && pos < get_struct_n_member(strct));
+  assert(pos >= 0 && pos < get_struct_n_members(strct));
   assert(get_entity_type(member)->type_op != type_method);/* @@@ lowerfirm !!*/
   strct->attr.sa.members[pos+1] = member;
 }
@@ -460,6 +467,7 @@ void    remove_struct_member(type *strct, entity *member) {
       break;
     }
 }
+
 /* typecheck */
 bool    is_struct_type(type *strct) {
   assert(strct);
@@ -504,18 +512,18 @@ void  set_method_param_type(type *method, int pos, type* type) {
   method->attr.ma.param_type[pos] = type;
 }
 
-int   get_method_n_res   (type *method) {
+int   get_method_n_ress   (type *method) {
   assert(method && (method->type_op == type_method));
   return method->attr.ma.n_res;
 }
 type *get_method_res_type(type *method, int pos) {
   assert(method && (method->type_op == type_method));
-  assert(pos >= 0 && pos < get_method_n_res(method));
+  assert(pos >= 0 && pos < get_method_n_ress(method));
   return method->attr.ma.res_type[pos] = skip_tid(method->attr.ma.res_type[pos]);
 }
 void  set_method_res_type(type *method, int pos, type* type) {
   assert(method && (method->type_op == type_method));
-  assert(pos >= 0 && pos < get_method_n_res(method));
+  assert(pos >= 0 && pos < get_method_n_ress(method));
   method->attr.ma.res_type[pos] = type;
 }
 
@@ -618,11 +626,10 @@ bool   is_union_type         (type *uni) {
 
 /* create a new type array -- set dimension sizes independently */
 type *new_type_array         (ident *name, int n_dimensions,
-                                                         type *element_type) {
+                             type *element_type) {
   type *res;
   int i;
-  assert((element_type->type_op != type_method));
-  assert(get_type_tpop(element_type) != type_method);
+  assert(!is_method_type(element_type));
   res = new_type(type_array, NULL, name);
   res->attr.aa.n_dimensions = n_dimensions;
   res->attr.aa.lower_bound  = (ir_node **) xmalloc (sizeof (ir_node *) * n_dimensions);
@@ -650,42 +657,48 @@ int   get_array_n_dimensions (type *array) {
   assert(array && (array->type_op == type_array));
   return array->attr.aa.n_dimensions;
 }
-void  set_array_bounds_int (type *array, int dimension, int lower_bound,
-                           int upper_bound) {
-  ir_graph *rem;
-  assert(array && (array->type_op == type_array));
-  rem = current_ir_graph;
-  current_ir_graph = get_const_code_irg();
-  array->attr.aa.lower_bound[dimension] =
-    new_Const(mode_I, tarval_from_long (mode_I, lower_bound));
-  array->attr.aa.upper_bound[dimension] =
-    new_Const(mode_I, tarval_from_long (mode_I, upper_bound));
-  current_ir_graph = rem;
-}
 
-void  set_array_bounds (type *array, int dimension, ir_node * lower_bound,
-                       ir_node * upper_bound) {
+INLINE void
+set_array_bounds (type *array, int dimension, ir_node * lower_bound,
+                 ir_node * upper_bound) {
   assert(array && (array->type_op == type_array));
   array->attr.aa.lower_bound[dimension] = lower_bound;
   array->attr.aa.upper_bound[dimension] = upper_bound;
 }
-void  set_array_lower_bound_int (type *array, int dimension, int lower_bound) {
-  ir_graph *rem;
-  assert(array && (array->type_op == type_array));
-  rem = current_ir_graph;
+void
+set_array_bounds_int (type *array, int dimension, int lower_bound,
+                     int upper_bound) {
+  ir_graph *rem = current_ir_graph;
   current_ir_graph = get_const_code_irg();
-  array->attr.aa.lower_bound[dimension] =
-    new_Const(mode_I, tarval_from_long (mode_I, lower_bound));
+  set_array_bounds (array, dimension,
+                   new_Const(mode_I, tarval_from_long (mode_I, lower_bound)),
+                   new_Const(mode_I, tarval_from_long (mode_I, upper_bound)));
   current_ir_graph = rem;
 }
-void  set_array_lower_bound  (type *array, int dimension, ir_node * lower_bound) {
+INLINE void
+set_array_lower_bound  (type *array, int dimension, ir_node * lower_bound) {
   assert(array && (array->type_op == type_array));
   array->attr.aa.lower_bound[dimension] = lower_bound;
 }
-void  set_array_upper_bound  (type *array, int dimension, ir_node * upper_bound) {
+void  set_array_lower_bound_int (type *array, int dimension, int lower_bound) {
+  ir_graph *rem = current_ir_graph;
+  current_ir_graph = get_const_code_irg();
+  set_array_lower_bound  (array, dimension,
+                         new_Const(mode_I, tarval_from_long (mode_I, lower_bound)));
+  current_ir_graph = rem;
+}
+INLINE void
+set_array_upper_bound  (type *array, int dimension, ir_node * upper_bound) {
   assert(array && (array->type_op == type_array));
   array->attr.aa.upper_bound[dimension] = upper_bound;
 }
+void  set_array_upper_bound_int (type *array, int dimension, int upper_bound) {
+  ir_graph *rem = current_ir_graph;
+  current_ir_graph = get_const_code_irg();
+  set_array_upper_bound  (array, dimension,
+                         new_Const(mode_I, tarval_from_long (mode_I, upper_bound)));
+  current_ir_graph = rem;
+}
 ir_node * get_array_lower_bound  (type *array, int dimension) {
   assert(array && (array->type_op == type_array));
   return array->attr.aa.lower_bound[dimension];
@@ -694,6 +707,7 @@ ir_node * get_array_upper_bound  (type *array, int dimension) {
   assert(array && (array->type_op == type_array));
   return array->attr.aa.upper_bound[dimension];
 }
+
 void set_array_order (type *array, int dimension, int order) {
   assert(array && (array->type_op == type_array));
   array->attr.aa.order[dimension] = order;
@@ -702,14 +716,17 @@ int  get_array_order (type *array, int dimension) {
   assert(array && (array->type_op == type_array));
   return array->attr.aa.order[dimension];
 }
+
 void  set_array_element_type (type *array, type *type) {
   assert(array && (array->type_op == type_array));
+  assert(!is_method_type(type));
   array->attr.aa.element_type = type;
 }
 type *get_array_element_type (type *array) {
   assert(array && (array->type_op == type_array));
   return array->attr.aa.element_type = skip_tid(array->attr.aa.element_type);
 }
+
 void  set_array_element_entity (type *array, entity *ent) {
   assert(array && (array->type_op == type_array));
   assert((get_entity_type(ent)->type_op != type_method));
index a82877c..217c293 100644 (file)
@@ -108,49 +108,54 @@ typedef struct type type;
 
 # include "type_or_entity.h"
 
-void*       get_type_link(type *tp);
-void        set_type_link(type *tp, void *l);
+/* Frees the memory used by the type.   Does not free the entities
+   belonging to the type, except for the array element entity.  */
+void        free_type(type *tp);
+
 tp_op*      get_type_tpop(type *tp);
 ident*      get_type_tpop_nameid(type *tp);
 const char* get_type_tpop_name(type *tp);
 tp_opcode   get_type_tpop_code(type *tp);
 
-/* Returns NULL for all non atomic types. */
-ir_mode*    get_type_mode(type *tp);
-/* Only has an effect on primitive and enumeration types */
-void        set_type_mode(type *tp, ir_mode* m);
-
 ident*      get_type_ident(type *tp);
 void        set_type_ident(type *tp, ident* id);
 const char* get_type_name(type *tp);
 
-int         get_type_size(type *tp);
-/* For primitives, enumerations, pointer and method types the size
-   is always fixed. This call is legal but has no effect. */
-void        set_type_size(type *tp, int size);
-
 typedef enum {
   layout_undefined,    /* The layout of this type is not defined.
                          Address computation to access fields is not
-                         possible, fields must be accessed by Sel nodes.
-                         This is the default value except for pointer and
-                         primitive types. */
+                         possible, fields must be accessed by Sel
+                         nodes.  This is the default value except for
+                         pointer, primitive and method types. */
   layout_fixed         /* The layout is fixed, all component/member entities
                          have an offset assigned.  Size of the type is known.
                          Arrays can be accessed by explicit address
-                         computation. Default for pointer and primitive types.
-                      */
+                         computation. Default for pointer, primitive ane method
+                         types.  */
 } type_state;
-
 type_state  get_type_state(type *tp);
 /* For primitives, pointer and method types the layout is always fixed.
    This call is legal but has no effect. */
 void        set_type_state(type *tp, type_state state);
 
+/* Returns NULL for all non atomic types. */
+ir_mode*    get_type_mode(type *tp);
+/* Only has an effect on primitive and enumeration types */
+void        set_type_mode(type *tp, ir_mode* m);
+
+int         get_type_size(type *tp);
+/* For primitive, enumeration, pointer and method types the size
+   is always fixed. This call is legal but has no effect. */
+void        set_type_size(type *tp, int size);
+
+
 unsigned long get_type_visited(type *tp);
 void        set_type_visited(type *tp, unsigned long num);
 /* Sets visited field in type to type_visited. */
 void        mark_type_visited(type *tp);
+
+void*       get_type_link(type *tp);
+void        set_type_link(type *tp, void *l);
 /*****/
 
 /****v* type/visited
@@ -224,7 +229,7 @@ type   *new_type_class (ident *name);
 /* Adds the entity as member of the class.  */
 void    add_class_member   (type *clss, entity *member);
 /* Returns the number of members of this class. */
-int     get_class_n_member (type *clss);
+int     get_class_n_members (type *clss);
 /* Returns the member at position pos, 0 <= pos < n_member */
 entity *get_class_member   (type *clss, int pos);
 /* Overwrites the member at position pos, 0 <= pos < n_member with
@@ -245,7 +250,7 @@ void    remove_class_member(type *clss, entity *member);
    adds also clss as supertype to subtype.  */
 void    add_class_subtype   (type *clss, type *subtype);
 /* Returns the number of subtypes */
-int     get_class_n_subtype (type *clss);
+int     get_class_n_subtypes (type *clss);
 /* Gets the subtype at position pos, 0 <= pos < n_subtype. */
 type   *get_class_subtype   (type *clss, int pos);
 /* Sets the subtype at positioin pos, 0 <= pos < n_subtype.  Does not
@@ -262,7 +267,7 @@ void    remove_class_subtype(type *clss, type *subtype);
    adds also clss as subtype to supertype.  */
 void    add_class_supertype   (type *clss, type *supertype);
 /* Returns the number of supertypes */
-int     get_class_n_supertype (type *clss);
+int     get_class_n_supertypes (type *clss);
 /* Gets the supertype at position pos,  0 <= pos < n_supertype. */
 type   *get_class_supertype   (type *clss, int pos);
 /* Sets the supertype at postition pos, 0 <= pos < n_subtype.  Does not
@@ -290,7 +295,8 @@ typedef enum peculiarity {
 INLINE peculiarity get_class_peculiarity (type *clss);
 INLINE void        set_class_peculiarity (type *clss, peculiarity pec);
 
-/* Set and get a class' dfn */
+/* Set and get a class' dfn --
+   @@@ This is an undocumented field, subject to change! */
 void set_class_dfn (type*, int);
 int  get_class_dfn (type*);
 
@@ -320,7 +326,7 @@ type   *new_type_struct (ident *name);
 
 /* manipulate private fields of struct */
 void    add_struct_member   (type *strct, entity *member);
-int     get_struct_n_member (type *strct);
+int     get_struct_n_members (type *strct);
 entity *get_struct_member   (type *strct, int pos);
 void    set_struct_member   (type *strct, int pos, entity *member);
 /* Finds member in the list of memberss and overwrites it with NULL
@@ -370,7 +376,10 @@ int   get_method_n_params  (type *method);
 type *get_method_param_type(type *method, int pos);
 void  set_method_param_type(type *method, int pos, type* type);
 
-int   get_method_n_res   (type *method);
+/* @@@ fuer emitter.h von cggg */
+#define get_method_n_res(X) get_method_n_ress(X)
+
+int   get_method_n_ress   (type *method);
 type *get_method_res_type(type *method, int pos);
 void  set_method_res_type(type *method, int pos, type* type);
 
@@ -439,10 +448,10 @@ void   set_union_delim_nameid (type *uni, int pos, ident *id);
 /* create a new type array --
    Sets n_dimension to dimension and all dimension entries to NULL.
    Initializes order to the order of the dimensions.
-   Entity for array elements is built automatically.
+   The entity for array elements is built automatically.
    Set dimension sizes after call to constructor with set_* routines. */
 type *new_type_array         (ident *name, int n_dimensions,
-                                                         type *element_type);
+                             type *element_type);
 
 /* manipulate private fields of array type */
 int   get_array_n_dimensions (type *array);
@@ -454,6 +463,7 @@ void  set_array_bounds       (type *array, int dimension, ir_node *lower_bound,
 void  set_array_lower_bound  (type *array, int dimension, ir_node *lower_bound);
 void  set_array_lower_bound_int (type *array, int dimension, int lower_bound);
 void  set_array_upper_bound  (type *array, int dimension, ir_node *upper_bound);
+void  set_array_upper_bound_int (type *array, int dimension, int lower_bound);
 ir_node * get_array_lower_bound  (type *array, int dimension);
 ir_node * get_array_upper_bound  (type *array, int dimension);
 
index f1b3bcb..a5ce1a5 100644 (file)
@@ -80,17 +80,17 @@ void type_walk_2(type_or_ent *tore,
       switch (get_type_tpop_code(tp)) {
       case tpo_class:
        {
-         for (i=0; i<get_class_n_supertype(tp); i++)
+         for (i=0; i<get_class_n_supertypes(tp); i++)
            type_walk_2((type_or_ent *)get_class_supertype(tp, i), pre, post, env);
-         for (i=0; i<get_class_n_member(tp); i++)
+         for (i=0; i<get_class_n_members(tp); i++)
            type_walk_2((type_or_ent *)get_class_member(tp, i), pre, post, env);
-         for (i=0; i<get_class_n_subtype(tp); i++)
+         for (i=0; i<get_class_n_subtypes(tp); i++)
            type_walk_2((type_or_ent *)get_class_subtype(tp, i), pre, post, env);
        }
        break;
       case tpo_struct:
        {
-         for (i=0; i<get_struct_n_member(tp); i++)
+         for (i=0; i<get_struct_n_members(tp); i++)
            type_walk_2((type_or_ent *)get_struct_member(tp, i), pre, post, env);
        }
        break;
@@ -98,7 +98,7 @@ void type_walk_2(type_or_ent *tore,
        {
          for (i = 0; i < get_method_n_params(tp); i++)
            type_walk_2((type_or_ent *)get_method_param_type(tp, i), pre, post, env);
-         for (i = 0; i < get_method_n_res(tp); i++)
+         for (i = 0; i < get_method_n_ress(tp); i++)
            type_walk_2((type_or_ent *)get_method_res_type(tp, i), pre, post, env);
        }
        break;
@@ -238,7 +238,7 @@ void type_walk_s2s_2(type_or_ent *tore,
       switch (get_type_tpop_code(tp)) {
       case tpo_class:
        {
-         for (i = 0; i < get_class_n_supertype(tp); i++) {
+         for (i = 0; i < get_class_n_supertypes(tp); i++) {
            type_walk_s2s_2((type_or_ent *)get_class_supertype(tp, i), pre,
                            post, env);
          }
@@ -247,7 +247,7 @@ void type_walk_s2s_2(type_or_ent *tore,
            pre(tore, env);
          tp = skip_tid((type*)tore);
 
-         for (i = 0; i < get_class_n_subtype(tp); i++) {
+         for (i = 0; i < get_class_n_subtypes(tp); i++) {
            type_walk_s2s_2((type_or_ent *)get_class_subtype(tp, i), pre,
                            post, env);
          }
@@ -335,7 +335,7 @@ void type_walk_super_2(type_or_ent *tore,
            pre(tore, env);
          tp = skip_tid((type*)tore);
 
-         for (i = 0; i < get_class_n_supertype(tp); i++) {
+         for (i = 0; i < get_class_n_supertypes(tp); i++) {
            type_walk_super_2((type_or_ent *)get_class_supertype(tp, i), pre,
                              post, env);
          }
@@ -398,7 +398,7 @@ void class_walk_s2s_2(type *tp,
 
   assert(is_class_type(tp));
   /* Assure all supertypes are visited before */
-  for (i=0; i < get_class_n_supertype(tp); i++) {
+  for (i=0; i < get_class_n_supertypes(tp); i++) {
     if (get_type_visited(get_class_supertype(tp, i)) < type_visited)
       return;
   }
@@ -410,7 +410,7 @@ void class_walk_s2s_2(type *tp,
     pre(tp, env);
 
   tp = skip_tid((type*)tp);
-  for (i=0; i<get_class_n_subtype(tp); i++) {
+  for (i=0; i<get_class_n_subtypes(tp); i++) {
     class_walk_s2s_2(get_class_subtype(tp, i), pre, post, env);
   }
   /* execute post method */
@@ -420,7 +420,7 @@ void class_walk_s2s_2(type *tp,
   return;
 }
 
-
+#if 0
 void class_walk_super2sub(void (pre)(type*, void*),
                          void (post)(type*, void*),
                          void *env) {
@@ -431,7 +431,7 @@ void class_walk_super2sub(void (pre)(type*, void*),
   for (i = 0; i < get_irp_n_types(); i++) {
     tp = get_irp_type(i);
     if (is_class_type(tp) &&
-       (get_class_n_supertype(tp) == 0) &&
+       (get_class_n_supertypes(tp) == 0) &&
        (tp->visit < type_visited) &&
        (!is_frame_type(tp)) &&
        (tp != get_glob_type())) {
@@ -439,3 +439,22 @@ void class_walk_super2sub(void (pre)(type*, void*),
     }
   }
 }
+#endif
+void class_walk_super2sub(void (pre)(type*, void*),
+                         void (post)(type*, void*),
+                         void *env) {
+  int i;
+  type *tp;
+
+  ++type_visited;
+  for (i = 0; i < get_irp_n_types(); i++) {
+    tp = get_irp_type(i);
+    if (is_class_type(tp) &&
+       (get_class_n_supertypes(tp) == 0) &&
+       (tp->visit < type_visited))  {
+      assert(!is_frame_type(tp));
+      assert(tp != get_glob_type());
+      class_walk_s2s_2(tp, pre, post, env);
+    }
+  }
+}