unsigned get_next_ir_opcode(void) {
return next_iro++;
}
+
+/* Returns the generic function pointer from an ir operation. */
+op_func (get_generic_function_ptr)(const ir_op *op) {
+ return _get_generic_function_ptr(op);
+}
+
+/* Store a generic function pointer into an ir operation. */
+void (set_generic_function_ptr)(ir_op *op, op_func func) {
+ _set_generic_function_ptr(op, func);
+}
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);
+/**
+ * A generic function pointer.
+ */
+typedef void (*op_func)(void);
+
+/** The NULL-function. */
+#define NULL_FUNC ((generic_func)(NULL))
+
+/**
+ * Returns the generic function pointer from an ir operation.
+ */
+op_func get_generic_function_ptr(const ir_op *op);
+
+/**
+ * Store a generic function pointer into an ir operation.
+ */
+void set_generic_function_ptr(ir_op *op, op_func func);
+
# endif /* _IROP_H_ */
unsigned flags; /**< flags describing the behavior of the ir_op, a bitmaks of irop_flags */
/* CallBacks */
- computed_value_func computed_value; /**< evaluates a node into a tarval if possible. */
+ 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. */
get_type_func get_type; /**< return the type of a node */
verify_node_func verify_node; /**< verify the node */
verify_proj_node_func verify_proj_node; /**< verify the Proj node */
+ op_func generic; /**< a generic function */
};
/**
return op->op_pin_state_pinned;
}
+static INLINE void _set_generic_function_ptr(ir_op *op, op_func func) {
+ op->generic = func;
+}
+
+static INLINE op_func _get_generic_function_ptr(const ir_op *op) {
+ return op->generic;
+}
#define get_op_code(op) _get_op_code(op)
#define get_op_ident(op) _get_op_ident(op)