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)
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) {
* @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.
*
* @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.
*
* @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.
*
* @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.
*
* @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.
*
* @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.
*
* @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.
*
* @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.
* @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);
/*-----------------------------------------------------------------------*/
/** 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.
*
* @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.
*
*/
*
* @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);
/** 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.
*
*/
* 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
*/
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.
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.
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
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.
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.
*/
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.
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.
*/
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().
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.
*/
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.
*
*/
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.
*/
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.
/* 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
*/
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.
*/
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
* 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);
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.
* 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.
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.
*
*/
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
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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().
*/
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.
/* 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);
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);
}
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;
}
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;
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);
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. */
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. */
/* ********** 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);
/** 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. */
-void* get_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.
* @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
/* @@@ 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);
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);
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!
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);
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);
/** 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. */
/** 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_ */
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()
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) ||
+++ /dev/null
-/*
- * 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
if (! tarval_is_entity(tv))
continue;
- ent = tarval_to_entity(tv);
+ ent = get_tarval_entity(tv);
if (!ent || get_entity_irg(ent) != irg)
continue;
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. */
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;
# include "ident.h"
# include "entity.h"
-# include "type.h"
/** initializes the name mangling code */
void init_mangle (void);
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_ */
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.
* 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);
&& (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);
* 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.
*/
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.
#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.