normalized various stuff
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 14 Jul 2004 15:11:27 +0000 (15:11 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 14 Jul 2004 15:11:27 +0000 (15:11 +0000)
commented

[r3455]

20 files changed:
ir/ir/Makefile.in
ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irdump.c
ir/ir/irgopt.c
ir/ir/irgraph.h
ir/ir/irmode.h
ir/ir/irnode.h
ir/ir/irprog.h
ir/ir/irprog_t.h
ir/ir/irvrfy.c
ir/ir/old_fctnames.h [deleted file]
ir/opt/tailrec.c
ir/tr/entity.h
ir/tr/mangle.h
ir/tr/type.h
ir/tr/typegmod.h
ir/tv/tv.c
ir/tv/tv.h
ir/tv/tv_t.h

index cfd7ff3..f059d02 100644 (file)
@@ -17,7 +17,7 @@ subdir := ir/ir
 
 INSTALL_HEADERS = irprog.h irgraph.h irnode.h irmode.h irop.h ircons.h \
                irflag.h irvrfy.h irgwalk.h irgmod.h iropt.h irdump.h   \
-               irgopt.h old_fctnames.h ircgcons.h ircgopt.h
+               irgopt.h ircgcons.h ircgopt.h
 
 SOURCES = $(INSTALL_HEADERS)
 
index 398cfe2..adf1739 100644 (file)
@@ -1117,9 +1117,11 @@ new_d_Block (dbg_info* db, int arity, ir_node **in)
   res = new_rd_Block(db, current_ir_graph, arity, in);
 
   /* Create and initialize array for Phi-node construction. */
-  res->attr.block.graph_arr = NEW_ARR_D(ir_node *, current_ir_graph->obst,
-                                        current_ir_graph->n_loc);
-  memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
+  if (get_irg_phase_state(current_ir_graph) == phase_building) {
+    res->attr.block.graph_arr = NEW_ARR_D(ir_node *, current_ir_graph->obst,
+                                         current_ir_graph->n_loc);
+    memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
+  }
 
   for (i = arity-1; i >= 0; i--)
     if (get_irn_op(in[i]) == op_Unknown) {
index 26bb4f1..00d4868 100644 (file)
@@ -1310,9 +1310,8 @@ ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, ir_node *block,
  * @param value   A type, entity or a ident depending on the SymConst kind.
  * @param tp      The source type of the constant.
  */
-ir_node *
-new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, union symconst_symbol value,
-                     symconst_kind symkind, type *tp);
+ir_node *new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, union symconst_symbol value,
+                              symconst_kind symkind, type *tp);
 
 /** Constructor for a SymConst node.
  *
@@ -1369,7 +1368,7 @@ ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, type *symbol, type *
  * @param   *ent       The entity to select.
  */
 ir_node *new_rd_Sel    (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
-                       ir_node *objptr, int n_index, ir_node *index[], entity *ent);
+                       ir_node *objptr, int n_index, ir_node *index[], entity *ent);
 
 /** Constructor for a InstOf node.
  *
@@ -1382,7 +1381,8 @@ ir_node *new_rd_Sel    (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *st
  * @param   *objptr
  * @param   *ent
  */
-ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store, ir_node *objptr, type *ent);
+ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
+                       ir_node *objptr, type *ent);
 
 /** Constructor for a Call node.
  *
@@ -1415,8 +1415,8 @@ ir_node *new_rd_Call   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *st
  * @param *tp     Type information of the procedure called.
  */
 ir_node *new_rd_FuncCall (dbg_info *db, ir_graph *irg, ir_node *block,
-               ir_node *callee, int arity, ir_node *in[],
-               type *tp);
+                         ir_node *callee, int arity, ir_node *in[],
+                         type *tp);
 
 /** Constructor for a Add node.
  *
@@ -1428,7 +1428,7 @@ ir_node *new_rd_FuncCall (dbg_info *db, ir_graph *irg, ir_node *block,
  * @param   *mode  The mode of the operands and the result.
  */
 ir_node *new_rd_Add    (dbg_info *db, ir_graph *irg, ir_node *block,
-               ir_node *op1, ir_node *op2, ir_mode *mode);
+                       ir_node *op1, ir_node *op2, ir_mode *mode);
 
 /** Constructor for a Sub node.
  *
@@ -1440,7 +1440,7 @@ ir_node *new_rd_Add    (dbg_info *db, ir_graph *irg, ir_node *block,
  * @param   *mode  The mode of the operands and the result.
  */
 ir_node *new_rd_Sub    (dbg_info *db, ir_graph *irg, ir_node *block,
-               ir_node *op1, ir_node *op2, ir_mode *mode);
+                       ir_node *op1, ir_node *op2, ir_mode *mode);
 
 /** Constructor for a Minus node.
  *
@@ -1451,7 +1451,7 @@ ir_node *new_rd_Sub    (dbg_info *db, ir_graph *irg, ir_node *block,
  * @param   *mode  The mode of the operand and the result.
  */
 ir_node *new_rd_Minus  (dbg_info *db, ir_graph *irg, ir_node *block,
-               ir_node *op,  ir_mode *mode);
+                       ir_node *op,  ir_mode *mode);
 
 /** Constructor for a Mul node.
  *
@@ -2328,9 +2328,9 @@ ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
  * @param *adr   A pointer to the variable to be read in this memory.
  * @param *val   The value to write to this variable.
  */
-
 ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
-               ir_node *store, ir_node *adr, ir_node *val);
+                      ir_node *store, ir_node *adr, ir_node *val);
+
 /** Constructor for a Alloc node.
  *
  * The Alloc node extends the memory by space for an entity of type alloc_type.
@@ -2343,7 +2343,6 @@ ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
  *
  */
