Added new type opcode "id".
[libfirm] / ir / ir / irop.c
index a4b356c..df22bf8 100644 (file)
@@ -5,6 +5,10 @@
 **
 */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 # include "irop_t.h"
 # include "irnode_t.h"
 # include "misc.h"
@@ -82,7 +86,7 @@ init_op(void)
   op_Start = new_ir_op (iro_Start, id_from_str ("Start", 5), sizeof (block_attr), 1);
   op_End = new_ir_op (iro_End, id_from_str ("End", 3), sizeof (block_attr), 1);
   op_Jmp    = new_ir_op (iro_Jmp, id_from_str ("Jmp", 3), 0, 0);
-  op_Cond   = new_ir_op (iro_Cond, id_from_str ("Cond", 4), 0, 1);
+  op_Cond   = new_ir_op (iro_Cond, id_from_str ("Cond", 4), sizeof(cond_attr), 1);
   op_Return = new_ir_op (iro_Return, id_from_str ("Return", 6), 0, 1);
   op_Raise  = new_ir_op (iro_Raise, id_from_str ("Raise", 5), 0, 1);
 
@@ -92,7 +96,7 @@ init_op(void)
 
   op_Sel = new_ir_op (iro_Sel, id_from_str ("Sel", 3), sizeof (sel_attr), 1);
 
-  op_Call = new_ir_op (iro_Call, id_from_str ("Call", 4), sizeof (type_method *), 1);
+  op_Call = new_ir_op (iro_Call, id_from_str ("Call", 4), sizeof (type *), 1);
   op_Add = new_ir_op (iro_Add, id_from_str ("Add", 3), 0, 0);
   op_Minus = new_ir_op (iro_Minus, id_from_str ("Minus", 5), 0, 0);
   op_Sub = new_ir_op (iro_Sub, id_from_str ("Sub", 3), 0, 1);
@@ -127,6 +131,19 @@ init_op(void)
   op_Bad   = new_ir_op (iro_Bad,   id_from_str ("Bad", 3), 0, 0);
 }
 
+/* Returns the string for the opcode. */
+const char  *get_op_name      (ir_op *op) {
+  return id_to_str(op->name);
+}
+
+opcode get_op_code (ir_op *op){
+  return op->code;
+}
+
+ident *get_op_ident(ir_op *op){
+  return op->name;
+}
+
 /* returns the attribute size of the operator. */
 int get_op_attr_size (ir_op *op) {
   return op->attr_size;