* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* memset belongs to string.h */
# include "string.h"
# include "irbackedge_t.h"
+# include "irflag_t.h"
#if USE_EXPLICIT_PHI_IN_STACK
/* A stack needed for the automatic Phi node construction in constructor
int i;
bool has_unknown = false;
- assert( get_Block_matured(block) );
- assert( get_irn_arity(block) == arity );
+ /* Don't assert that block matured: the use of this constructor is strongly
+ restricted ... */
+ if ( get_Block_matured(block) )
+ assert( get_irn_arity(block) == arity );
res = new_ir_node (db, irg, block, op_Phi, mode, arity, in);
ir_node *res;
int r_arity;
+ assert(ent != NULL && is_entity(ent) && "entity expected in Sel construction");
+
r_arity = arity + 2;
NEW_ARR_A (ir_node *, r_in, r_arity); /* uses alloca */
r_in[0] = store;
}
+ir_node *
+new_rd_FuncCall (dbg_info* db, ir_graph *irg, ir_node *block,
+ ir_node *callee, int arity, ir_node **in, type *tp)
+{
+ ir_node **r_in;
+ ir_node *res;
+ int r_arity;
+
+ r_arity = arity+1;
+ NEW_ARR_A (ir_node *, r_in, r_arity);
+ r_in[0] = callee;
+ memcpy (&r_in[1], in, sizeof (ir_node *) * arity);
+
+ res = new_ir_node (db, irg, block, op_FuncCall, mode_T, r_arity, r_in);
+
+ assert(is_method_type(tp));
+ set_FuncCall_type(res, tp);
+ res->attr.call.callee_arr = NULL;
+ res = optimize_node (res);
+ irn_vrfy_irg (res, irg);
+ return res;
+}
+
+
INLINE ir_node *new_r_Block (ir_graph *irg, int arity, ir_node **in) {
return new_rd_Block(NULL, irg, arity, in);
}
ir_mode *mode, long proj) {
return new_rd_Filter(NULL, irg, block, arg, mode, proj);
}
+INLINE ir_node *new_r_FuncCall (ir_graph *irg, ir_node *block,
+ ir_node *callee, int arity, ir_node **in,
+ type *tp) {
+ return new_rd_FuncCall(NULL, irg, block, callee, arity, in, tp);
+}
/** ********************/
*/
#if USE_EXPLICIT_PHI_IN_STACK
INLINE Phi_in_stack *
-new_Phi_in_stack() {
+new_Phi_in_stack(void) {
Phi_in_stack *res;
res = (Phi_in_stack *) malloc ( sizeof (Phi_in_stack));
static ir_node *
phi_merge (ir_node *block, int pos, ir_mode *mode, ir_node **nin, int ins);
-static INLINE ir_node **
-new_frag_arr (ir_node *n) {
+static INLINE ir_node ** new_frag_arr (ir_node *n)
+{
ir_node **arr;
int opt;
arr = NEW_ARR_D (ir_node *, current_ir_graph->obst, current_ir_graph->n_loc);
sizeof(ir_node *)*current_ir_graph->n_loc);
/* turn off optimization before allocating Proj nodes, as res isn't
finished yet. */
- opt = get_optimize(); set_optimize(0);
+ opt = get_opt_optimize(); set_optimize(0);
/* Here we rely on the fact that all frag ops have Memory as first result! */
if (get_irn_op(n) == op_Call)
arr[0] = new_Proj(n, mode_M, 3);
arg, mode, proj);
}
+ir_node *
+new_d_FuncCall (dbg_info* db, ir_node *callee, int arity, ir_node **in,
+ type *tp)
+{
+ ir_node *res;
+ res = new_rd_FuncCall (db, current_ir_graph, current_ir_graph->current_block,
+ callee, arity, in, tp);
+
+ return res;
+}
+
/* ********************************************************************* */
/* Comfortable interface with automatic Phi node construction. */
/* (Uses also constructors of ?? interface, except new_Block. */
ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj) {
return new_d_Filter(NULL, arg, mode, proj);
}
+ir_node *new_FuncCall (ir_node *callee, int arity, ir_node **in, type *tp) {
+ return new_d_FuncCall(NULL, callee, arity, in, tp);
+}