Commit 5a2faef9 authored by Matthias Braun's avatar Matthias Braun
Browse files

generate n_Node_XXX enums for node inputs

parent 47f181f9
...@@ -1237,24 +1237,28 @@ int is_memop(const ir_node *node) ...@@ -1237,24 +1237,28 @@ int is_memop(const ir_node *node)
ir_node *get_memop_mem(const ir_node *node) ir_node *get_memop_mem(const ir_node *node)
{ {
assert(is_memop(node)); assert(is_memop(node));
assert(n_Load_mem == 0 && n_Store_mem == 0);
return get_irn_n(node, 0); return get_irn_n(node, 0);
} }
void set_memop_mem(ir_node *node, ir_node *mem) void set_memop_mem(ir_node *node, ir_node *mem)
{ {
assert(is_memop(node)); assert(is_memop(node));
assert(n_Load_mem == 0 && n_Store_mem == 0);
set_irn_n(node, 0, mem); set_irn_n(node, 0, mem);
} }
ir_node *get_memop_ptr(const ir_node *node) ir_node *get_memop_ptr(const ir_node *node)
{ {
assert(is_memop(node)); assert(is_memop(node));
assert(n_Load_mem == 1 && n_Store_mem == 1);
return get_irn_n(node, 1); return get_irn_n(node, 1);
} }
void set_memop_ptr(ir_node *node, ir_node *ptr) void set_memop_ptr(ir_node *node, ir_node *ptr)
{ {
assert(is_memop(node)); assert(is_memop(node));
assert(n_Load_mem == 1 && n_Store_mem == 1);
set_irn_n(node, 1, ptr); set_irn_n(node, 1, ptr);
} }
......
...@@ -419,17 +419,17 @@ void (set_{{node.name}}_{{attr.name}})(ir_node *node, {{attr.type}} {{attr.name} ...@@ -419,17 +419,17 @@ void (set_{{node.name}}_{{attr.name}})(ir_node *node, {{attr.type}} {{attr.name}
{% endfor -%} {% endfor -%}
{%- for node in nodes %} {%- for node in nodes %}
{%- for in in node.ins %} {%- for input in node.ins %}
ir_node *(get_{{node.name}}_{{in[0]}})(const ir_node *node) ir_node *(get_{{node.name}}_{{input[0]}})(const ir_node *node)
{ {
assert(is_{{node.name}}(node)); assert(is_{{node.name}}(node));
return get_irn_n(node, {{node.ins.index(in)}}); return get_irn_n(node, n_{{node.name}}_{{input[0]}});
} }
void (set_{{node.name}}_{{in[0]}})(ir_node *node, ir_node *{{in[0]|escape_keywords}}) void (set_{{node.name}}_{{input[0]}})(ir_node *node, ir_node *{{input[0]|escape_keywords}})
{ {
assert(is_{{node.name}}(node)); assert(is_{{node.name}}(node));
set_irn_n(node, {{node.ins.index(in)}}, {{in[0]|escape_keywords}}); set_irn_n(node, n_{{node.name}}_{{input[0]}}, {{input[0]|escape_keywords}});
} }
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
...@@ -482,6 +482,16 @@ nodeops_h_template = env.from_string( ...@@ -482,6 +482,16 @@ nodeops_h_template = env.from_string(
*/ */
{% for node in nodes -%} {% for node in nodes -%}
{% if node.ins %}
/**
* Input numbers for {{node.name}} node
*/
typedef enum {
{%- for input in node.ins %}
n_{{node.name}}_{{input[0]}},
{%- endfor %}
} n_{{node.name}};
{% endif %}
{% if node.outs %} {% if node.outs %}
/** /**
* Projection numbers for result of {{node.name}} node (use for Proj nodes) * Projection numbers for result of {{node.name}} node (use for Proj nodes)
...@@ -554,9 +564,9 @@ FIRM_API int is_{{node.name}}(const ir_node *node); ...@@ -554,9 +564,9 @@ FIRM_API int is_{{node.name}}(const ir_node *node);
{%- endfor %} {%- endfor %}
{% for node in nodes %} {% for node in nodes %}
{% for in in node.ins -%} {% for input in node.ins -%}
FIRM_API ir_node *get_{{node.name}}_{{in[0]}}(const ir_node *node); FIRM_API ir_node *get_{{node.name}}_{{input[0]}}(const ir_node *node);
FIRM_API void set_{{node.name}}_{{in[0]}}(ir_node *node, ir_node *{{in[0]|escape_keywords}}); FIRM_API void set_{{node.name}}_{{input[0]}}(ir_node *node, ir_node *{{input[0]|escape_keywords}});
{% endfor -%} {% endfor -%}
{% for attr in node.attrs|hasnot("noprop") -%} {% for attr in node.attrs|hasnot("noprop") -%}
FIRM_API {{attr.type}} get_{{node.name}}_{{attr.name}}(const ir_node *node); FIRM_API {{attr.type}} get_{{node.name}}_{{attr.name}}(const ir_node *node);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment