#include "array.h"
#include "set.h"
+#include "list.h"
#include "entity_t.h"
#include "type_t.h"
+#include "tv_t.h"
+
+#define FIRM_EDGES_INPLACE 1
/** ir node attributes **/
where_alloc where; /**< stack, heap or other managed part of memory */
} alloc_attr;
+/** Free attributes */
+typedef struct {
+ type *type; /**< Type of the allocated object. */
+ where_alloc where; /**< stack, heap or other managed part of memory */
+} free_attr;
+
/** InstOf attributes */
typedef struct
{
typedef pn_Cmp confirm_attr; /** Attribute to hold compare operation */
+/**
+ * Edge info to put into an irn.
+ */
+typedef struct _irn_edge_info_t {
+ struct list_head outs_head;
+ int out_count;
+} irn_edge_info_t;
+
+
/** Some irnodes just have one attribute, these are stored here,
some have more. Their name is 'irnodename_attr' */
typedef union {
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. */
+ alloc_attr a; /**< For Alloc. */
+ free_attr f; /**< For Free. */
io_attr io; /**< For InstOf */
- type *f; /**< For Free. */
cast_attr cast; /**< For Cast. */
load_attr load; /**< For Load. */
store_attr store; /**< For Store. */
during optimization to link to nodes that
shall replace a node. */
/* ------- Fields for optimizations / analysis information ------- */
- struct ir_node **out; /**< array of out edges */
+ struct ir_node **out; /**< @deprecated array of out edges. */
struct dbg_info* dbi; /**< A pointer to information for debug support. */
/* ------- For debugging ------- */
#ifdef DEBUG_libfirm
- int out_valid; /** < indicate that out edges are valid */
+ int out_valid;
int node_nr; /**< a unique node number for each node to make output
readable. */
#endif
#ifdef DO_HEAPANALYSIS
struct abstval *av;
struct section *sec;
+#endif
+#ifdef FIRM_EDGES_INPLACE
+ irn_edge_info_t edge_info;
#endif
/* ------- Opcode depending fields -------- */
attr attr; /**< attribute of this node. Depends on opcode.
const_attr get_irn_const_attr (ir_node *node);
long get_irn_proj_attr (ir_node *node);
alloc_attr get_irn_alloc_attr (ir_node *node);
-type *get_irn_free_attr (ir_node *node);
+free_attr get_irn_free_attr (ir_node *node);
symconst_attr get_irn_symconst_attr (ir_node *node);
type *get_irn_call_attr (ir_node *node);
type *get_irn_funccall_attr (ir_node *node);
}
}
+static INLINE tarval *_get_Const_tarval (ir_node *node) {
+ assert (node->op == op_Const);
+ return node->attr.con.tv;
+}
+
+
+static INLINE cnst_classify_t _classify_Const(ir_node *node)
+{
+ ir_op *op;
+ assert(_is_ir_node(node));
+
+ op = _get_irn_op(node);
+
+ if(op == op_Const)
+ return classify_tarval(_get_Const_tarval(node));
+ else if(op == op_SymConst)
+ return CNST_SYMCONST;
+
+ return CNST_NO_CONST;
+}
+
+
/* this section MUST contain all inline functions */
#define is_ir_node(thing) _is_ir_node(thing)
#define get_irn_intra_arity(node) _get_irn_intra_arity(node)
#define is_Block(node) _is_Block(node)
#define set_Block_dead(block) _set_Block_dead(block)
#define is_Block_dead(block) _is_Block_dead(block)
+#define get_Const_tarval(node) _get_Const_tarval(node)
+#define classify_Const(node) _classify_Const(node)
# endif /* _IRNODE_T_H_ */