#ifdef DEBUG_libfirm
return node->node_nr;
#else
- return 0;
+ return (long)&node;
#endif
}
set_irn_n(node, -1, block);
}
+/* Test whether arbitrary node is frame pointer, i.e. Proj(pn_Start_P_frame_base)
+ * from Start. If so returns frame type, else Null. */
+type *is_frame_pointer(ir_node *n) {
+ if ((get_irn_op(n) == op_Proj) &&
+ (get_Proj_proj(n) == pn_Start_P_frame_base)) {
+ ir_node *start = get_Proj_pred(n);
+ if (get_irn_op(start) == op_Start) {
+ return get_irg_frame_type(get_irn_irg(start));
+ }
+ }
+ return NULL;
+}
+
+/* Test whether arbitrary node is globals pointer, i.e. Proj(pn_Start_P_globals)
+ * from Start. If so returns global type, else Null. */
+type *is_globals_pointer(ir_node *n) {
+ if ((get_irn_op(n) == op_Proj) &&
+ (get_Proj_proj(n) == pn_Start_P_globals)) {
+ ir_node *start = get_Proj_pred(n);
+ if (get_irn_op(start) == op_Start) {
+ return get_glob_type();
+ }
+ }
+ return NULL;
+}
+
+/* Test whether arbitrary node is value arg base, i.e. Proj(pn_Start_P_value_arg_base)
+ * from Start. If so returns 1, else 0. */
+int is_value_arg_pointer(ir_node *n) {
+ if ((get_irn_op(n) == op_Proj) &&
+ (get_Proj_proj(n) == pn_Start_P_value_arg_base) &&
+ (get_irn_op(get_Proj_pred(n)) == op_Start))
+ return 1;
+ return 0;
+}
+
/* Returns an array with the predecessors of the Block. Depending on
the implementation of the graph datastructure this can be a copy of
the internal representation of predecessors as well as the internal
node->attr.block.graph_arr[pos+1] = value;
}
-/* handler handling for Blocks */
+/* handler handling for Blocks * /
void
set_Block_handler (ir_node *block, ir_node *handler) {
assert ((block->op == op_Block));
return (block->attr.block.handler_entry);
}
-/* handler handling for Nodes */
+/ * handler handling for Nodes * /
void
set_Node_handler (ir_node *node, ir_node *handler) {
set_Block_handler (get_nodes_Block (node), handler);
return (get_Block_handler (get_nodes_Block (node)));
}
-/* exc_t handling for Blocks */
+/ * exc_t handling for Blocks * /
void set_Block_exc (ir_node *block, exc_t exc) {
assert ((block->op == op_Block));
block->attr.block.exc = exc;
exc_t get_Block_exc (ir_node *block) {
assert ((block->op == op_Block));
-
return (block->attr.block.exc);
}
-/* exc_t handling for Nodes */
+/ * exc_t handling for Nodes * /
void set_Node_exc (ir_node *node, exc_t exc) {
set_Block_exc (get_nodes_Block (node), exc);
}
exc_t get_Node_exc (ir_node *node) {
return (get_Block_exc (get_nodes_Block (node)));
}
+*/
void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
assert(node->op == op_Block);
/* Start references the irg it is in. */
INLINE ir_graph *
get_Start_irg(ir_node *node) {
- assert(node->op == op_Start);
- return node->attr.start.irg;
+ return get_irn_irg(node);
}
INLINE void
set_Start_irg(ir_node *node, ir_graph *irg) {
assert(node->op == op_Start);
assert(is_ir_graph(irg));
- node->attr.start.irg = irg;
+ assert(0 && " Why set irg? ");
+ //node->attr.start.irg = irg;
}
INLINE int
in array afterwards ... */
}
-ir_graph *get_EndReg_irg (const ir_node *end) {
- assert (end->op == op_EndReg);
- return end->attr.end.irg;
+ir_graph *get_EndReg_irg (ir_node *end) {
+ return get_irn_irg(end);
}
-ir_graph *get_EndExcept_irg (const ir_node *end) {
- assert (end->op == op_EndReg);
- return end->attr.end.irg;
+ir_graph *get_EndExcept_irg (ir_node *end) {
+ return get_irn_irg(end);
}
/*
set_irn_n(node, 0, ptr);
}
ir_graph * get_CallBegin_irg (ir_node *node) {
- assert(node->op == op_CallBegin);
- return node->attr.callbegin.irg;
+ return get_irn_irg(node);
}
ir_node * get_CallBegin_call (ir_node *node) {
assert(node->op == op_CallBegin);
set_irn_n(node, 0, pred);
}
+INLINE ir_node *get_Confirm_value (ir_node *node) {
+ assert (node->op == op_Confirm);
+ return get_irn_n(node, 0);
+}
+INLINE void set_Confirm_value (ir_node *node, ir_node *value) {
+ assert (node->op == op_Confirm);
+ set_irn_n(node, 0, value);
+}
+INLINE ir_node *get_Confirm_bound (ir_node *node) {
+ assert (node->op == op_Confirm);
+ return get_irn_n(node, 1);
+}
+INLINE void set_Confirm_bound (ir_node *node, ir_node *bound) {
+ assert (node->op == op_Confirm);
+ set_irn_n(node, 0, bound);
+}
+INLINE pn_Cmp get_Confirm_cmp (ir_node *node) {
+ assert (node->op == op_Confirm);
+ return node->attr.confirm_cmp;
+}
+INLINE void set_Confirm_cmp (ir_node *node, pn_Cmp cmp) {
+ assert (node->op == op_Confirm);
+ node->attr.confirm_cmp = cmp;
+}
+
INLINE ir_node *
get_Filter_pred (ir_node *node) {
INLINE ir_graph *
get_irn_irg(ir_node *node) {
- if (get_irn_op(node) == op_CallBegin) {
- return node->attr.callbegin.irg;
- } else if (get_irn_op(node) == op_EndReg ||
- get_irn_op(node) == op_EndExcept) {
- return node->attr.end.irg;
- } else if (get_irn_op(node) == op_Start) {
- return node->attr.start.irg;
- } else {
- assert(0 && "no irg attr");
- return NULL;
- }
+ if (get_irn_op(node) != op_Block)
+ node = get_nodes_block(node);
+ assert(get_irn_op(node) == op_Block);
+ return node->attr.block.irg;
}
}
ir_graph *get_ip_cfop_irg(ir_node *n) {
- switch (get_irn_opcode(n)) {
- case iro_EndReg:
- return get_EndReg_irg(n);
- case iro_EndExcept:
- return get_EndExcept_irg(n);
- case iro_CallBegin:
- return get_CallBegin_irg(n);
- default:
- assert(is_ip_cfop(n));
- }
- return NULL; /* should never be reached */
+ return get_irn_irg(n);
}
/* Returns true if the operation can change the control flow because