From 08b30f43eef4fca6e1455842b34f1f7b62ecf5b2 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Fri, 27 Jan 2006 17:46:55 +0000 Subject: [PATCH] is_irn_keep() added fixed get_irn_type(), must return unknown_type instead of NULL [r7283] --- ir/ir/irnode.c | 21 +++++++++++++++++---- ir/ir/irnode.h | 8 +++++++- ir/ir/irnode_t.h | 5 +++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 1805970f2..f2314c395 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -2394,6 +2394,14 @@ int (is_irn_constlike)(const ir_node *node) { return _is_irn_constlike(node); } +/* + * Returns non-zero for nodes that are allowed to have keep-alives and + * are neither Block nor PhiM. + */ +int (is_irn_keep)(const ir_node *node) { + return _is_irn_keep(node); +} + /* Gets the string representation of the jump prediction .*/ const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred) { @@ -2415,9 +2423,9 @@ void (set_Cond_jmp_pred)(ir_node *cond, cond_jmp_predicate pred) { _set_Cond_jmp_pred(cond, pred); } -/** the get_type/get_type_attr operation must be always implemented */ -static ir_type *get_Null_type(ir_node *n) { - return NULL; +/** the get_type operation must be always implemented and return a firm type */ +static ir_type *get_Default_type(ir_node *n) { + return get_unknown_type(); } /* Sets the get_type operation for an ir_op_ops. */ @@ -2431,7 +2439,7 @@ ir_op_ops *firm_set_default_get_type(opcode code, ir_op_ops *ops) default: /* not allowed to be NULL */ if (! ops->get_type) - ops->get_type = get_Null_type; + ops->get_type = get_Default_type; break; } return ops; @@ -2453,6 +2461,11 @@ static entity *get_SymConst_attr_entity(ir_node *self) { return NULL; } +/** the get_type_attr operation must be always implemented */ +static ir_type *get_Null_type(ir_node *n) { + return firm_unknown_type; +} + /* Sets the get_type operation for an ir_op_ops. */ ir_op_ops *firm_set_default_get_type_attr(opcode code, ir_op_ops *ops) { diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index b5c1bf60d..99526c8e0 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -1054,7 +1054,7 @@ int is_irn_forking(const ir_node *node); /** Return the type associated with the value produced by n * if the node remarks this type as it is the case for - * Cast, Const, SymConst and some Proj nodes. */ + * Cast, Const, SymConst and some Proj nodes or unknown_type. */ ir_type *get_irn_type(ir_node *n); /** Return the type attribute of a node n (SymConst, Call, Alloc, Free, @@ -1067,6 +1067,12 @@ entity *get_irn_entity_attr(ir_node *n); /** Returns non-zero for constant-like nodes. */ int is_irn_constlike(const ir_node *node); +/** + * Returns non-zero for nodes that are allowed to have keep-alives and + * are neither Block nor PhiM. + */ +int is_irn_keep(const ir_node *node); + /** * A type to express conditional jump predictions. */ diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index fa1cf226f..d03784de9 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -727,6 +727,10 @@ static INLINE int _is_irn_constlike(const ir_node *node) { return is_op_constlike(_get_irn_op(node)); } +static INLINE int _is_irn_keep(const ir_node *node) { + return is_op_keep(_get_irn_op(node)); +} + static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) { assert (_get_irn_op(node) == op_Cond); return node->attr.c.pred; @@ -781,6 +785,7 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) { #define get_irn_type_attr(node) _get_irn_type_attr(node) #define get_irn_entity_attr(node) _get_irn_entity_attr(node) #define is_irn_constlike(node) _is_irn_constlike(node) +#define is_irn_keep(node) _is_irn_keep(node) #define get_Cond_jmp_pred(node) _get_Cond_jmp_pred(node) #define set_Cond_jmp_pred(node, pred) _set_Cond_jmp_pred(node, pred) -- 2.20.1