+void (set_{{node.name}}_{{attr.name}})(ir_node *node, {{attr.type}} {{attr.name}})
+{
+ assert(is_{{node.name}}(node));
+ node->attr.{{node.attrs_name}}.{{attr.name}} = {{attr.name}};
+}
+{% endfor -%}
+{% endfor -%}
+
+{%- for node in nodes %}
+{%- for in in node.ins %}
+ir_node *(get_{{node.name}}_{{in}})(const ir_node *node)
+{
+ assert(is_{{node.name}}(node));
+ return get_irn_n(node, {{node.ins.index(in)}});
+}
+
+void (set_{{node.name}}_{{in}})(ir_node *node, ir_node *{{in|escape_keywords}})
+{
+ assert(is_{{node.name}}(node));
+ set_irn_n(node, {{node.ins.index(in)}}, {{in|escape_keywords}});
+}
+{% endfor %}
+{% endfor %}
+''')
+
+irop_template = env.from_string('''
+/* Warning: automatically generated code */
+{% for node in nodes %}
+ir_op *op_{{node.name}}; ir_op *get_op_{{node.name}}(void) { return op_{{node.name}}; }
+{%- endfor %}
+
+void init_op(void)
+{
+ {% for node in nodes %}
+ op_{{node.name}} = new_ir_op(
+ {%- filter arguments %}
+ iro_{{node.name}}
+ "{{node.name}}"
+ {{node|pinned}}
+ {{node|flags}}
+ {{node|arity}}
+ {{node|opindex}}
+ {{node|attr_size}}
+ NULL
+ {% endfilter %});
+ {%- endfor %}
+
+ be_init_op();
+}
+
+void finish_op(void)
+{
+ {% for node in nodes %}
+ free_ir_op(op_{{node.name}}); op_{{node.name}} = NULL;
+ {%- endfor %}
+}
+
+''')
+
+nodeops_h_template = env.from_string('''
+/* Warning: automatically generated code */
+#ifndef FIRM_IR_NODEOPS_H
+#define FIRM_IR_NODEOPS_H
+
+#include "firm_types.h"
+
+/**
+ * @addtogroup ir_node
+ * @{
+ */
+
+{% for node in nodes -%}
+{% if node.outs %}
+/**
+ * Projection numbers for result of {{node.name}} node (use for Proj nodes)
+ */
+typedef enum {
+ {% for out in node.outs -%}
+ pn_{{node.name}}_{{out[0]}}
+ {%- if out.__len__() > 2 %} = {{out[2]}}{% endif %}, /**< {{out[1]}} */
+ {% endfor -%}
+ pn_{{node.name}}_max
+} pn_{{node.name}};
+{% endif %}
+{%- endfor %}
+
+{% for node in nodes %}
+/** Return true of the node is a {{node.name}} node. */
+FIRM_API int is_{{node.name}}(const ir_node *node);
+{%- endfor %}
+
+{% for node in nodes %}
+{% for in in node.ins -%}
+FIRM_API ir_node *get_{{node.name}}_{{in}}(const ir_node *node);
+void set_{{node.name}}_{{in}}(ir_node *node, ir_node *{{in|escape_keywords}});
+{% endfor -%}
+{% for attr in node.attrs|hasnot("noprop") -%}
+FIRM_API {{attr.type}} get_{{node.name}}_{{attr.name}}(const ir_node *node);
+FIRM_API void set_{{node.name}}_{{attr.name}}(ir_node *node, {{attr.type}} {{attr.name}});
+{% endfor -%}
+{% endfor -%}
+
+/** @} */
+
+#endif
+''')
+
+opcodes_h_template = env.from_string('''
+/* Warning: automatically generated code */
+#ifndef FIRM_IR_OPCODES_H
+#define FIRM_IR_OPCODES_H
+
+/** The opcodes of the libFirm predefined operations. */
+typedef enum ir_opcode {
+{%- for node in nodes %}
+ iro_{{node.name}},
+{%- endfor %}
+ iro_First = iro_{{nodes[0].name}},
+ iro_Last = iro_{{nodes[-1].name}},
+
+ beo_First,
+ /* backend specific nodes */
+ beo_Spill = beo_First,
+ beo_Reload,
+ beo_Perm,
+ beo_MemPerm,
+ beo_Copy,
+ beo_Keep,
+ beo_CopyKeep,
+ beo_Call,
+ beo_Return,
+ beo_AddSP,
+ beo_SubSP,
+ beo_IncSP,
+ beo_Start,
+ beo_FrameAddr,
+ beo_Barrier,
+ /* last backend node number */
+ beo_Last = beo_Barrier,
+ iro_MaxOpcode
+} ir_opcode;
+
+{% for node in nodes %}
+FIRM_API ir_op *op_{{node.name}};
+{%- endfor %}
+
+{% for node in nodes %}
+FIRM_API ir_op *get_op_{{node.name}}(void);
+{%- endfor %}
+
+#endif