-
 ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
                ir_node *size, type *alloc_type, where_alloc where);
 
@@ -2563,12 +2562,20 @@ ir_node *new_r_FuncCall (ir_graph *irg, ir_node *block,
 /*-----------------------------------------------------------------------*/
 
 /** Sets the current block in which the following constructors place the
-  nodes they construct. */
-void switch_block (ir_node *target);
+ *  nodes they construct.
+ *
+ *  @param target  The new current block.
+ */
+void     switch_block (ir_node *target);
+
+/** Returns the current block of the current graph. */
+ir_node *get_cur_block(void);
 
 /** Constructor for a Block node.
  *
- * Adds the block to the graph in current_ir_graph.
+ * Adds the block to the graph in current_ir_graph. Constructs a Block
+ * with a fixed number of predecessors.  Does set current_block.  Can
+ * be used with automatic Phi node construction.
  *
  * @param *db    A Pointer for  debugginfomation.
  * @param arity  The number of control predecessors.
@@ -2662,7 +2669,8 @@ ir_node *new_d_Raise  (dbg_info* db, ir_node *store, ir_node *obj);
  *
  * @param *db    A pointer for debug information.
  * @param *mode  The mode of the operands and redults.
- * @param *con   Points to an entry in the constant table. This pointer is added to the attributes of  the node (self->attr.con).
+ * @param *con   Points to an entry in the constant table. This pointer is
+                 added to the attributes of the node.
  * @param *tp    The type of the constante.
  *
  */
@@ -2679,7 +2687,8 @@ ir_node *new_d_Const_type (dbg_info* db, ir_mode *mode, tarval *con, type *tp);
  *
  * @param *db    A pointer for debug information.
  * @param *mode  The mode of the operands and redults.
- * @param *con   Points to an entry in the constant table. This pointer is added to the attributes of  the node (self->attr.con).
+ * @param *con   Points to an entry in the constant table. This pointer is added
+ *               to the attributes of the node.
  *
  */
 ir_node *new_d_Const  (dbg_info* db, ir_mode *mode, tarval *con);
@@ -2722,11 +2731,15 @@ ir_node *new_d_SymConst (dbg_info* db, union symconst_symbol value, symconst_kin
 
 /** Constructor for a simpleSel node.
  *
- * Adds the node to the block in current_ir_block.
+ *  This is a shortcut for the new_d_Sel() constructor.  To be used for
+ *  Sel nodes that do not select from an array, i.e., have no index
+ *  inputs.  It adds the two parameters 0, NULL.
  *
  * @param   *db        A pointer for debug information.
- * @param   *store     The memory in which the object the entity should be selected from is allocated.
- * @param   *objptr    The object from that the Sel operation selects a single attribute out.
+ * @param   *store     The memory in which the object the entity should be
+ *                     selected from is allocated.
+ * @param   *objptr    The object from that the Sel operation selects a
+ *                     single attribute out.
  * @param   *ent       The entity to select.
  *
  */
@@ -2739,6 +2752,7 @@ ir_node *new_d_simpleSel(dbg_info* db, ir_node *store, ir_node *objptr, entity *
  * Dynamically the node may select entities that overwrite the given
  * entity.  If the selected entity is an array element entity the Sel
  * node takes the required array indicees as inputs.
+ * Adds the node to the block in current_ir_block.
  *
  * @param   *db        A pointer for debug information.
  * @param   *store     The memory in which the object the entity should be selected
@@ -3056,7 +3070,7 @@ ir_node *new_d_Load   (dbg_info* db, ir_node *store, ir_node *addr);
  */
 ir_node *new_d_Store  (dbg_info* db, ir_node *store, ir_node *addr, ir_node *val);
 
-/**Constructor for a Alloc node.
+/** Constructor for a Alloc node.
  *
  * The Alloc node extends the memory by space for an entity of type alloc_type.
  * Adds the node to the block in current_ir_block.
@@ -3071,7 +3085,7 @@ ir_node *new_d_Store  (dbg_info* db, ir_node *store, ir_node *addr, ir_node *val
 ir_node *new_d_Alloc  (dbg_info* db, ir_node *store, ir_node *size, type *alloc_type,
                      where_alloc where);
 
-/**Constructor for a Free node.
+ /** Constructor for a Free node.
  *
  * Frees the memory occupied by the entity pointed to by the pointer
  * arg.  Type indicates the type of the entity the argument points to.
@@ -3087,7 +3101,7 @@ ir_node *new_d_Alloc  (dbg_info* db, ir_node *store, ir_node *size, type *alloc_
 ir_node *new_d_Free   (dbg_info* db, ir_node *store, ir_node *ptr, ir_node *size,
              type *free_type);
 
-/**Constructor for a  Sync node.
+/** Constructor for a Sync node.
  *
  * Merges several memory values.  The node assumes that a variable
  * either occurs only in one of the memories, or it contains the same
@@ -3103,7 +3117,7 @@ ir_node *new_d_Free   (dbg_info* db, ir_node *store, ir_node *ptr, ir_node *size
 ir_node *new_d_Sync   (dbg_info* db, int arity, ir_node *in[]);
 
 
-/**Constructor for a Proj node.
+/** Constructor for a Proj node.
  *
  * Projects a single value out of a tuple.  The parameter proj gives the
  * position of the value within the tuple.
@@ -3118,7 +3132,7 @@ ir_node *new_d_Sync   (dbg_info* db, int arity, ir_node *in[]);
 ir_node *new_d_Proj   (dbg_info* db, ir_node *arg, ir_mode *mode, long proj);
 
 
-/**Constructor for a defaultProj node.
+/** Constructor for a defaultProj node.
  *
  * Represents the default control flow of a Switch-Cond node.
  * Adds the node to the block in current_ir_block.
@@ -3130,7 +3144,7 @@ ir_node *new_d_Proj   (dbg_info* db, ir_node *arg, ir_mode *mode, long proj);
  */
 ir_node *new_d_defaultProj (dbg_info* db, ir_node *arg, long max_proj);
 
-/**Constructor for a Tuple node.
+/** Constructor for a Tuple node.
  *
  * This is an auxiliary node to replace a node that returns a tuple
  * without changing the corresponding Proj nodes.
@@ -3144,7 +3158,7 @@ ir_node *new_d_defaultProj (dbg_info* db, ir_node *arg, long max_proj);
 ir_node *new_d_Tuple  (dbg_info* db, int arity, ir_node *in[]);
 
 
-/**Constructor for a Id node.
+/** Constructor for a Id node.
  *
  * This is an auxiliary node to replace a node that returns a single
  * value. Adds the node to the block in current_ir_block.
@@ -3156,7 +3170,7 @@ ir_node *new_d_Tuple  (dbg_info* db, int arity, ir_node *in[]);
  */
 ir_node *new_d_Id     (dbg_info* db, ir_node *val, ir_mode *mode);
 
-/**Costructor for a Bad node.
+/** Costructor for a Bad node.
  *
  * Returns the unique Bad node of the graph.  The same as
  * get_irg_bad().
@@ -3181,7 +3195,7 @@ ir_node *new_d_Bad    (void);
 ir_node *new_d_Confirm (dbg_info* db, ir_node *val, ir_node *bound, pn_Cmp cmp);
 
 
-/** Constructor for a Unknown node.
+/** Constructor for an Unknown node.
  *
  * Represents an arbtrary valus.  Places the node in
  * the start block.
@@ -3204,7 +3218,7 @@ ir_node *new_d_Unknown(ir_mode *m);
  */
 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
 
-/** Constructor for a EndReg node.
+/** Constructor for an EndReg node.
  *
  *Adds the node to the block in current_ir_block.
  *
@@ -3213,7 +3227,7 @@ ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
  */
 ir_node *new_d_EndReg (dbg_info *db);
 
-/**Constructor for a Endexcept node.
+/** Constructor for an Endexcept node.
  *
  * Used to represent regular procedure end in interprocedual view.
  * Adds the node to the block in current_ir_block.
@@ -3223,7 +3237,7 @@ ir_node *new_d_EndReg (dbg_info *db);
  */
 ir_node *new_d_EndExcept(dbg_info *db);
 
-/**Constructor for a Breake node.
+/** Constructor for a Break node.
  *
  * Used to represent exceptional procedure end in interprocedural view.
  * Adds the node to the block in current_ir_block.
@@ -3282,14 +3296,12 @@ ir_node *new_d_FuncCall (dbg_info* db, ir_node *callee, int arity, ir_node *in[]
 /* Needed from the interfase with debug support:
 void switch_block (ir_node *target);   */
 
-/* Constructs a Block with a fixed number of predecessors.
-   Does set current_block.  Can be used with automatic Phi
-  node construction. */
-
 /** Constructor for a Block node.
  *
  * Constructor for a Block node. Adds the block to the graph in
- * current_ir_graph .
+ * current_ir_graph.  Constructs a Block with a fixed number of
+ * predecessors.  Does set current_block.  Can be used with automatic
+ * Phi node construction.
  *
  * @param arity  The number of control predecessors.
  * @param in     An array of control predecessors.  The length of
@@ -3304,14 +3316,14 @@ ir_node *new_Block(int arity, ir_node *in[]);
  */
 ir_node *new_Start  (void);
 
-/** Constructor for a End node.
+/** Constructor for an End node.
  *
  * Adds the node to the block in current_ir_block.
  *
  */
 ir_node *new_End    (void);
 
-/** Constructor for a EndReg node.
+/** Constructor for an EndReg node.
  *
  * Used to represent regular procedure end in interprocedual view.
  * Adds the node to the block in current_ir_block.
@@ -3348,7 +3360,7 @@ ir_node *new_Jmp    (void);
  */
 ir_node *new_Break  (void);
 
-/**Constructor for a Cond node.
+/** Constructor for a Cond node.
  *
  * If c is mode_b represents a conditional branch (if/else). If c is
  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
@@ -3393,7 +3405,8 @@ ir_node *new_Raise  (ir_node *store, ir_node *obj);
  * Adds the node to the block in current_ir_block.
  *
  * @param *mode  The mode of the operands and redults.
- * @param *con   Points to an entry in the constant table. This pointer is added to the attributes of  the node (self->attr.con).
+ * @param *con   Points to an entry in the constant table. This pointer is
+ *               added to the attributes of  the node.
  *
  */
 ir_node *new_Const  (ir_mode *mode, tarval *con);
@@ -3427,6 +3440,10 @@ ir_node *new_Const  (ir_mode *mode, tarval *con);
 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
 
 /** Constructor for a simpelSel node.
+ *
+ *  This is a shortcut for the new_Sel() constructor.  To be used for
+ *  Sel nodes that do not select from an array, i.e., have no index
+ *  inputs.  It adds the two parameters 0, NULL.
  *
  * @param   *store     The memory in which the object the entity should be selected from is allocated.
  * @param   *objptr    The object from that the Sel operation selects a single attribute out.
@@ -3442,6 +3459,7 @@ ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
  * Dynamically the node may select entities that overwrite the given
  * entity.  If the selected entity is an array element entity the Sel
  * node takes the required array indicees as inputs.
+ * Adds the node to the block in current_ir_block.
  *
  * @param   *store     The memory in which the object the entity should be selected
  *                     from is allocated.
@@ -3455,7 +3473,7 @@ ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
 ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
                      entity *ent);
 
-/** Constructor for a InstOf node.
+/** Constructor for an InstOf node.
  *
  * Adds the node to the block in current_ir_block.
  * For translating Java.  Not supported as standard firm node.
@@ -3760,9 +3778,9 @@ ir_node *new_Alloc  (ir_node *store, ir_node *size, type *alloc_type,
  *
  */
 ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
-             type *free_type);
+                    type *free_type);
 
-/**Constructor for a  Sync node.
+/** Constructor for a  Sync node.
  *
  * Merges several memory values.  The node assumes that a variable
  * either occurs only in one of the memories, or it contains the same
@@ -3776,7 +3794,7 @@ ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
  */
 ir_node *new_Sync   (int arity, ir_node *in[]);
 
-/**Constructor for a Proj node.
+/** Constructor for a Proj node.
  *
  * Projects a single value out of a tuple.  The parameter proj gives the
  * position of the value within the tuple.
@@ -3789,7 +3807,7 @@ ir_node *new_Sync   (int arity, ir_node *in[]);
  */
 ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
 
-/**Costructor for a Filter node.
+/** Costructor for a Filter node.
  *
  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
  * Filter is a node with two views used to construct the interprocedural view.
@@ -3807,7 +3825,7 @@ ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
  */
 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
 
-/**Constructor for a defaultProj node.
+/** Constructor for a defaultProj node.
  *
  * Represents the default control flow of a Switch-Cond node.
  * Adds the node to the block in current_ir_block.
@@ -3818,7 +3836,7 @@ ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
  */
 ir_node *new_defaultProj (ir_node *arg, long max_proj);
 
-/**Constructor for a Tuple node.
+/** Constructor for a Tuple node.
  *
  * This is an auxiliary node to replace a node that returns a tuple
  * without changing the corresponding Proj nodes.
@@ -3830,7 +3848,7 @@ ir_node *new_defaultProj (ir_node *arg, long max_proj);
  */
 ir_node *new_Tuple  (int arity, ir_node *in[]);
 
-/**Constructor for a Id node.
+/** Constructor for an Id node.
  *
  * This is an auxiliary node to replace a node that returns a single
  * value. Adds the node to the block in current_ir_block.
@@ -3841,7 +3859,7 @@ ir_node *new_Tuple  (int arity, ir_node *in[]);
  */
 ir_node *new_Id     (ir_node *val, ir_mode *mode);
 
-/**Constructor for a Bad node.
+/** Constructor for a Bad node.
  *
  * Returns the unique Bad node of the graph.  The same as
  * get_irg_bad().
@@ -3865,7 +3883,7 @@ ir_node *new_Bad    (void);
  */
 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
 
-/** Constructor for a Unknown node.
+/** Constructor for an Unknown node.
  *
  * Represents an arbitrary value.  Places the node in
  * the start block.
@@ -3897,45 +3915,76 @@ ir_node *new_FuncCall (ir_node *callee, int arity, ir_node *in[],
 /* needed also.                                                        */
 /*---------------------------------------------------------------------*/
 
-/* --- Block construction --- */
-/* immature Block without predecessors */
+/** Create an immature block.
+ *
+ * An immature block has an unknown number of predecessors.  Predecessors
+ * can be added with add_immBlock_pred().  Once all predecessors are
+ * added the block must be matured.
+ *
+ * Adds the block to the graph in current_ir_graph. Does set
+ * current_block.  Can be used with automatic Phi node construction.
+ * This constructor can only be used if the graph is in
+ * state_building.
+ */
 ir_node *new_d_immBlock (dbg_info* db);
 ir_node *new_immBlock (void);
 
 /** Add a control flow edge to an immature block. */
 void add_in_edge (ir_node *immblock, ir_node *jmp);
 
-/** fixes the number of predecessors of a block. */
+/** Fix the number of predecessors of an immature block. */
 void mature_block (ir_node *block);
 
-/* --- Parameter administration --- */
-/* Read a value from the array with the local variables.  Use this
-   function to obtain the last definition of the value associated with
-   pos.  Pos may not exceed the value passed as n_loc to new_ir_graph. */
+
+/** Get the current value of a local variable.
+ *
+ * Use this function to obtain the last definition of the local variable
+ * associated with pos.  Pos may not exceed the value passed as n_loc
+ * to new_ir_graph.  This call automatically inserts Phi nodes.
+ *
+ * @param *db    A pointer for debug information.
+ * @param  pos   The position/id of the local variable.
+ * @param *mode  The mode of the value to get.
+ */
 ir_node *get_d_value (dbg_info* db, int pos, ir_mode *mode);
 ir_node *get_value (int pos, ir_mode *mode);
 
-/** Write a value in the array with the local variables. Use this function
-   to remember a new definition of the value associated with pos. Pos may
-   not exceed the value passed as n_loc to new_ir_graph. */
+/** Remark a new definition of a variable.
+ *
+ * Use this function to remember a new definition of the value
+ * associated with pos. Pos may not exceed the value passed as n_loc
+ * to new_ir_graph.  This call is needed to automatically inserts Phi
+ * nodes.
+ *
+ * @param  pos   The position/id of the local variable.
+ * @param *value The new value written to the local variable.
+*/
 void set_value (int pos, ir_node *value);
 
-/** Read a store.
-   Use this function to get the most recent version of the store (type M).
-   Internally it does the same as get_value. */
+/** Get the current memory state.
+ *
+ * Use this function to obtain the last definition of the memory
+ * state.  This call automatically inserts Phi nodes for the memory
+ * state value.
+ *
+ */
 ir_node *get_store (void);
 
-/** Write a store. */
+/** Remark a new definition of the memory state.
+ *
+ * Use this function to remember a new definition of the memory state.
+ * This call is needed to automatically inserts Phi nodes.
+ *
+ * @param *store The new memory state.
+*/
 void set_store (ir_node *store);
 
-/** keep this node alive even if End is not control-reachable from it */
+/** keep this node alive even if End is not control-reachable from it
+ *
+ * @param ka The node to keep alive.
+ */
 void keep_alive (ir_node *ka);
 
-/* --- Useful access routines --- */
-/** Returns the current block of the current graph.  To set the current
-   block use switch_block(). */
-ir_node *get_cur_block(void);
-
 /** Returns the frame type of the current graph */
 type *get_cur_frame_type(void);
 
index a3743cd..337c091 100644 (file)
@@ -1357,7 +1357,7 @@ static void dump_enum_item(type *tp, int pos)
   PRINT_ITEMID(tp, pos); fprintf(F, "\"");
   fprintf (F, DEFAULT_ENUM_ITEM_ATTRIBUTE);
   fprintf (F, "label: ");
-  fprintf (F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, id_to_str(id));
+  fprintf (F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, get_id_str(id));
   fprintf (F, "\n info1: \"value: %s\"}\n", buf);
 }
 
