added path to external
[libfirm] / ir / ir / irnode.c
index e6b93b0..e5a3da4 100644 (file)
@@ -106,11 +106,11 @@ new_ir_node (dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mo
   res = (ir_node *) obstack_alloc (irg->obst, node_size);
   memset((void *)res, 0, node_size);
 
-  res->kind = k_ir_node;
-  res->op = op;
-  res->mode = mode;
+  res->kind    = k_ir_node;
+  res->op      = op;
+  res->mode    = mode;
   res->visited = 0;
-  res->link = NULL;
+  res->link    = NULL;
   if (arity < 0) {
     res->in = NEW_ARR_F (ir_node *, 1);  /* 1: space for block */
   } else {
@@ -367,7 +367,7 @@ void set_irn_pinned(ir_node *node, op_pin_state state) {
   if (get_irn_op(node) == op_Tuple)
     return;
 
-  assert(node && get_op_pinned(get_irn_op(node)) == op_pin_state_exc_pinned);
+  assert(node && get_op_pinned(get_irn_op(node)) >= op_pin_state_exc_pinned);
   assert(state == op_pin_state_pinned || state == op_pin_state_floats);
 
   node->attr.except.pin_state = state;
@@ -445,13 +445,6 @@ get_irn_call_attr (ir_node *node)
   return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
 }
 
-type *
-get_irn_funccall_attr (ir_node *node)
-{
-  assert (node->op == op_FuncCall);
-  return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
-}
-
 sel_attr
 get_irn_sel_attr (ir_node *node)
 {
@@ -491,7 +484,7 @@ except_attr
 get_irn_except_attr (ir_node *node)
 {
   assert (node->op == op_Div || node->op == op_Quot ||
-          node->op == op_DivMod || node->op == op_Mod);
+          node->op == op_DivMod || node->op == op_Mod || node->op == op_Call || node->op == op_Alloc);
   return node->attr.except;
 }
 
@@ -566,9 +559,8 @@ get_Block_n_cfgpreds (ir_node *node) {
 
 ir_node *
 get_Block_cfgpred (ir_node *node, int pos) {
-  assert(node);
-  assert (node->op == op_Block);
   assert(-1 <= pos && pos < get_irn_arity(node));
+  assert(node->op == op_Block);
   return get_irn_n(node, pos);
 }
 
@@ -873,11 +865,6 @@ set_Const_type (ir_node *node, type *tp) {
     assert (is_atomic_type(tp));
     assert (get_type_mode(tp) == get_irn_mode(node));
   }
-
-  if ((get_irn_node_nr(node) == 259216) && (tp == unknown_type))
-    assert(0);
-
-
   node->attr.con.tp = tp;
 }
 
@@ -1192,95 +1179,6 @@ void  set_CallBegin_call (ir_node *node, ir_node *call) {
   node->attr.callbegin.call = call;
 }
 
-ir_node *
-get_FuncCall_ptr (ir_node *node) {
-  assert (node->op == op_FuncCall);
-  return get_irn_n(node, 0);
-}
-
-void
-set_FuncCall_ptr (ir_node *node, ir_node *ptr) {
-  assert (node->op == op_FuncCall);
-  set_irn_n(node, 0, ptr);
-}
-
-ir_node **
-get_FuncCall_param_arr (ir_node *node) {
-  assert (node->op == op_FuncCall);
-  return (ir_node **)&get_irn_in(node)[FUNCCALL_PARAM_OFFSET];
-}
-
-int
-get_FuncCall_n_params (ir_node *node)  {
-  assert (node->op == op_FuncCall);
-  return (get_irn_arity(node) - FUNCCALL_PARAM_OFFSET);
-}
-
-int
-get_FuncCall_arity (ir_node *node) {
-  assert (node->op == op_FuncCall);
-  return get_FuncCall_n_params(node);
-}
-
-/* void
-set_FuncCall_arity (ir_node *node, ir_node *arity) {
-  assert (node->op == op_FuncCall);
-}
-*/
-
-ir_node *
-get_FuncCall_param (ir_node *node, int pos) {
-  assert (node->op == op_FuncCall);
-  return get_irn_n(node, pos + FUNCCALL_PARAM_OFFSET);
-}
-
-void
-set_FuncCall_param (ir_node *node, int pos, ir_node *param) {
-  assert (node->op == op_FuncCall);
-  set_irn_n(node, pos + FUNCCALL_PARAM_OFFSET, param);
-}
-
-type *
-get_FuncCall_type (ir_node *node) {
-  assert (node->op == op_FuncCall);
-  return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
-}
-
-void
-set_FuncCall_type (ir_node *node, type *tp) {
-  assert (node->op == op_FuncCall);
-  assert (is_method_type(tp));
-  node->attr.call.cld_tp = tp;
-}
-
-int FuncCall_has_callees(ir_node *node) {
-  return ((get_irg_callee_info_state(get_irn_irg(node)) != irg_callee_info_none) &&
-      (node->attr.call.callee_arr != NULL));
-}
-
-int get_FuncCall_n_callees(ir_node * node) {
-  assert(node->op == op_FuncCall && node->attr.call.callee_arr);
-  return ARR_LEN(node->attr.call.callee_arr);
-}
-
-entity * get_FuncCall_callee(ir_node * node, int pos) {
-  assert(node->op == op_FuncCall && node->attr.call.callee_arr);
-  return node->attr.call.callee_arr[pos];
-}
-
-void set_FuncCall_callee_arr(ir_node * node, int n, entity ** arr) {
-  assert(node->op == op_FuncCall);
-  if (node->attr.call.callee_arr == NULL || get_Call_n_callees(node) != n) {
-    node->attr.call.callee_arr = NEW_ARR_D(entity *, current_ir_graph->obst, n);
-  }
-  memcpy(node->attr.call.callee_arr, arr, n * sizeof(entity *));
-}
-
-void remove_FuncCall_callee_arr(ir_node * node) {
-  assert(node->op == op_FuncCall);
-  node->attr.call.callee_arr = NULL;
-}
-
 
 #define BINOP(OP)                   \
 ir_node * get_##OP##_left(ir_node *node) {      \
@@ -1396,8 +1294,8 @@ set_Cast_type (ir_node *node, type *to_tp) {
 }
 
 int
-is_unop (ir_node *node) {
-  return (node->op->opar == oparity_unary);
+(is_unop)(const ir_node *node) {
+  return __is_unop(node);
 }
 
 ir_node *
@@ -1418,8 +1316,8 @@ set_unop_op (ir_node *node, ir_node *op) {
 }
 
 int
-is_binop (ir_node *node) {
-  return (node->op->opar == oparity_binary);
+(is_binop)(const ir_node *node) {
+  return __is_binop(node);
 }
 
 ir_node *
@@ -2030,30 +1928,25 @@ skip_Id (ir_node *node) {
 #endif
 
 int
-is_Bad (ir_node *node) {
-  assert(node);
-  if ((node) && get_irn_opcode(node) == iro_Bad)
-    return 1;
-  return 0;
+(is_Bad)(const ir_node *node) {
+  return __is_Bad(node);
 }
 
 int
-is_no_Block (ir_node *node) {
-  assert(node);
-  return (get_irn_opcode(node) != iro_Block);
+(is_no_Block)(const ir_node *node) {
+  return  __is_no_Block(node);
 }
 
 int
-is_Block (ir_node *node) {
-  assert(node);
-  return (get_irn_opcode(node) == iro_Block);
+(is_Block)(const ir_node *node) {
+  return __is_Block(node);
 }
 
 /* returns true if node is a Unknown node. */
 int
-is_Unknown (ir_node *node) {
+is_Unknown (const ir_node *node) {
   assert(node);
-  return (get_irn_opcode(node) == iro_Unknown);
+  return (get_irn_op(node) == op_Unknown);
 }
 
 int
@@ -2065,20 +1958,20 @@ is_Proj (const ir_node *node) {
 
 /* Returns true if the operation manipulates control flow. */
 int
-is_cfop(ir_node *node) {
+is_cfop(const ir_node *node) {
   return is_cfopcode(get_irn_op(node));
 }
 
 /* Returns true if the operation manipulates interprocedural control flow:
    CallBegin, EndReg, EndExcept */
-int is_ip_cfop(ir_node *node) {
+int is_ip_cfop(const ir_node *node) {
   return is_ip_cfopcode(get_irn_op(node));
 }
 
 /* Returns true if the operation can change the control flow because
    of an exception. */
 int
-is_fragile_op(ir_node *node) {
+is_fragile_op(const ir_node *node) {
   return is_op_fragile(get_irn_op(node));
 }
 
@@ -2107,7 +2000,7 @@ ir_node *get_fragile_op_mem(ir_node *node) {
 
 /* Returns true if the operation is a forking control flow operation. */
 int
-is_forking_op(ir_node *node) {
+is_forking_op(const ir_node *node) {
   return is_op_forking(get_irn_op(node));
 }