From 6c50ffd57d2b4ea7159ca22ee0b8c76e0fa32794 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 27 Oct 2005 13:49:56 +0000 Subject: [PATCH 1/1] dump_node operatiomn added get_op_ops() added [r6817] --- ir/ir/irop.c | 5 +++++ ir/ir/irop.h | 20 ++++++++++++++++++++ ir/ir/irop_t.h | 5 +++++ 3 files changed, 30 insertions(+) diff --git a/ir/ir/irop.c b/ir/ir/irop.c index 6f4832e4f..23e9d8907 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -391,3 +391,8 @@ op_func (get_generic_function_ptr)(const ir_op *op) { void (set_generic_function_ptr)(ir_op *op, op_func func) { _set_generic_function_ptr(op, func); } + +/* Returns the ir_op_ops of an ir_op. */ +const ir_op_ops *(get_op_ops)(const ir_op *op) { + return _get_op_ops(op); +} diff --git a/ir/ir/irop.h b/ir/ir/irop.h index b3a0de108..1c3d56506 100644 --- a/ir/ir/irop.h +++ b/ir/ir/irop.h @@ -263,6 +263,22 @@ 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 the node attributes */ +} 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. */ @@ -276,6 +292,7 @@ typedef struct { 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 */ + dump_node_func dump_node; /**< dump a node */ op_func generic; /**< a generic function */ } ir_op_ops; @@ -301,4 +318,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_ */ diff --git a/ir/ir/irop_t.h b/ir/ir/irop_t.h index 1b4b040f0..29f473e3f 100644 --- a/ir/ir/irop_t.h +++ b/ir/ir/irop_t.h @@ -120,9 +120,14 @@ static INLINE op_func _get_generic_function_ptr(const ir_op *op) { return op->ops.generic; } +static INLINE const ir_op_ops *_get_op_ops(const ir_op *op) { + return &op->ops; +} + #define get_op_code(op) _get_op_code(op) #define get_op_ident(op) _get_op_ident(op) #define get_op_pinned(op) _get_op_pinned(op) +#define get_op_ops(op) _get_op_ops(op) #endif /* _IROP_T_H_ */ -- 2.20.1