little cleanup
[libfirm] / ir / ir / irop.h
index b3a0de1..ac8eeaa 100644 (file)
@@ -25,6 +25,8 @@
 #define _IROP_H_
 
 #include "firm_types.h"
+
+#include <stdio.h>
 #include "ident.h"
 
 /** The allowed parities */
@@ -243,7 +245,21 @@ typedef void (*copy_attr_func)(const ir_node *old_node, ir_node *new_node);
  * The get_type operation.
  * Return the type of the node self.
  */
-typedef type *(*get_type_func)(ir_node *self);
+typedef ir_type *(*get_type_func)(ir_node *self);
+
+/**
+ * The get_type_attr operation. Used to traverse all types that can be
+ * accessed from an ir_graph.
+ * Return the type attribute of the node self.
+ */
+typedef ir_type *(*get_type_attr_func)(ir_node *self);
+
+/**
+ * The get_entity_attr operation. Used to traverse all entities that can be
+ * accessed from an ir_graph.
+ * Return the entity attribute of the node self.
+ */
+typedef entity *(*get_entity_attr_func)(ir_node *self);
 
 /**
  * The verify_node operation.
@@ -263,19 +279,39 @@ typedef int (*verify_node_func)(ir_node *self, ir_graph *irg);
  */
 typedef int (*verify_proj_node_func)(ir_node *self, ir_node *proj);
 
+/**
+ * Reasons to call the dump_node operation:
+ */
+typedef enum {
+  dump_node_opcode_txt,   /**< dump the opcode */
+  dump_node_mode_txt,     /**< dump the mode */
+  dump_node_nodeattr_txt, /**< dump node attributes to be shown in the label */
+  dump_node_info_txt      /**< dump node attributes into info1 */
+} dump_reason_t;
+
+/**
+ * The dump_node operation.
+ * Writes several informations requested by reason to
+ * an output file
+ */
+typedef int (*dump_node_func)(ir_node *self, FILE *F, dump_reason_t reason);
+
 /**
  * io_op Operations.
  */
 typedef struct {
-  computed_value_func    computed_value;               /**< evaluates a node into a tarval if possible. */
-  equivalent_node_func  equivalent_node;       /**< optimizes the node by returning an equivalent one. */
-  transform_node_func   transform_node;                /**< optimizes the node by transforming it. */
-  node_cmp_attr_func    node_cmp_attr;         /**< compares two node attributes. */
+  computed_value_func    computed_value;   /**< evaluates a node into a tarval if possible. */
+  equivalent_node_func  equivalent_node;  /**< optimizes the node by returning an equivalent one. */
+  transform_node_func   transform_node;   /**< optimizes the node by transforming it. */
+  node_cmp_attr_func    node_cmp_attr;    /**< compares two node attributes. */
   reassociate_func      reassociate;      /**< reassociate a tree */
   copy_attr_func        copy_attr;        /**< copy node attributes */
   get_type_func         get_type;         /**< return the type of a node */
+  get_type_attr_func    get_type_attr;    /**< return the type attribute of a node */
+  get_entity_attr_func  get_entity_attr;  /**< return the entity attribute of a node */
   verify_node_func      verify_node;      /**< verify the node */
   verify_proj_node_func verify_proj_node; /**< verify the Proj node */
+  dump_node_func        dump_node;        /**< dump a node */
   op_func               generic;          /**< a generic function */
 } ir_op_ops;
 
@@ -301,4 +337,7 @@ ir_op * new_ir_op(opcode code, const char *name, op_pin_state p,
                   unsigned flags, op_arity opar, int op_index, size_t attr_size,
        const ir_op_ops *ops);
 
+/** Returns the ir_op_ops of an ir_op. */
+const ir_op_ops *get_op_ops(const ir_op *op);
+
 #endif /* _IROP_H_ */