Commit 08b30f43 authored by Michael Beck's avatar Michael Beck
Browse files

is_irn_keep() added

fixed get_irn_type(), must return unknown_type instead of NULL

[r7283]
parent 93a94589
...@@ -2394,6 +2394,14 @@ int (is_irn_constlike)(const ir_node *node) { ...@@ -2394,6 +2394,14 @@ int (is_irn_constlike)(const ir_node *node) {
return _is_irn_constlike(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 .*/ /* Gets the string representation of the jump prediction .*/
const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred) 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) { ...@@ -2415,9 +2423,9 @@ void (set_Cond_jmp_pred)(ir_node *cond, cond_jmp_predicate pred) {
_set_Cond_jmp_pred(cond, pred); _set_Cond_jmp_pred(cond, pred);
} }
/** the get_type/get_type_attr operation must be always implemented */ /** the get_type operation must be always implemented and return a firm type */
static ir_type *get_Null_type(ir_node *n) { static ir_type *get_Default_type(ir_node *n) {
return NULL; return get_unknown_type();
} }
/* Sets the get_type operation for an ir_op_ops. */ /* 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) ...@@ -2431,7 +2439,7 @@ ir_op_ops *firm_set_default_get_type(opcode code, ir_op_ops *ops)
default: default:
/* not allowed to be NULL */ /* not allowed to be NULL */
if (! ops->get_type) if (! ops->get_type)
ops->get_type = get_Null_type; ops->get_type = get_Default_type;
break; break;
} }
return ops; return ops;
...@@ -2453,6 +2461,11 @@ static entity *get_SymConst_attr_entity(ir_node *self) { ...@@ -2453,6 +2461,11 @@ static entity *get_SymConst_attr_entity(ir_node *self) {
return NULL; 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. */ /* 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) ir_op_ops *firm_set_default_get_type_attr(opcode code, ir_op_ops *ops)
{ {
......
...@@ -1054,7 +1054,7 @@ int is_irn_forking(const ir_node *node); ...@@ -1054,7 +1054,7 @@ int is_irn_forking(const ir_node *node);
/** Return the type associated with the value produced by n /** Return the type associated with the value produced by n
* if the node remarks this type as it is the case for * 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); ir_type *get_irn_type(ir_node *n);
/** Return the type attribute of a node n (SymConst, Call, Alloc, Free, /** Return the type attribute of a node n (SymConst, Call, Alloc, Free,
...@@ -1067,6 +1067,12 @@ entity *get_irn_entity_attr(ir_node *n); ...@@ -1067,6 +1067,12 @@ entity *get_irn_entity_attr(ir_node *n);
/** Returns non-zero for constant-like nodes. */ /** Returns non-zero for constant-like nodes. */
int is_irn_constlike(const ir_node *node); 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. * A type to express conditional jump predictions.
*/ */
......
...@@ -727,6 +727,10 @@ static INLINE int _is_irn_constlike(const ir_node *node) { ...@@ -727,6 +727,10 @@ static INLINE int _is_irn_constlike(const ir_node *node) {
return is_op_constlike(_get_irn_op(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) { static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) {
assert (_get_irn_op(node) == op_Cond); assert (_get_irn_op(node) == op_Cond);
return node->attr.c.pred; return node->attr.c.pred;
...@@ -781,6 +785,7 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate 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_type_attr(node) _get_irn_type_attr(node)
#define get_irn_entity_attr(node) _get_irn_entity_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_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 get_Cond_jmp_pred(node) _get_Cond_jmp_pred(node)
#define set_Cond_jmp_pred(node, pred) _set_Cond_jmp_pred(node, pred) #define set_Cond_jmp_pred(node, pred) _set_Cond_jmp_pred(node, pred)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment