} break;
case iro_CallBegin: {
ir_node *call = get_CallBegin_call(n);
+ fprintf(F, "Call: %ld\n", get_irn_node_nr(call));
if (Call_has_callees(call)) {
fprintf(F, "possible callees: \n");
for (i = 0; i < get_Call_n_callees(call); i++) {
and optimization.
*/
ir_graph *
-new_ir_graph (entity *ent, int n_loc)
+new_r_ir_graph (entity *ent, int n_loc)
{
ir_graph *res;
ir_node *first_block;
stat_new_graph(res, ent);
current_ir_graph = res;
- add_irp_irg(res); /* remember this graph global. */
/*-- initialized for each graph. --*/
if (get_opt_precise_exc_context()) {
}
+ir_graph *
+new_ir_graph (entity *ent, int n_loc)
+{
+ ir_graph *res = new_r_ir_graph (ent, n_loc);
+ add_irp_irg(res); /* remember this graph global. */
+ return res;
+}
+
/* Make a rudimentary ir graph for the constant code.
Must look like a correct irg, spare everything else. */
ir_graph *new_const_code_irg(void) {
(inc_irg_block_visited)(ir_graph *irg) {
__inc_irg_block_visited(irg);
}
-
-/* is irg a pseudo graph for analysis? */
-int is_pseudo_ir_graph(ir_graph *irg)
-{
- int res = false;
- entity *ent;
-
- assert(irg && "nothing here");
- assert(is_ir_graph(irg) && "no ir_graph given");
-
- ent = get_irg_entity(irg);
- if(visibility_external_allocated == get_entity_visibility(ent)
- && peculiarity_existent == get_entity_peculiarity(ent)) {
- res = true;
- }
- return(res);
-}
int get_interprocedural_view(void);
void set_interprocedural_view(int state);
-/** Create a new ir graph to built ir for a procedure.
+/** Create a new ir graph to build ir for a procedure.
*
* ent is the entity representing this procedure, i.e., the type of the
* entity must be of a method type. The constructor automatically sets the
* n_loc is the number of local variables in this procedure including
* the procedure parameters.
* The constructor adds the new irgraph to the list in ir_prog.
- * The state of the ir graph is: phase_building, op_pin_state_pinned, outs_none. */
+ * The state of the ir graph is: phase_building, op_pin_state_pinned, outs_none.
+ *
+ * @see new_pseudo_ir_graph() */
ir_graph *new_ir_graph (entity *ent, int n_loc);
/** Frees the passed irgraph.
unsigned long get_irg_block_visited (const ir_graph *irg);
void set_irg_block_visited (ir_graph *irg, unsigned long i);
-/* is irg a pseudo graph for analysis? */
-int is_pseudo_ir_graph(ir_graph *irg);
-
# endif /* _IRGRAPH_H_ */
#include "firm_common_t.h"
#include "irtypeinfo.h"
#include "irprog.h"
+#include "pseudo_irg.h"
#include "irloop.h"
*/
void init_irgraph(void);
+/* Internal constructor that does not add to irp_irgs or the like. */
+ir_graph *new_r_ir_graph (entity *ent, int n_loc);
+
/** Make a rudimentary ir graph for the constant code.
Must look like a correct irg, spare everything else. */
ir_graph *new_const_code_irg(void);
# include "irprog_t.h"
# include "irgraph_t.h"
+# include "pseudo_irg.h"
# include "array.h"
# include "obst.h"
# include "typegmod.h"
memset(res, 0, sizeof(res));
irp = res;
/* res->obst = (struct obstack *) xmalloc (sizeof (struct obstack)); */
- res->graphs = NEW_ARR_F (ir_graph *, 0);
+ res->graphs = NEW_ARR_F (ir_graph *, 0);
+ res->pseudo_graphs = NEW_ARR_F (ir_graph *, 0);
res->types = NEW_ARR_F (type *, 0);
res->name = new_id_from_str(INITAL_PROG_NAME);
irp->graphs[pos] = irg;
}
+/* Gets the number of graphs _and_ pseudo graphs. */
+int get_irp_n_allirgs(void) {
+ /* We can not call get_irp_n_irgs, as we end up in a recursion ... */
+ return ARR_LEN((irp)->graphs) + get_irp_n_pseudo_irgs();
+}
+
+/* Returns the ir graph at position pos of all graphs (including
+ pseudo graphs). Visits first graphs, then pseudo graphs. */
+ir_graph *get_irp_allirg(int pos) {
+ int n_irgs = get_irp_n_irgs();
+ if (pos < n_irgs)
+ return (irp)->graphs[pos];
+ else
+ return get_irp_pseudo_irg(pos-n_irgs);
+}
+
+
/* Adds type to the list of types in irp. */
void add_irp_type(type *typ) {
assert (typ != NULL);
/** Sets the ir graph at position pos. */
void set_irp_irg(int pos, ir_graph *irg);
+/** Gets the number of graphs _and_ pseudo graphs. */
+int get_irp_n_allirgs(void);
+
+/** Returns the ir graph at position pos of all graphs (including
+ pseudo graphs). Visits first graphs, then pseudo graphs. */
+ir_graph *get_irp_allirg(int pos);
+
/** Returns the "global" type of the irp. */
type *get_glob_type(void);
#include "irprog.h"
#include "irgraph.h"
+#include "pseudo_irg.h"
#include "ircgcons.h"
#include "firm_common_t.h"
#include "typegmod.h"
ir_graph *main_irg; /**< entry point to the compiled program
@@@ or a list, in case we compile a library or the like? */
ir_graph **graphs; /**< all graphs in the ir */
+ ir_graph **pseudo_graphs; /**< all pseudo graphs in the ir. See pseudo_irg.c */
ir_graph *const_code_irg; /**< This ir graph gives the proper environment
to allocate nodes the represent values
of constant entities. It is not meant as
static INLINE int
__get_irp_n_irgs(void) {
assert (irp && irp->graphs);
+ if (get_visit_pseudo_irgs()) return get_irp_n_allirgs();
return (ARR_LEN((irp)->graphs));
}
static INLINE ir_graph *
__get_irp_irg(int pos){
assert (irp && irp->graphs);
+ if (get_visit_pseudo_irgs()) return get_irp_allirg(pos);
return irp->graphs[pos];
}