scripts: Generate accessor functions for nodes with a variable/dynamic number of...
authorChristoph Mallon <christoph.mallon@gmx.de>
Mon, 3 Dec 2012 18:51:01 +0000 (19:51 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Mon, 3 Dec 2012 18:59:18 +0000 (19:59 +0100)
include/libfirm/irnode.h
ir/ir/irnode.c
ir/ir/irnode_t.h
ir/ir/irverify.c
scripts/gen_ir.py
scripts/ir_spec.py

index 52e6384..f1f87b2 100644 (file)
@@ -246,13 +246,6 @@ FIRM_API ir_node *get_nodes_block(const ir_node *node);
 /** Sets the Block of a node. */
 FIRM_API void set_nodes_block(ir_node *node, ir_node *block);
 
-/** Returns the number of control flow predecessors of a block. */
-FIRM_API int get_Block_n_cfgpreds(const ir_node *block);
-/** Returns the control flow predecessor of a block at a given position. */
-FIRM_API ir_node *get_Block_cfgpred(const ir_node *block, int pos);
-/** Sets the control flow predecessor of a block at a given position. */
-FIRM_API void set_Block_cfgpred(ir_node *block, int pos, ir_node *pred);
-
 /**
  * Returns the position of the predecessor block pred in the inputs
  * of the block block.
@@ -317,14 +310,8 @@ FIRM_API ir_type *is_frame_pointer(const ir_node *n);
  * @{
  */
 
-/** Returns the number of Keep alive node. */
-FIRM_API int get_End_n_keepalives(const ir_node *end);
-/** Returns the Keep alive node a position pos. */
-FIRM_API ir_node *get_End_keepalive(const ir_node *end, int pos);
 /** Keep alive dedicated nodes.  These must be either PhiM or Block nodes. */
 FIRM_API void add_End_keepalive(ir_node *end, ir_node *ka);
-/** Sets the Keep alive node at position pos. */
-FIRM_API void set_End_keepalive(ir_node *end, int pos, ir_node *ka);
 
 /**
  * Sets new keep-alives.
@@ -347,21 +334,6 @@ FIRM_API void free_End(ir_node *end);
 
 /** @} */
 
-/** @addtogroup Return
- * @{
- */
-
-/** Returns return value inputs of Return node @p node as array. */
-FIRM_API ir_node **get_Return_res_arr(ir_node *node);
-/** Returns number of return value inputs of Return node @p node. */
-FIRM_API size_t get_Return_n_ress(const ir_node *node);
-/** Returns return value input @p pos of Return node @p node. */
-FIRM_API ir_node *get_Return_res(const ir_node *node, int pos);
-/** Sets return value input @p pos of Return node @p node to value @p res. */
-FIRM_API void set_Return_res(ir_node *node, int pos, ir_node *res);
-
-/** @} */
-
 /** @addtogroup Const
  * @{
  */
@@ -429,34 +401,10 @@ FIRM_API void set_SymConst_symbol(ir_node *node, union symconst_symbol sym);
 
 /** @} */
 
-/** @addtogroup Sel
- * @{
- */
-
-/** Returns index inputs of Sel node @p node as array. */
-FIRM_API ir_node **get_Sel_index_arr(ir_node *node);
-/** Returns number of index inputs of Sel node @p node. */
-FIRM_API int get_Sel_n_indexs(const ir_node *node);
-/** Returns value of index input @p pos of Sel node @p node. */
-FIRM_API ir_node *get_Sel_index(const ir_node *node, int pos);
-/** Sets @p index as index input @p pos of Sel node @p node. */
-FIRM_API void set_Sel_index(ir_node *node, int pos, ir_node *index);
-
-/** @} */
-
 /** @addtogroup Call
  * @{
  */
 
-/** Returns parameter inputs of Call node @p node as array. */
-FIRM_API ir_node **get_Call_param_arr(ir_node *node);
-/** Returns the number of parameters of a call. */
-FIRM_API int get_Call_n_params(const ir_node *node);
-/** Returns the call parameter at position pos. */
-FIRM_API ir_node *get_Call_param(const ir_node *node, int pos);
-/** Sets the call parameter at position pos. */
-FIRM_API void set_Call_param(ir_node *node, int pos, ir_node *param);
-
 /** Sets, get and remove the callee information for a Call node.
  *
  *  The callee information lists all method entities that can be called
@@ -489,21 +437,6 @@ FIRM_API void remove_Call_callee_arr(ir_node *node);
 
 /** @} */
 
-/** @addtogroup Builtin
- * @{
- */
-
-/** Returns the parameter inputs of Builtin node @p node as array. */
-FIRM_API ir_node **get_Builtin_param_arr(ir_node *node);
-/** Returns the number of parameters of a Builtin. */
-FIRM_API int get_Builtin_n_params(const ir_node *node);
-/** Returns the Builtin parameter at position pos. */
-FIRM_API ir_node *get_Builtin_param(const ir_node *node, int pos);
-/** Sets the Builtin parameter at position pos. */
-FIRM_API void set_Builtin_param(ir_node *node, int pos, ir_node *param);
-
-/** @} */
-
 /** Returns a human readable string for the ir_builtin_kind. */
 FIRM_API const char *get_builtin_kind_name(ir_builtin_kind kind);
 
@@ -587,24 +520,6 @@ FIRM_API int is_Cast_downcast(ir_node *node);
  * @{
  */
 
-/**
- * Returns all phi predecessors as array
- */
-FIRM_API ir_node **get_Phi_preds_arr(ir_node *node);
-/**
- * Returns number of predecessors of phi node @p node
- */
-FIRM_API int get_Phi_n_preds(const ir_node *node);
-/**
- * Returns the predecessor with number @p pos of phi node @p node.
- * This is the value selected when control flow comes from predecessor @p pos
- * of the containing basic block.
- */
-FIRM_API ir_node *get_Phi_pred(const ir_node *node, int pos);
-/**
- * Sets value @p pred as predecessor number @p pos of phi node @p node.
- */
-FIRM_API void set_Phi_pred(ir_node *node, int pos, ir_node *pred);
 /**
  * Returns the next element of a block phi list.
  */
@@ -635,14 +550,6 @@ FIRM_API void set_memop_mem(ir_node *node, ir_node *mem);
  * @{
  */
 
-/** Returns all predecessors of Sync node @p node as array */
-FIRM_API ir_node **get_Sync_preds_arr(ir_node *node);
-/** Returns number of predecessors of Sync node @p node. */
-FIRM_API int get_Sync_n_preds(const ir_node *node);
-/** Returns predecessor number @p pos of Sync node @p node. */
-FIRM_API ir_node *get_Sync_pred(const ir_node *node, int pos);
-/** Sets value @p pred as predecessor number @p pos of Sync node @p node. */
-FIRM_API void set_Sync_pred(ir_node *node, int pos, ir_node *pred);
 /** Adds @p pred to predecessor list of Sync node @p node. */
 FIRM_API void add_Sync_pred(ir_node *node, ir_node *pred);
 /** Removes predecessor i from Sync n */
@@ -657,29 +564,10 @@ FIRM_API void del_Sync_n(ir_node *n, int i);
  */
 FIRM_API int is_arg_Proj(const ir_node *node);
 
-/** @addtogroup Tuple
- * @{
- */
-
-/** Returns all predecessors of Tuple node @p node as array. */
-FIRM_API ir_node **get_Tuple_preds_arr(ir_node *node);
-/** Returns number of predecessors of Tuple node @p node. */
-FIRM_API int get_Tuple_n_preds(const ir_node *node);
-/** Returns predecessor number @p pos of Tuple node @p node. */
-FIRM_API ir_node  *get_Tuple_pred(const ir_node *node, int pos);
-/** Sets value @p pred as predecessor number @p pos of Tuple node @p node. */
-FIRM_API void set_Tuple_pred(ir_node *node, int pos, ir_node *pred);
-
-/** @} */
-
 /** @addtogroup ASM
  * @{
  */
 
-/** Returns the number of input constraints for an ASM node. */
-FIRM_API int get_ASM_n_inputs(const ir_node *node);
-/** Returns input number @p pos of an ASM node. */
-FIRM_API ir_node *get_ASM_input(const ir_node *node, int pos);
 /** Returns the number of output constraints for an ASM node.  */
 FIRM_API size_t get_ASM_n_output_constraints(const ir_node *node);
 /** Returns the number of clobbered registers for an ASM node.  */
index ca6e648..a6d6d15 100644 (file)
 
 /* some constants fixing the positions of nodes predecessors
    in the in array */
-#define CALL_PARAM_OFFSET     (n_Call_max+1)
-#define BUILTIN_PARAM_OFFSET  (n_Builtin_max+1)
-#define ASM_PARAM_OFFSET      (n_ASM_max+1)
-#define SEL_INDEX_OFFSET      (n_Sel_max+1)
-#define RETURN_RESULT_OFFSET  (n_Return_max+1)
 #define END_KEEPALIVE_OFFSET  0
 
 static const char *relation_names [] = {
@@ -480,28 +475,6 @@ ir_type *is_frame_pointer(const ir_node *n)
        return NULL;
 }
 
-ir_node **get_Block_cfgpred_arr(ir_node *node)
-{
-       assert(is_Block(node));
-       return (ir_node **)&(get_irn_in(node)[1]);
-}
-
-int (get_Block_n_cfgpreds)(const ir_node *node)
-{
-       return get_Block_n_cfgpreds_(node);
-}
-
-ir_node *(get_Block_cfgpred)(const ir_node *node, int pos)
-{
-       return get_Block_cfgpred_(node, pos);
-}
-
-void set_Block_cfgpred(ir_node *node, int pos, ir_node *pred)
-{
-       assert(is_Block(node));
-       set_irn_n(node, pos, pred);
-}
-
 int get_Block_cfgpred_pos(const ir_node *block, const ir_node *pred)
 {
        int i;
@@ -598,30 +571,12 @@ void (set_Block_mark)(ir_node *block, unsigned mark)
        set_Block_mark_(block, mark);
 }
 
-int get_End_n_keepalives(const ir_node *end)
-{
-       assert(is_End(end));
-       return (get_irn_arity(end) - END_KEEPALIVE_OFFSET);
-}
-
-ir_node *get_End_keepalive(const ir_node *end, int pos)
-{
-       assert(is_End(end));
-       return get_irn_n(end, pos + END_KEEPALIVE_OFFSET);
-}
-
 void add_End_keepalive(ir_node *end, ir_node *ka)
 {
        assert(is_End(end));
        add_irn_n(end, ka);
 }
 
-void set_End_keepalive(ir_node *end, int pos, ir_node *ka)
-{
-       assert(is_End(end));
-       set_irn_n(end, pos + END_KEEPALIVE_OFFSET, ka);
-}
-
 void set_End_keepalives(ir_node *end, int n, ir_node *in[])
 {
        size_t e;
@@ -703,35 +658,6 @@ void free_End(ir_node *end)
                             in array afterwards ... */
 }
 
-size_t get_Return_n_ress(const ir_node *node)
-{
-       assert(is_Return(node));
-       return (size_t)(get_irn_arity(node) - RETURN_RESULT_OFFSET);
-}
-
-ir_node **get_Return_res_arr(ir_node *node)
-{
-       assert(is_Return(node));
-       if (get_Return_n_ress(node) > 0)
-               return (ir_node **)&(get_irn_in(node)[1 + RETURN_RESULT_OFFSET]);
-       else
-               return NULL;
-}
-
-ir_node *get_Return_res(const ir_node *node, int pos)
-{
-       assert(is_Return(node));
-       assert(pos >= 0);
-       assert(get_Return_n_ress(node) > (size_t)pos);
-       return get_irn_n(node, pos + RETURN_RESULT_OFFSET);
-}
-
-void set_Return_res(ir_node *node, int pos, ir_node *res)
-{
-       assert(is_Return(node));
-       set_irn_n(node, pos + RETURN_RESULT_OFFSET, res);
-}
-
 int (is_Const_null)(const ir_node *node)
 {
        return is_Const_null_(node);
@@ -815,81 +741,6 @@ void set_SymConst_symbol(ir_node *node, union symconst_symbol sym)
        node->attr.symc.sym = sym;
 }
 
-int get_Sel_n_indexs(const ir_node *node)
-{
-       assert(is_Sel(node));
-       return (get_irn_arity(node) - SEL_INDEX_OFFSET);
-}
-
-ir_node **get_Sel_index_arr(ir_node *node)
-{
-       assert(is_Sel(node));
-       if (get_Sel_n_indexs(node) > 0)
-               return (ir_node **)& get_irn_in(node)[SEL_INDEX_OFFSET + 1];
-       else
-               return NULL;
-}
-
-ir_node *get_Sel_index(const ir_node *node, int pos)
-{
-       assert(is_Sel(node));
-       return get_irn_n(node, pos + SEL_INDEX_OFFSET);
-}
-
-void set_Sel_index(ir_node *node, int pos, ir_node *index)
-{
-       assert(is_Sel(node));
-       set_irn_n(node, pos + SEL_INDEX_OFFSET, index);
-}
-
-ir_node **get_Call_param_arr(ir_node *node)
-{
-       assert(is_Call(node));
-       return &get_irn_in(node)[CALL_PARAM_OFFSET + 1];
-}
-
-int get_Call_n_params(const ir_node *node)
-{
-       assert(is_Call(node));
-       return get_irn_arity(node) - CALL_PARAM_OFFSET;
-}
-
-ir_node *get_Call_param(const ir_node *node, int pos)
-{
-       assert(is_Call(node));
-       return get_irn_n(node, pos + CALL_PARAM_OFFSET);
-}
-
-void set_Call_param(ir_node *node, int pos, ir_node *param)
-{
-       assert(is_Call(node));
-       set_irn_n(node, pos + CALL_PARAM_OFFSET, param);
-}
-
-ir_node **get_Builtin_param_arr(ir_node *node)
-{
-       assert(is_Builtin(node));
-       return &get_irn_in(node)[BUILTIN_PARAM_OFFSET + 1];
-}
-
-int get_Builtin_n_params(const ir_node *node)
-{
-       assert(is_Builtin(node));
-       return (get_irn_arity(node) - BUILTIN_PARAM_OFFSET);
-}
-
-ir_node *get_Builtin_param(const ir_node *node, int pos)
-{
-       assert(is_Builtin(node));
-       return get_irn_n(node, pos + BUILTIN_PARAM_OFFSET);
-}
-
-void set_Builtin_param(ir_node *node, int pos, ir_node *param)
-{
-       assert(is_Builtin(node));
-       set_irn_n(node, pos + BUILTIN_PARAM_OFFSET, param);
-}
-
 const char *get_builtin_kind_name(ir_builtin_kind kind)
 {
 #define X(a)    case a: return #a
@@ -1038,30 +889,6 @@ void set_binop_right(ir_node *node, ir_node *right)
        set_irn_n(node, node->op->op_index + 1, right);
 }
 
-ir_node **get_Phi_preds_arr(ir_node *node)
-{
-  assert(is_Phi(node));
-  return (ir_node **)&(get_irn_in(node)[1]);
-}
-
-int get_Phi_n_preds(const ir_node *node)
-{
-       assert(is_Phi(node));
-       return get_irn_arity(node);
-}
-
-ir_node *get_Phi_pred(const ir_node *node, int pos)
-{
-       assert(is_Phi(node));
-       return get_irn_n(node, pos);
-}
-
-void set_Phi_pred(ir_node *node, int pos, ir_node *pred)
-{
-       assert(is_Phi(node));
-       set_irn_n(node, pos, pred);
-}
-
 ir_node *(get_Phi_next)(const ir_node *phi)
 {
        return get_Phi_next_(phi);
@@ -1091,30 +918,6 @@ void set_memop_mem(ir_node *node, ir_node *mem)
        set_irn_n(node, op->memory_index, mem);
 }
 
-ir_node **get_Sync_preds_arr(ir_node *node)
-{
-       assert(is_Sync(node));
-       return (ir_node **)&(get_irn_in(node)[1]);
-}
-
-int get_Sync_n_preds(const ir_node *node)
-{
-       assert(is_Sync(node));
-       return (get_irn_arity(node));
-}
-
-ir_node *get_Sync_pred(const ir_node *node, int pos)
-{
-       assert(is_Sync(node));
-       return get_irn_n(node, pos);
-}
-
-void set_Sync_pred(ir_node *node, int pos, ir_node *pred)
-{
-       assert(is_Sync(node));
-       set_irn_n(node, pos, pred);
-}
-
 void add_Sync_pred(ir_node *node, ir_node *pred)
 {
        assert(is_Sync(node));
@@ -1162,41 +965,6 @@ int ir_throws_exception(const ir_node *node)
        return attr->throws_exception;
 }
 
-ir_node **get_Tuple_preds_arr(ir_node *node)
-{
-       assert(is_Tuple(node));
-       return (ir_node **)&(get_irn_in(node)[1]);
-}
-
-int get_Tuple_n_preds(const ir_node *node)
-{
-       assert(is_Tuple(node));
-       return get_irn_arity(node);
-}
-
-ir_node *get_Tuple_pred(const ir_node *node, int pos)
-{
-  assert(is_Tuple(node));
-  return get_irn_n(node, pos);
-}
-
-void set_Tuple_pred(ir_node *node, int pos, ir_node *pred)
-{
-       assert(is_Tuple(node));
-       set_irn_n(node, pos, pred);
-}
-
-int get_ASM_n_inputs(const ir_node *node)
-{
-       assert(is_ASM(node));
-       return get_irn_arity(node) - ASM_PARAM_OFFSET;
-}
-
-ir_node *get_ASM_input(const ir_node *node, int pos)
-{
-       return get_irn_n(node, ASM_PARAM_OFFSET + pos);
-}
-
 size_t get_ASM_n_output_constraints(const ir_node *node)
 {
        assert(is_ASM(node));
index e0c6baa..b9d5f26 100644 (file)
  */
 ir_node **get_irn_in(const ir_node *node);
 
-/**
- * Returns an array with the predecessors of the Block. Depending on
- * the implementation of the graph data structure this can be a copy of
- * the internal representation of predecessors as well as the internal
- * array itself. Therefore writing to this array might obstruct the IR.
- */
-ir_node **get_Block_cfgpred_arr(ir_node *node);
-
 /*-------------------------------------------------------------------*/
 /*  These function are most used in libfirm.  Give them as static    */
 /*  functions so they can be inlined.                                */
@@ -379,18 +371,6 @@ static inline int is_SymConst_addr_ent_(const ir_node *node)
        return is_SymConst(node) && get_SymConst_kind(node) == symconst_addr_ent;
 }
 
-static inline int get_Block_n_cfgpreds_(const ir_node *node)
-{
-       assert(is_Block_(node));
-       return get_irn_arity_(node);
-}
-
-static inline ir_node *get_Block_cfgpred_(const ir_node *node, int pos)
-{
-       assert(is_Block_(node));
-       return get_irn_n_(node, pos);
-}
-
 /**
  * Get the predecessor block.
  *
index 12bd286..0949e03 100644 (file)
@@ -883,7 +883,7 @@ static int verify_node_Return(const ir_node *n)
        ASSERT_AND_RET( mymode == mode_X, "Result X", 0 );   /* result X */
        /* Compare returned results with result types of method type */
        mt = get_entity_type(get_irg_entity(irg));
-       ASSERT_AND_RET_DBG(get_Return_n_ress(n) == get_method_n_ress(mt),
+       ASSERT_AND_RET_DBG((size_t)get_Return_n_ress(n) == get_method_n_ress(mt),
                "Number of results for Return doesn't match number of results in type.", 0,
                show_return_nres(irg, n, mt););
        for (i = get_Return_n_ress(n) - 1; i >= 0; --i) {
index 90309ba..5b76e61 100755 (executable)
@@ -368,8 +368,14 @@ irnode_h_template = env.from_string(
 {%- for input in node.ins %}
 #define get_{{node.name}}_{{input[0]}}(node) get_{{node.name}}_{{input[0]}}_(node)
 #define set_{{node.name}}_{{input[0]}}(node, {{input[0]|escape_keywords}}) set_{{node.name}}_{{input[0]}}_(node, {{input[0]|escape_keywords}})
+{%- endfor -%}
+{%- if node.input_name %}
+#define get_{{node.name}}_n_{{node.input_name}}s(node) get_{{node.name}}_n_{{node.input_name}}s_(node)
+#define get_{{node.name}}_{{node.input_name}}(node, pos) get_{{node.name}}_{{node.input_name}}_(node, pos)
+#define set_{{node.name}}_{{node.input_name}}(node, pos, {{node.input_name}}) set_{{node.name}}_{{node.input_name}}_(node, pos, {{node.input_name}})
+#define get_{{node.name}}_{{node.input_name}}_arr(node) get_{{node.name}}_{{node.input_name}}_arr_(node)
+{%- endif %}
 {% endfor %}
-{%- endfor %}
 
 {%- for node in nodes %}
 static inline int is_{{node.name}}_(const ir_node *node)
@@ -403,6 +409,32 @@ static inline void set_{{node.name}}_{{input[0]}}_(ir_node *node, ir_node *{{inp
        set_irn_n(node, n_{{node.name}}_{{input[0]}}, {{input[0]|escape_keywords}});
 }
 {% endfor %}
+
+{%- if node.input_name %}
+static inline int get_{{node.name}}_n_{{node.input_name}}s_(ir_node const *node)
+{
+       assert(is_{{node.name}}(node));
+       return get_irn_arity(node){% if node.ins %} - (n_{{node.name}}_max + 1){% endif %};
+}
+
+static inline ir_node *get_{{node.name}}_{{node.input_name}}_(ir_node const *node, int pos)
+{
+       assert(0 <= pos && pos < get_{{node.name}}_n_{{node.input_name}}s(node));
+       return get_irn_n(node, pos{% if node.ins %} + (n_{{node.name}}_max + 1){% endif %});
+}
+
+static inline void set_{{node.name}}_{{node.input_name}}_(ir_node *node, int pos, ir_node *{{node.input_name}})
+{
+       assert(0 <= pos && pos < get_{{node.name}}_n_{{node.input_name}}s(node));
+       set_irn_n(node, pos{% if node.ins %} + (n_{{node.name}}_max + 1){% endif %}, {{node.input_name}});
+}
+
+static inline ir_node **get_{{node.name}}_{{node.input_name}}_arr_(ir_node *node)
+{
+       assert(is_{{node.name}}(node));
+       return get_irn_in(node) + 1{% if node.ins %}+ (n_{{node.name}}_max + 1){% endif %};
+}
+{% endif -%}
 {% endfor -%}
 ''')
 
@@ -435,6 +467,28 @@ void (set_{{node.name}}_{{input[0]}})(ir_node *node, ir_node *{{input[0]|escape_
        set_{{node.name}}_{{input[0]}}_(node, {{input[0]|escape_keywords}});
 }
 {% endfor %}
+
+{%- if node.input_name %}
+int (get_{{node.name}}_n_{{node.input_name}}s)(ir_node const *node)
+{
+       return get_{{node.name}}_n_{{node.input_name}}s_(node);
+}
+
+ir_node *(get_{{node.name}}_{{node.input_name}})(ir_node const *node, int pos)
+{
+       return get_{{node.name}}_{{node.input_name}}_(node, pos);
+}
+
+void (set_{{node.name}}_{{node.input_name}})(ir_node *node, int pos, ir_node *{{node.input_name}})
+{
+       set_{{node.name}}_{{node.input_name}}_(node, pos, {{node.input_name}});
+}
+
+ir_node **(get_{{node.name}}_{{node.input_name}}_arr)(ir_node *node)
+{
+       return get_{{node.name}}_{{node.input_name}}_arr_(node);
+}
+{% endif -%}
 {% endfor %}
 ''')
 
@@ -604,7 +658,18 @@ FIRM_API ir_node *get_{{node.name}}_{{input[0]}}(const ir_node *node);
 /** Sets {{input[0]}} input of {{node.name|a_an}} node. */
 FIRM_API void set_{{node.name}}_{{input[0]}}(ir_node *node, ir_node *{{input[0]|escape_keywords}});
 {% endfor -%}
-{% for attr in node.attrs|hasnot("noprop") -%}
+{%- if node.input_name -%}
+/** Get the number of {{node.name}} {{node.input_name}}s. */
+FIRM_API int get_{{node.name}}_n_{{node.input_name}}s(ir_node const *node);
+/** Get the {{node.name}} {{node.input_name}} with index @p pos. */
+FIRM_API ir_node *get_{{node.name}}_{{node.input_name}}(ir_node const *node, int pos);
+/** Set the {{node.name}} {{node.input_name}} with index @p pos. */
+FIRM_API void set_{{node.name}}_{{node.input_name}}(ir_node *node, int pos, ir_node *{{node.input_name}});
+/** Get an array of all {{node.name}} {{node.input_name}}s. */
+ir_node **get_{{node.name}}_{{node.input_name}}_arr(ir_node *node);
+{% endif -%}
+
+{%- for attr in node.attrs|hasnot("noprop") %}
 /** Returns {{attr.name}} attribute of {{node.name|a_an}} node. */
 FIRM_API {{attr.type}} get_{{node.name}}_{{attr.name}}(const ir_node *node);
 /** Sets {{attr.name}} attribute of {{node.name|a_an}} node. */
index 07a995a..b144814 100755 (executable)
@@ -122,6 +122,7 @@ class ASM:
        """
        mode             = "mode_T"
        arity            = "variable"
+       input_name       = "input"
        flags            = [ "keep", "uses_memory" ]
        pinned           = "memory"
        pinned_init      = "op_pin_state_pinned"
@@ -215,6 +216,7 @@ class Block:
        block            = "NULL"
        pinned           = "yes"
        arity            = "variable"
+       input_name       = "cfgpred"
        flags            = []
        attr_struct      = "block_attr"
        attrs            = [
@@ -268,16 +270,17 @@ class Bound:
 @op
 class Builtin:
        """performs a backend-specific builtin."""
-       ins      = [
+       ins         = [
                ("mem", "memory dependency"),
        ]
-       arity    = "variable"
-       outs     = [
+       arity       = "variable"
+       input_name  = "param"
+       outs        = [
                ("M", "memory result"),
                # results follow here
        ]
-       flags    = [ "uses_memory" ]
-       attrs    = [
+       flags       = [ "uses_memory" ]
+       attrs       = [
                dict(
                        type    = "ir_builtin_kind",
                        name    = "kind",
@@ -292,7 +295,7 @@ class Builtin:
        pinned      = "memory"
        pinned_init = "op_pin_state_pinned"
        attr_struct = "builtin_attr"
-       init   = '''
+       init        = '''
        assert((get_unknown_type() == type) || is_Method_type(type));
        '''
 
@@ -302,19 +305,20 @@ class Call:
        operands are passed to the called code. Called code usually performs a
        return operation. The operands of this return operation are the result
        of the Call node."""
-       ins      = [
+       ins         = [
                ("mem",   "memory dependency"),
                ("ptr",   "pointer to called code"),
        ]
-       arity    = "variable"
-       outs     = [
+       arity       = "variable"
+       input_name  = "param"
+       outs        = [
                ("M",                "memory result"),
                ("T_result",         "tuple containing all results"),
                ("X_regular",        "control flow when no exception occurs"),
                ("X_except",         "control flow when exception occured"),
        ]
-       flags    = [ "fragile", "uses_memory" ]
-       attrs    = [
+       flags       = [ "fragile", "uses_memory" ]
+       attrs       = [
                dict(
                        type    = "ir_type*",
                        name    = "type",
@@ -542,6 +546,7 @@ class End:
        mode             = "mode_X"
        pinned           = "yes"
        arity            = "dynamic"
+       input_name       = "keepalive"
        flags            = [ "cfopcode" ]
        knownBlock       = True
        block            = "get_irg_end_block(irg)"
@@ -772,6 +777,7 @@ class Phi:
        all phi nodes produce their nth input as result."""
        pinned        = "yes"
        arity         = "variable"
+       input_name    = "pred"
        flags         = []
        attr_struct   = "phi_attr"
        init          = '''
@@ -831,13 +837,14 @@ class Raise:
 class Return:
        """Returns from the current function. Takes memory and return values as
        operands."""
-       ins      = [
+       ins        = [
                ("mem", "memory dependency"),
        ]
-       arity    = "variable"
-       mode     = "mode_X"
-       flags    = [ "cfopcode" ]
-       pinned   = "yes"
+       arity      = "variable"
+       input_name = "res"
+       mode       = "mode_X"
+       flags      = [ "cfopcode" ]
+       pinned     = "yes"
 
 class Rotl(Binop):
        """Returns its first operand bits rotated left by the amount in the 2nd
@@ -851,15 +858,16 @@ class Sel:
 
        Optimisations assume that a Sel node can only produce a NULL pointer if the
        ptr input was NULL."""
-       ins    = [
+       ins         = [
                ("mem", "memory dependency"),
                ("ptr", "pointer to object to select from"),
        ]
-       arity  = "variable"
-       flags  = []
-       mode   = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
-       pinned = "no"
-       attrs  = [
+       arity       = "variable"
+       input_name  = "index"
+       flags       = []
+       mode        = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
+       pinned      = "no"
+       attrs       = [
                dict(
                        type    = "ir_entity*",
                        name    = "entity",
@@ -1001,10 +1009,11 @@ class Sync:
        be identical.  This operation allows to specify all operations that
        eventually need several partial memory blocks as input with a single
        entrance by unifying the memories with a preceding Sync operation."""
-       mode     = "mode_M"
-       flags    = []
-       pinned   = "no"
-       arity    = "dynamic"
+       mode       = "mode_M"
+       flags      = []
+       pinned     = "no"
+       arity      = "dynamic"
+       input_name = "pred"
 
 @op
 class Tuple:
@@ -1016,10 +1025,11 @@ class Tuple:
        the implementation with pointers in only one direction.) The Tuple node is
        smaller than any other node, so that a node can be changed into a Tuple by
        just changing its opcode and giving it a new in array."""
-       arity  = "variable"
-       mode   = "mode_T"
-       pinned = "no"
-       flags  = []
+       arity      = "variable"
+       input_name = "pred"
+       mode       = "mode_T"
+       pinned     = "no"
+       flags      = []
 
 @op
 class Unknown: