Fixed some typos.
[libfirm] / ir / ir / irnode.c
index d276225..770e797 100644 (file)
 
 /* some constants fixing the positions of nodes predecessors
    in the in array */
-#define CALL_PARAM_OFFSET     2
-#define BUILDIN_PARAM_OFFSET  1
-#define SEL_INDEX_OFFSET      2
-#define RETURN_RESULT_OFFSET  1  /* mem is not a result */
+#define CALL_PARAM_OFFSET     (n_Call_max+1)
+#define BUILTIN_PARAM_OFFSET  (n_Builtin_max+1)
+#define SEL_INDEX_OFFSET      (n_Sel_max+1)
+#define RETURN_RESULT_OFFSET  (n_Return_max+1)
 #define END_KEEPALIVE_OFFSET  0
 
 static const char *relation_names [] = {
@@ -989,25 +989,25 @@ void set_Call_param(ir_node *node, int pos, ir_node *param)
 ir_node **get_Builtin_param_arr(ir_node *node)
 {
        assert(is_Builtin(node));
-       return &get_irn_in(node)[BUILDIN_PARAM_OFFSET + 1];
+       return &get_irn_in(node)[BUILTIN_PARAM_OFFSET + 1];
 }
 
 int get_Builtin_n_params(const ir_node *node)
 {
        assert(is_Builtin(node));
-       return (get_irn_arity(node) - BUILDIN_PARAM_OFFSET);
+       return (get_irn_arity(node) - BUILTIN_PARAM_OFFSET);
 }
 
 ir_node *get_Builtin_param(const ir_node *node, int pos)
 {
        assert(is_Builtin(node));
-       return get_irn_n(node, pos + BUILDIN_PARAM_OFFSET);
+       return get_irn_n(node, pos + BUILTIN_PARAM_OFFSET);
 }
 
 void set_Builtin_param(ir_node *node, int pos, ir_node *param)
 {
        assert(is_Builtin(node));
-       set_irn_n(node, pos + BUILDIN_PARAM_OFFSET, param);
+       set_irn_n(node, pos + BUILTIN_PARAM_OFFSET, param);
 }
 
 /* Returns a human readable string for the ir_builtin_kind. */
@@ -1328,6 +1328,20 @@ int is_x_regular_Proj(const ir_node *node)
        return get_Proj_proj(node) == pred->op->pn_x_regular;
 }
 
+void ir_set_throws_exception(ir_node *node, int throws_exception)
+{
+       except_attr *attr = &node->attr.except;
+       assert(is_fragile_op(node));
+       attr->throws_exception = throws_exception;
+}
+
+int ir_throws_exception(const ir_node *node)
+{
+       const except_attr *attr = &node->attr.except;
+       assert(is_fragile_op(node));
+       return attr->throws_exception;
+}
+
 ir_node **get_Tuple_preds_arr(ir_node *node)
 {
        assert(is_Tuple(node));
@@ -1524,6 +1538,9 @@ int (is_SymConst_addr_ent)(const ir_node *node)
 /* Returns true if the operation manipulates control flow. */
 int is_cfop(const ir_node *node)
 {
+       if (is_fragile_op(node) && ir_throws_exception(node))
+               return true;
+
        return is_op_cfopcode(get_irn_op(node));
 }