/* Now handle anchored nodes. We need the out count of those
even if they are not visible. */
- for (i = anchor_last - 1; i >= 0; --i) {
+ for (i = anchor_last; i >= anchor_first; --i) {
n = get_irg_anchor(irg, i);
if (!irn_visited_else_mark(n)) {
n->out = (ir_def_use_edge*) INT_TO_PTR(1);
free = _set_out_edges(get_irg_end(irg), free);
/* handle anchored nodes */
- for (i = anchor_last - 1; i >= 0; --i) {
+ for (i = anchor_last; i >= anchor_first; --i) {
n = get_irg_anchor(irg, i);
if (!irn_visited_else_mark(n)) {
size_t n_outs = PTR_TO_INT(n->out);
ir_node *new_r_Anchor(ir_graph *irg)
{
- ir_node *in[anchor_last];
+ ir_node *in[anchor_last+1];
ir_node *res;
size_t i;
memset(in, 0, sizeof(in));
- res = new_ir_node(NULL, irg, NULL, op_Anchor, mode_ANY, anchor_last, in);
+ res = new_ir_node(NULL, irg, NULL, op_Anchor, mode_ANY, anchor_last+1, in);
res->attr.anchor.irg.irg = irg;
/* hack to get get_irn_irg working: set block to ourself and allow
res->in[0] = res;
/* we can't have NULL inputs so reference ourselfes for now */
- for (i = 0; i < (size_t)anchor_last; ++i) {
+ for (i = 0; i <= (size_t)anchor_last; ++i) {
set_irn_n(res, i, res);
}
/**
* Index constants for nodes that can be accessed through the graph anchor node.
*/
-enum irg_anchors {
- anchor_end_block = 0, /**< block the end node will belong to, same as Anchors block */
+typedef enum irg_anchors {
+ anchor_first,
+ anchor_end_block = anchor_first, /**< block the end node will belong to,
+ same as Anchors block */
anchor_start_block, /**< block the start node will belong to */
anchor_end, /**< end node of this ir_graph */
anchor_start, /**< start node of this ir_graph */
anchor_initial_mem, /**< initial memory of this graph */
anchor_args, /**< methods arguments */
anchor_no_mem, /**< NoMem node of this ir_graph, the one and only in this graph */
- anchor_last
-};
+ anchor_last = anchor_no_mem
+} irg_anchors;
+ENUM_COUNTABLE(irg_anchors)
/** A callgraph entry for callees. */
typedef struct cg_callee_entry {