res = new_ir_node (db, irg, block, op_FuncCall, mode_T, r_arity, r_in);
assert(is_method_type(tp));
- set_Call_type(res, tp);
+ set_FuncCall_type(res, tp);
res->attr.call.callee_arr = NULL;
res = optimize_node (res);
irn_vrfy_irg (res, irg);
node->attr.callbegin.call = call;
}
+INLINE ir_node *
+get_FuncCall_ptr (ir_node *node) {
+ assert (node->op == op_FuncCall);
+ return get_irn_n(node, 0);
+}
+
+INLINE void
+set_FuncCall_ptr (ir_node *node, ir_node *ptr) {
+ assert (node->op == op_FuncCall);
+ set_irn_n(node, 0, ptr);
+}
+
+INLINE ir_node **
+get_FuncCall_param_arr (ir_node *node) {
+ assert (node->op == op_FuncCall);
+ return (ir_node **)&get_irn_in(node)[CALL_PARAM_OFFSET];
+}
+
+INLINE int
+get_FuncCall_n_params (ir_node *node) {
+ assert (node->op == op_FuncCall);
+ return (get_irn_arity(node) - CALL_PARAM_OFFSET);
+}
+
+INLINE int
+get_FuncCall_arity (ir_node *node) {
+ assert (node->op == op_FuncCall);
+ return get_FuncCall_n_params(node);
+}
+
+/* INLINE void
+set_FuncCall_arity (ir_node *node, ir_node *arity) {
+ assert (node->op == op_FuncCall);
+}
+*/
+
+INLINE ir_node *
+get_FuncCall_param (ir_node *node, int pos) {
+ assert (node->op == op_FuncCall);
+ return get_irn_n(node, pos + CALL_PARAM_OFFSET);
+}
+
+INLINE void
+set_FuncCall_param (ir_node *node, int pos, ir_node *param) {
+ assert (node->op == op_FuncCall);
+ set_irn_n(node, pos + CALL_PARAM_OFFSET, param);
+}
+
+INLINE 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);
+}
+
+INLINE 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 (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) { \
assert(node->op == op_##OP); \
ir_node *get_CallBegin_call (ir_node *node);
void set_CallBegin_call (ir_node *node, ir_node *call);
+INLINE ir_node *get_FuncCall_ptr (ir_node *node);
+INLINE void set_FuncCall_ptr (ir_node *node, ir_node *ptr);
+INLINE ir_node **get_FuncCall_param_arr (ir_node *node);
+/** Gets the number of parameters of a func call. */
+INLINE int get_FuncCall_n_params (ir_node *node);
+/** Gets the func call parameter at position pos. */
+INLINE ir_node *get_FuncCall_param (ir_node *node, int pos);
+/** Sets the func call parameter at position pos. */
+INLINE void set_FuncCall_param (ir_node *node, int pos, ir_node *param);
+/** Gets the type of a func call. */
+INLINE type *get_FuncCall_type (ir_node *node);
+/** Sets the type of a func call. */
+INLINE void set_FuncCall_type (ir_node *node, type *tp);
+/** Gets the arity of a func call. Identical to get_FuncCall_n_params(). */
+INLINE int get_FuncCall_arity (ir_node *node);
+
+/* Set, get and remove the callee-analysis.
+ The array is only accessible if information is valid.
+ It contains NULL for called methods that are not within
+ the compilation unit. */
+int FuncCall_has_callees (ir_node *node);
+int get_FuncCall_n_callees (ir_node * node);
+entity *get_FuncCall_callee (ir_node * node, int pos);
+/* assumes current_ir_graph set properly! */
+void set_FuncCall_callee_arr (ir_node * node, int n, entity ** arr);
+void remove_FuncCall_callee_arr(ir_node * node);
+
/* For unary and binary arithmetic operations the access to the
operands can be factored out. Left is the first, right the
second arithmetic value as listed in tech report 1999-44.
);
break;
+ case iro_FuncCall:
+ ASSERT_AND_RET_DBG(
+ ((proj == pn_Call_M_regular && mode == mode_M) ||
+ (proj == pn_Call_X_except && mode == mode_X) ||
+ (proj == pn_Call_T_result && mode == mode_T) ||
+ (proj == pn_Call_M_except && mode == mode_M) ||
+ (proj == pn_Call_P_value_res_base && mode == mode_P)),
+ "wrong Proj from FuncCall", 0,
+ show_proj_failure(p);
+ );
+ break;
+
case iro_Quot:
ASSERT_AND_RET_DBG(
((proj == pn_Quot_M && mode == mode_M) ||
}
break;
+ case iro_FuncCall:
+ {
+ ASSERT_AND_RET(
+ (proj >= 0 && mode_is_data(mode)),
+ "wrong Proj from Proj from FuncCall", 0);
+ mt = get_FuncCall_type(pred);
+ ASSERT_AND_RET(
+ (proj < get_method_n_ress(mt)),
+ "More Projs for results than results in type.", 0);
+ if ((mode_is_reference(mode)) && is_compound_type(get_method_res_type(mt, proj)))
+ /* value result */ break;
+
+ ASSERT_AND_RET(
+ (mode == get_type_mode(get_method_res_type(mt, proj))),
+ "Mode of Proj from FuncCall doesn't match mode of result type.", 0);
+ }
+ break;
+
case iro_Tuple:
/* We don't test */
break;