Fixed 'inline' lossage --flo
[libfirm] / ir / ir / ircons.c
index 7975e95..070168c 100644 (file)
@@ -11,7 +11,6 @@
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -29,6 +28,7 @@
 /* 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
@@ -103,8 +103,10 @@ new_rd_Phi (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in
   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);
 
@@ -635,6 +637,8 @@ new_rd_Sel (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store, ir_node
   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;
@@ -808,6 +812,30 @@ new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg, ir_mod
 
 }
 
+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);
 }
@@ -996,6 +1024,11 @@ INLINE ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
                       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);
+}
 
 
 /** ********************/
@@ -1113,7 +1146,7 @@ new_rd_Phi0 (ir_graph *irg, ir_node *block, ir_mode *mode)
 */
 #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));
@@ -1483,8 +1516,8 @@ get_r_value_internal (ir_node *block, int pos, ir_mode *mode);
 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);
@@ -1492,7 +1525,7 @@ new_frag_arr (ir_node *n) {
         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);
@@ -2208,6 +2241,17 @@ new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj)
                        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.            */
@@ -2508,3 +2552,6 @@ ir_node *new_Break  (void) {
 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);
+}