+if (length($arch) >= 3) {
+ $c = uc(substr($arch, 2, 1));
+}
+
+if (length($arch) >= 4) {
+ $d = uc(substr($arch, 3, 1));
+}
+
+print OUT "static unsigned $arch\_op_tag = FOURCC('$a', '$b', '$c', '$d');\n";
+
+print OUT<<ENDOFISIRN;
+
+/** Return the opcode number of the first $arch opcode. */
+int get_$arch\_opcode_first(void) {
+ return $arch\_opcode_start;
+}
+
+/** Return the opcode number of the last $arch opcode + 1. */
+int get_$arch\_opcode_last(void) {
+ return $arch\_opcode_end;
+}
+
+/** Return 1 if the given node is a $arch machine node, 0 otherwise */
+int is_$arch\_irn(const ir_node *node) {
+ return get_op_tag(get_irn_op(node)) == &$arch\_op_tag;
+}
+
+int get_$arch\_irn_opcode(const ir_node *node) {
+ if (is_$arch\_irn(node))
+ return get_irn_opcode(node) - $arch\_opcode_start;
+ return -1;