index 733fe7d..5092d55 100644 (file)
@@ -1064,8 +1064,8 @@ static ir_graph *get_call_called_irg(ir_node *call) {
   if (get_irn_op(addr) == op_Const) {
     /* Check whether the constant is the pointer to a compiled entity. */
     tv = get_Const_tarval(addr);
-    if (tarval_to_entity(tv))
-      called_irg = get_entity_irg(tarval_to_entity(tv));
+    if (get_tarval_entity(tv))
+      called_irg = get_entity_irg(get_tarval_entity(tv));
   }
   return called_irg;
 }
@@ -1082,8 +1082,8 @@ static void collect_calls(ir_node *call, void *env) {
   if (get_irn_op(addr) == op_Const) {
     /* Check whether the constant is the pointer to a compiled entity. */
     tv = get_Const_tarval(addr);
-    if (tarval_to_entity(tv)) {
-      called_irg = get_entity_irg(tarval_to_entity(tv));
+    if (get_tarval_entity(tv)) {
+      called_irg = get_entity_irg(get_tarval_entity(tv));
       if (called_irg && ienv->pos < MAX_INLINE) {
         /* The Call node calls a locally defined method.  Remember to inline. */
         ienv->calls[ienv->pos++] = call;
@@ -1127,7 +1127,7 @@ void inline_small_irgs(ir_graph *irg, int size) {
       tarval *tv;
       ir_graph *callee;
       tv = get_Const_tarval(get_Call_ptr(env.calls[i]));
-      callee = get_entity_irg(tarval_to_entity(tv));
+      callee = get_entity_irg(get_tarval_entity(tv));
       if (((_obstack_memory_used(callee->obst) - obstack_room(callee->obst)) < size) ||
         (get_irg_inline_property(callee) == irg_inline_forced)) {
         inline_method(env.calls[i], callee);
index 5281e81..835c7fd 100644 (file)
@@ -83,7 +83,7 @@ typedef struct ir_graph ir_graph;
 extern ir_graph *current_ir_graph;
 
 ir_graph *get_current_ir_graph(void);
-void set_current_ir_graph(ir_graph *graph);
+void      set_current_ir_graph(ir_graph *graph);
 
 /** This flag indicate the current view. The behaviour of some methods
  * (get_irn_*, set_irn_*) is influenced by this flag. */
@@ -190,13 +190,7 @@ void     set_irg_current_block (ir_graph *irg, ir_node *node);
 ir_node *get_irg_bad (ir_graph *irg);
 void     set_irg_bad (ir_graph *irg, ir_node *node);
 
-/* Use new_Unknown() instead!! */
-/* GL removed: we need unknown with mode for analyses.
-ir_node *get_irg_unknown (ir_graph *irg);
-void     set_irg_unknown (ir_graph *irg, ir_node *node);
-*/
-
-/** Returns teh number of value numbers of a graph. */
+/** Returns the number of value numbers of a graph. */
 int      get_irg_n_locs (ir_graph *irg);
 
 /** Returns the graph number. */
index a022be8..5bc7b1a 100644 (file)
@@ -198,16 +198,16 @@ int is_mode(void *thing);
 /* ********** Access methods to read mode information *********** */
 
 /** Returns the classification of the mode */
-modecode get_mode_modecode(const ir_mode *mode);
+modecode    get_mode_modecode(const ir_mode *mode);
 
 /** Returns the ident* of the mode */
-ident *get_mode_ident(const ir_mode *mode);
+ident      *get_mode_ident(const ir_mode *mode);
 
 /** Returns the null-terminated name of this mode. */
 const char *get_mode_name(const ir_mode *mode);
 
 /** Returns a coarse classification of the mode. */
-mode_sort get_mode_sort(const ir_mode *mode);
+mode_sort   get_mode_sort(const ir_mode *mode);
 
 /** Returns the size of values of the mode in bits. */
 int get_mode_size_bits(const ir_mode *mode);
@@ -231,23 +231,27 @@ int get_mode_sign(const ir_mode *mode);
 /** Returns the arithmetic of a mode */
 int get_mode_arithmetic(const ir_mode *mode);
 
-/** Attribute modulo shift specifies for modes of kind irms_int_number
+/** Get the modulo shift attribute.
+ *
+ *  Attribute modulo shift specifies for modes of kind irms_int_number
  *  whether shift applies modulo to value of bits to shift.  Zero for
  *  modes that are not integer.
  */
 unsigned int get_mode_modulo_shift(const ir_mode *mode);
 
-/** Attribute vector_elem specifies the number of vector elements of
+/** Return the number of vector elements.
+ *
+ *  Attribute vector_elem specifies the number of vector elements of
  *  a vector mode. For non-vector modes it returns 1 for data and 0
  *  for all other modes
  */
 unsigned int get_mode_vector_elems(const ir_mode *mode);
 
 /** Returns the stored intermediate information. */
-voidget_mode_link(const ir_mode *mode);
+void *get_mode_link(const ir_mode *mode);
 
 /** Stores new intermediate information. */
-void set_mode_link(ir_mode *mode, void *l);
+void  set_mode_link(ir_mode *mode, void *l);
 
 /**
  * Returns the smallest representable value of a given mode.
index 6070fbc..2537194 100644 (file)
@@ -245,8 +245,7 @@ typedef enum {
  * @remark This is the old name convention, don't use anymore.
  */
 typedef enum {
-  pns_initial_exec,     /**< Projection on an executable, the initial control
-               flow. */
+  pns_initial_exec,     /**< Projection on an executable, the initial control flow. */
   pns_global_store,     /**< Projection on the global store */
   pns_frame_base,       /**< Projection on the frame base */
   pns_globals,          /**< Projection on the pointer to the data segment
@@ -277,7 +276,7 @@ int   is_value_arg_pointer(ir_node *n);
 
 /* @@@ no more supported  */
 ir_node **get_Block_cfgpred_arr (ir_node *node);
-int              get_Block_n_cfgpreds (ir_node *node);
+int       get_Block_n_cfgpreds (ir_node *node);
 ir_node  *get_Block_cfgpred (ir_node *node, int pos);
 void      set_Block_cfgpred (ir_node *node, int pos, ir_node *pred);
 bool      get_Block_matured (ir_node *node);
@@ -426,8 +425,6 @@ type    *get_SymConst_type (ir_node *node);
 void     set_SymConst_type (ir_node *node, type *tp);
 
 /** Only to access SymConst of kind addr_name.  Else assertion: */
-#define get_SymConst_ptrinfo get_SymConst_name
-#define set_SymConst_ptrinfo set_SymConst_name
 ident   *get_SymConst_name (ir_node *node);
 void     set_SymConst_name (ir_node *node, ident *name);
 
@@ -751,10 +748,10 @@ long      get_Filter_proj(ir_node *node);
 void      set_Filter_proj(ir_node *node, long proj);
 /* set the interprocedural predecessors, ...d_arr uses current_ir_graph.
  * @@@ Maybe better:  arity is zero if no cg preds. */
-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);
-int              get_Filter_n_cg_preds(ir_node *node);
-ir_node *        get_Filter_cg_pred(ir_node *node, int pos);
+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);
+int      get_Filter_n_cg_preds(ir_node *node);
+ir_node *get_Filter_cg_pred(ir_node *node, int pos);
 
 /**
  * Projection numbers for Load: use for Proj nodes!
@@ -826,7 +823,6 @@ void      set_Sync_pred (ir_node *node, int pos, ir_node *pred);
 
 ir_node  *get_Proj_pred (ir_node *node);
 void      set_Proj_pred (ir_node *node, ir_node *pred);
-/* Why long? shouldn't int be enough, and smaller? Or even byte? */
 long      get_Proj_proj (ir_node *node);
 void      set_Proj_proj (ir_node *node, long proj);
 
index 03c3edf..cf02831 100644 (file)
@@ -79,13 +79,26 @@ ir_prog *get_irp(void);
 void init_irprog(void);
 
 /** Creates a new ir_prog, returns it and sets irp with it.
  Automatically called by init_firm() through init_irprog.  */
*  Automatically called by init_firm() through init_irprog. */
 ir_prog *new_ir_prog (void);
 
 /** frees all memory used by irp.  Types in type list and irgs in irg
   list must be freed by hand before. */
*  list must be freed by hand before. */
 void     free_ir_prog(void);
 
+/** Sets the file name / executable name or the like. Initially NULL. */
+void   set_irp_prog_name (ident *name);
+
+/** Gets the file name / executable name or the like. Returns NULL if
+ *  not yet set.
+ */
+ident *get_irp_prog_ident(void);
+
+/** Gets the file name / executable name or the like. Returns NULL if
+ *  not yet set.
+ */
+const char *get_irp_prog_name (void);
+
 /** Gets the main routine of the compiled program. */
 ir_graph *get_irp_main_irg(void);
 
@@ -108,11 +121,15 @@ ir_graph *get_irp_irg(int pos);
 /** Sets the ir graph at position pos. */
 void      set_irp_irg(int pos, ir_graph *irg);
 
+
+/** Returns the "global" type of the irp. */
+type *get_glob_type(void);
+
 /** 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. */
+    shrinks the list by one. */
 void  remove_irp_type(type *typ);
 
 /** Returns the number of all types in the irp. */
@@ -124,29 +141,20 @@ type *get_irp_type(int pos);
 /** Overwrites the type at position pos with another type. */
 void  set_irp_type(int pos, type *typ);
 
-/** Returns the "global" type of the irp. */
-type *get_glob_type(void);
-
-/** File name / executable name or the like. Initially NULL! **/
-void   set_irp_prog_name (ident *name);
-ident *get_irp_prog_ident(void);
-const char  *get_irp_prog_name (void);
-
-/**
- *   Returns an irgraph that only contains constant
- *   expressions for constant entities.
- *   Do not use any access function for this graph, do not generate code
- *   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.
+/**  Return the graph for global constants.
+ *
+ *   Returns an irgraph that only contains constant expressions for
+ *   constant entities.  Do not use any access function for this
+ *   graph, do not generate code for this graph.  This graph contains
+ *   only one block.  The constant expressions may not contain control
+ *   flow.
+ *   Walking the graph starting from any node will not reach the block
+ *   or any controlflow.
+ *   See also copy_const_code() in entity.h.
  */
 ir_graph *get_const_code_irg(void);
 
 irg_outs_state get_irp_ip_outs_state(void);
 void           set_irp_ip_outs_inconsistent(void);
 
-/* @@@ Must this be global visible? */
-void           set_irp_ip_outedges(ir_node ** ip_outedges);
-ir_node**      get_irp_ip_outedges(void);
-
 #endif /* ifndef _IRPROG_H_ */
index 9fc9ad8..07d3de8 100644 (file)
@@ -105,6 +105,9 @@ __get_const_code_irg(void)
   return irp->const_code_irg;
 }
 
+void           set_irp_ip_outedges(ir_node ** ip_outedges);
+ir_node**      get_irp_ip_outedges(void);
+
 #define get_irp_n_irgs()       __get_irp_n_irgs()
 #define get_irp_irg(pos)       __get_irp_irg(pos)
 #define get_irp_n_types()      __get_irp_n_types()
index 0a7c97c..1411378 100644 (file)
@@ -667,18 +667,29 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
   case iro_Const: {
       tarval *tv = get_Const_tarval(n);
       if (tarval_is_entity(tv))
-      ASSERT_AND_RET((get_irn_irg(n) == get_const_code_irg()) ||
-                     (get_entity_peculiarity(tarval_to_entity(tv)) != peculiarity_description),
-                     "descriptions have no address", 0);
-      ASSERT_AND_RET(
-             /* Const: BB --> data */
-             (mode_is_data (mymode) ||
-              mymode == mode_b)      /* we want boolean constants for static evaluation */
-             ,"Const node", 0        /* of Cmp. */
-             );
+         ASSERT_AND_RET(
+                        (get_irn_irg(n) == get_const_code_irg()) ||
+                        (get_entity_peculiarity(get_tarval_entity(tv)) != peculiarity_description),
+                        "descriptions have no address", 0);
+         ASSERT_AND_RET(
+                        /* Const: BB --> data */
+                        (mode_is_data (mymode) ||
+                         mymode == mode_b)      /* we want boolean constants for static evaluation */
+                        ,"Const node", 0        /* of Cmp. */
+                        );
      } break;
 
     case iro_SymConst:
+      if (get_SymConst_kind(n) == symconst_addr_ent) {
+       entity *ent = get_SymConst_entity(n);
+       if (is_method_type(get_entity_type(ent)) &&
+           get_irn_irg(n) != get_const_code_irg()) {
+#if 0
+         ASSERT_AND_RET((get_entity_peculiarity(ent) != peculiarity_description),
+                        "A constant must address an existing method.", 0);
+#endif
+       }
+      }
       ASSERT_AND_RET(
                      /* SymConst: BB --> int*/
                      (mode_is_int(mymode) ||
diff --git a/ir/ir/old_fctnames.h b/ir/ir/old_fctnames.h
deleted file mode 100644 (file)
index 36235ba..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Project:     libFIRM
- * File name:   ir/ir/old_fctnames.h
- * Purpose:     Some makros supporting old function names.
- * Author:      Goetz Lindenmaier
- * Modified by:
- * Created:
- * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2003 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- */
-
-
-#ifndef __OLD_FCTNAMES_H__
-#define __OLD_FCTNAMES_H__
-
-/* irgraph */
-#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
-#define get_size_of_mode      get_mode_size
-#define get_ld_align_of_mode  get_mode_ld_align
-#define get_min_of_mode       get_mode_min
-#define get_max_of_mode       get_mode_max
-#define get_null_of_mode      get_mode_null
-#define get_fsigned_of_mode   get_mode_fsigned
-#define get_ffloat_of_mode    get_mode_ffloat
-#define get_mode_size(X)      { assert(get_mode_size_bytes(X) != -1); get_mode_size_bytes(X); }
-
-/* 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
-
-#define get_method_n_res(X) get_method_n_ress(X)
-
-/* tarval.h */
-#define tarval_from_long(X, Y) new_tarval_from_long(Y, X)
-#define tarval_P_from_entity(X) new_tarval_from_entity(X, mode_P_mach)
-#define get_tarval_entity(X) tarval_to_entity(X)
-
-/* ident.h */  /*  @@@ Attention: still in ident.h */
-/* #define id_to_str    get_id_str */
-/* #define id_to_strlen get_id_strlen */
-
-#endif
index d815c77..0c1060b 100644 (file)
@@ -282,7 +282,7 @@ void opt_tail_rec_irg(ir_graph *irg)
     if (! tarval_is_entity(tv))
       continue;
 
-    ent = tarval_to_entity(tv);
+    ent = get_tarval_entity(tv);
     if (!ent || get_entity_irg(ent) != irg)
       continue;
 
index 608db52..30f05b3 100644 (file)
@@ -201,7 +201,7 @@ type       *get_entity_owner (entity *ent);
    ent to owner!! */
 void        set_entity_owner (entity *ent, type *owner);
 
-/** Asserts if the type owner is neither a compound type or an array */
+/** Asserts if the type owner is either a compound type or an array */
 void assert_legal_owner_of_ent(type *owner);
 
 /** Returns the type of an entity. */
@@ -262,9 +262,9 @@ typedef enum {
   variability_uninitialized,    /**< The content of the entity is completely unknown. */
   variability_initialized,      /**< After allocation the entity is initalized with the
                              value given somewhere in the entity. */
-  variability_part_constant,    /**< For entities of compound types.  Some members of the entity
-                             are constant.  The others are uninitialized.  Those members
-                             given a value for are constant. */
+  variability_part_constant,    /**< For entities of compound types.
+                                    The members of the entity are mixed constant,
+                                    initialized or uninitialized. */
   variability_constant          /**< The entity is constant. */
 } ent_variability;
 
index 8f3ded8..ae87eb9 100644 (file)
@@ -23,7 +23,6 @@
 
 # include "ident.h"
 # include "entity.h"
-# include "type.h"
 
 /** initializes the name mangling code */
 void   init_mangle (void);
@@ -37,6 +36,6 @@ ident *mangle_entity (entity *ent);
 ident *mangle_u (ident *first, ident* scnd);
 
 /** mangle: Returns a new ident that represents firstscnd. */
-ident *mangle (ident *first, ident* scnd);
+ident *mangle   (ident *first, ident* scnd);
 
 #endif /* _MANGLE_H_ */
index 14ffa8b..1e45759 100644 (file)
@@ -577,7 +577,7 @@ type *get_method_param_type(type *method, int pos);
     changing the type of the corresponding entity if the representation is constructed. */
 void  set_method_param_type(type *method, int pos, type* tp);
 /** Returns an entity that represents the copied value argument.  Only necessary
-   for compounds passed by value. This information is constructed only on demand. */
+   for compounds passed by value. This information is constrnewucted only on demand. */
 entity *get_method_value_param_ent(type *method, int pos);
 /**
  * Returns a type that represents the copied value arguments.
index d92863b..bfdd7c2 100644 (file)
  *  This module supplies routines that support changing the type graph.
  */
 
-/**
- *   replaces one type by the other.
+/** Replaces one type by the other.
  *
- *   Old type is replaced by new_type.  All references to old_type
- *   now point to new_type.  The memory for the old type is destroyed,
- *   but still used.  Therefore it is not freed.
- *   All referenced to this memory will be lost after a certain while.
- *   An exception is the list of types in irp (irprog.h).
- *   In the future there might be a routine to recover the memory, but
- *   this will be at considerable runtime cost.
+ *  Old type is replaced by new_type.  All references to old_type
+ *  now point to new_type.  The memory for the old type is destroyed,
+ *  but still used.  Therefore it is not freed.
+ *  All referenced to this memory will be lost after a certain while.
+ *  An exception is the list of types in irp (irprog.h).
+ *  In the future there might be a routine to recover the memory, but
+ *  this will be at considerable runtime cost.
  *
  *  @param old_type  - The old type that shall be replaced by the new type.
  *  @param new_type  - The new type that will replace old_type.
  */
 void exchange_types(type *old_type, type *new_type);
 
-/**
- *   Skip id types until a useful type is reached.
+/** Skip id types until a useful type is reached.
  *
- *   @param tp - A type of arbitrary kind.
+ *  @param tp - A type of arbitrary kind.
  *
- *   @return
- *   tp if it is not an id type.
- *   If tp is an id type returns the real type it stands for.
+ *  @return
+ *    tp if it is not an id type.
+ *    If tp is an id type returns the real type it stands for.
  */
 type *skip_tid(type *tp);
 
index 92a2aec..ce122e7 100644 (file)
@@ -425,7 +425,9 @@ int tarval_is_entity(tarval *tv)
       && (tv != tarval_P_void));
 }
 
-entity *tarval_to_entity(tarval *tv)
+#undef tarval_to_entity
+entity *tarval_to_entity(tarval *tv) { return get_tarval_entity(tv); }
+entity *get_tarval_entity(tarval *tv)
 {
   ANNOUNCE();
   assert(tv);
index 6608054..f4535db 100644 (file)
@@ -228,8 +228,7 @@ tarval *new_tarval_from_entity (entity *ent, ir_mode *mode);
  * Returns the associated entity of a tarval.  Asserts if tarval does not
  * contain an entity.
  */
-#define get_tarval_entity tarval_to_entity
-entity *tarval_to_entity(tarval *tv);
+entity *get_tarval_entity(tarval *tv);
 
 /**
  * Returns non-zero if a the given tarval represents an entity.
@@ -584,21 +583,7 @@ typedef enum _tarval_classification_t {
  */
 tarval_classification_t tarval_classify(tarval *tv);
 
-/**
- * Initialization of the tarval module.
- *
- * Call before init_mode().
- */
-void init_tarval_1(void);
-
-/**
- * Initialization of the tarval module.
- *
- * Call after init_mode().
- */
-void init_tarval_2(void);
 
-void finish_tarval(void);
 
 /**
  * Output of tarvals to a buffer.
index 8272c78..4316740 100644 (file)
 
 #include "tv.h"
 
+
+/**
+ * Initialization of the tarval module.
+ *
+ * Call before init_mode().
+ */
+void init_tarval_1(void);
+
+/**
+ * Initialization of the tarval module.
+ *
+ * Call after init_mode().
+ */
+void init_tarval_2(void);
+
+/**
+ * Free all memory occupied by the tarval module.
+ */
+void finish_tarval(void);
+
 /**
- * This struct represents the aforementioned tarvals.
+ * This struct represents the afore mentioned tarvals.
  *
  * A tarval struct consists of an internal representation of the
  * value and some additional fields further describing the value.