From 7b1131525a9e780a071111cacdc6e0586b007e22 Mon Sep 17 00:00:00 2001 From: Sebastian Felis Date: Mon, 14 Jul 2003 10:04:42 +0000 Subject: [PATCH] add is_ir_node() function. [r1479] --- ir/ir/irnode.c | 9 +++++++++ ir/ir/irnode.h | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index c3d95dc22..9baf74ee1 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -137,6 +137,15 @@ copy_attrs (ir_node *old, ir_node *new) { /** getting some parameters from ir_nodes **/ +int +is_ir_node (void *thing) { + assert(thing); + if (get_kind(thing) == k_ir_node) + return 1; + else + return 0; +} + /* returns the number of predecessors without the block predecessor. */ INLINE int get_irn_arity (const ir_node *node) { diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index 79a5ea035..37a99a6fa 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -82,6 +82,17 @@ typedef struct ir_node ir_node; * of nodes, it's just a big graph. */ +/** + * Checks whether a pointer points to a ir node. + * + * @param thing an arbitrary pointer + * + * @return + * true if the thing is a ir mode, else false + */ +int +is_ir_node (void *thing); + /** returns the number of predecessors without the block predecessor: */ int get_irn_arity (const ir_node *node); -- 2.20.1