** by Goetz Lindenmaier
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
# include "irgraph_t.h"
# include "irnode_t.h"
+# include "irmode_t.h"
# include "ircons.h"
# include "common.h"
# include "irvrfy.h"
typedef struct Phi_in_stack Phi_in_stack;
#endif
-/*********************************************** */
+/*** ******************************************** */
/** privat interfaces, for professional use only */
/* Constructs a Block with a fixed number of predecessors.
return current_ir_graph->bad;
}
-/***********************/
+/** ********************/
/** public interfaces */
/** construction tools */
+/****f* ircons/new_Start
+ *
+ * NAME
+ * new_Start -- create a new Start node in the current block
+ *
+ * SYNOPSIS
+ * s = new_Start(void);
+ * ir_node* new_Start(void);
+ *
+ * RESULT
+ * s - pointer to the created Start node
+ *
+ ****
+ */
ir_node *
new_Start (void)
{
return res;
}
-#if 0
/* Constructs a Block with a fixed number of predecessors.
Does set current_block. Can be used with automatic Phi
node construction. */
{
ir_node *res;
- res = new_r_Block (arity, in);
+ res = new_r_Block (current_ir_graph, arity, in);
current_ir_graph->current_block = res;
/* Create and initialize array for Phi-node construction. */
res->attr.block.graph_arr = NEW_ARR_D (ir_node *, current_ir_graph->obst,
- current_ir_graph->params);
- memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->params);
+ current_ir_graph->n_loc);
+ memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
res = optimize (res);
irn_vrfy (res);
return res;
}
-#else
-ir_node *
-new_Block (void)
-{
- return new_immBlock();
-}
-#endif
-/*************************************************************************/
+/* ***********************************************************************/
/* Methods necessary for automatic Phi node creation */
/*
ir_node *phi_merge (ir_node *block, int pos, ir_mode *mode, ir_node **nin, int ins)
\|/ \|/
new_r_Phi0 new_r_Phi_in
-*****************************************************************************/
+* *************************************************************************** */
/* Creates a Phi node with 0 predecessors */
inline ir_node *
#endif /* USE_FAST_PHI_CONSTRUCTION */
-/****************************************************************************/
+/* ************************************************************************** */
/** Finalize a Block node, when all control flows are known. */
/** Acceptable parameters are only Block nodes. */
/* turn the dynamic in-array into a static one. */
ins = ARR_LEN (block->in)-1;
NEW_ARR_A (ir_node *, nin, ins);
+ /* @@@ something is strange here... why isn't the array copied? */
/* Traverse a chain of Phi nodes attached to this block and mature
these, too. **/
return current_ir_graph->bad;
}
-/*************************************************************************/
+/* ********************************************************************* */
/* Comfortable interface with automatic Phi node construction. */
/* (Uses also constructors of ?? interface, except new_Block. */
-/*************************************************************************/
+/* ********************************************************************* */
/** Block construction **/
/* immature Block without predecessors */
/* Create and initialize array for Phi-node construction. */
res->attr.block.graph_arr = NEW_ARR_D (ir_node *, current_ir_graph->obst,
- current_ir_graph->params);
- memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->params);
+ current_ir_graph->n_loc);
+ memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
/* Immature block may not be optimized! */
irn_vrfy (res);
current_ir_graph->current_block = target;
}
-/****************************/
+/* ************************ */
/* parameter administration */
/* get a value from the parameter array from the current block by its index */
current_ir_graph->current_block->attr.block.graph_arr[0] = store;
}
-/*************************************************************************/
+/* ********************************************************************* */
/* initialize */
/* call once for each run of the library */