* Modified by: Goetz Lindenmaier, Michael Beck
* Created:
* CVS-ID: $Id$
- * Copyright: (c) 1998-2003 Universität Karlsruhe
+ * Copyright: (c) 1998-2006 Universität Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
#ifndef _FIRM_IR_IRNODE_H_
*/
ir_node *get_irn_n (const ir_node *node, int n);
+/**
+* Add a artificial dependency to the node.
+* The dependency is only inserted if it is not there already.
+* @param node The node.
+* @param dep The dependency target.
+* @return The index in the array (get_irn_dep() with that index returns @p dep).
+*/
+int add_irn_dep(ir_node *node, ir_node *dep);
+
+/**
+ * Copy all dependencies from a node to another.
+ * @param tgt The node which sould be enriched.
+ * @param src The node whose dependencies shall be copied.
+ */
+void add_irn_deps(ir_node *tgt, ir_node *src);
+
+/**
+* Get the length of the dependency array.
+* @param node The node.
+* @return The length of the dependency array or 0 if it has not yet been allocated.
+*/
+int get_irn_deps(const ir_node *node);
+
+/**
+* Get an entry of the dependency array.
+* @param node The node.
+* @param pos The position.
+* @return The node at that position.
+*/
+ir_node *get_irn_dep(const ir_node *node, int pos);
+
+/**
+* Set an entry of the dependency array.
+* @param node The node.
+* @param pos The position.
+* @param dep The dependency target.
+*/
+void set_irn_dep(ir_node *node, int pos, ir_node *dep);
+
+
/**
* Get the n-th predecessor of a node in intraprocedural view.
* Can be used always if it's know that node is not a split one.
op_pin_state is_irn_pinned_in_irg (const ir_node *node);
/**
- * irnode constructor.
- * Create a new irnode in irg, with an op, mode, arity and
- * some incoming irnodes.
- * This constructor is used in every specified irnode constructor.
+ * IR node constructor.
+ * Create a new IR node in irg, with an op, mode, arity and
+ * some incoming IR nodes.
+ * This constructor is used in every specific IR node constructor.
*
* @param db Debug info.
* @param irg IR-graph on with this new node should be constructed.
* @param block The block the new node belongs to
* @param op The opcode of the new node.
* @param mode The mode of the new node.
- * @param arity The arity of the new node, may be <0 if yet.
+ * @param arity The arity of the new node, <0 if can be changed dynamically.
* @param in An array of arity predecessor nodes.
*/
ir_node *
/* @@@ 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 (const 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);
/** Get the predecessor block.
symconst_addr_name, /**< The SymConst is a symbolic pointer to be filled in
by the linker. The pointer is represented by a string.
symconst_symbol is ident *. */
- symconst_addr_ent /**< The SymConst is a symbolic pointer to be filled in
+ symconst_addr_ent, /**< The SymConst is a symbolic pointer to be filled in
by the linker. The pointer is represented by an entity.
symconst_symbol is entity *. */
+ symconst_enum_const /**< The SymConst is a enumeration constant of an
+ enumeration type. */
} symconst_kind;
/** Returns non-zero if s symconst kind has a type attribute */
/** Returns non-zero if s symconst kind has an entity attribute */
#define SYMCONST_HAS_ENT(kind) ((kind) == symconst_addr_ent)
+/** Returns non-zero if s symconst kind has an enum_const attribute */
+#define SYMCONST_HAS_ENUM(kind) ((kind) == symconst_enum_const)
+
/** SymConst attribute.
*
- * This union contains the symbolic information represented by the node. */
+ * This union contains the symbolic information represented by the node.
+ */
typedef union symconst_symbol {
- ir_type *type_p;
- ident *ident_p;
- entity *entity_p;
+ ir_type *type_p;
+ ident *ident_p;
+ entity *entity_p;
+ ir_enum_const *enum_p;
} symconst_symbol;
/** Get the kind of the SymConst. */
entity *get_SymConst_entity (ir_node *node);
void set_SymConst_entity (ir_node *node, entity *ent);
+/** Only to access SymConst of kind symconst_enum_const. Else assertion: */
+ir_enum_const *get_SymConst_enum (ir_node *node);
+void set_SymConst_enum (ir_node *node, ir_enum_const *ec);
+
/** Sets both: type and ptrinfo. Needed to treat the node independent of
its semantics. Does a memcpy for the memory sym points to. */
/* write 'union': firmjni then does not create a method... */
ir_node *get_Bound_upper(ir_node *bound);
void set_Bound_upper(ir_node *bound, ir_node *upper);
+/** Return the operand of a Pin node. */
+ir_node *get_Pin_op(ir_node *pin);
+void set_Pin_op(ir_node *pin, ir_node *node);
+
+
/*
*
* NAME Auxiliary routines
int is_Sync (const ir_node *node);
/** returns true if node is a Confirm node. */
int is_Confirm (const ir_node *node);
+/** returns true if node is a SymConst node. */
+int is_SymConst (const ir_node *node);
+/** returns true if node is a Cond node. */
+int is_Cond (const ir_node *node);
+/** returns true if node is a Cmp node. */
+int is_Cmp (const ir_node *node);
+/** returns true if node is an Alloc node */
+int is_Alloc (const ir_node *node);
/** returns true if node is a Proj node or a Filter node in
* intraprocedural view */
int is_Proj (const ir_node *node);