this irg. */
int get_irg_recursion_depth(ir_graph *irg);
+#ifdef INTERPROCEDURAL_VIEW
/** Returns the method execution frequency of a graph. */
double get_irg_method_execution_frequency(ir_graph *irg);
/** Marks the nesting depth state of the program representation as inconsistent. */
void set_irp_loop_nesting_depth_state_inconsistent(void);
+#endif
+
#endif /* _CALLGRAPH_H_ */
#ifndef FIRM_IR_IRCGCONS_H
#define FIRM_IR_IRCGCONS_H
+#include "firm_config.h"
+
+#ifdef INTERPROCEDURAL_VIEW
+
#include "firm_types.h"
/** Return the current state of the interprocedural view. */
void cg_destruct(void);
#endif
+
+#endif
ir_graph *get_current_ir_graph(void);
void set_current_ir_graph(ir_graph *graph);
+#ifdef INTERPROCEDURAL_VIEW
/** This flag indicate the current view. The behavior of some methods
* (get_irn_*, set_irn_*) is influenced by this flag. */
int get_interprocedural_view(void);
void set_interprocedural_view(int state);
+#else
+#define get_interprocedural_view() 0
+#endif
/**
* Create a new ir graph to build ir for a procedure.
*/
void all_irg_walk(irg_walk_func *pre, irg_walk_func *post, void *env);
+#ifdef INTERPROCEDURAL_VIEW
/**
* Walks all irgs in interprocedural view.
*
* Visits each node only once. Sets current_ir_graph properly. Does not use the link field.
*/
void cg_walk(irg_walk_func *pre, irg_walk_func *post, void *env);
+#endif
/** Walks only over Block nodes in the graph.
*
*/
/* ------------------------------------------------------------------- */
+#ifdef INTERPROCEDURAL_VIEW
/** Returns true if the predecessor pos is a backedge in the interprozeduralem view. */
int is_inter_backedge(ir_node *n, int pos);
/** Returns true if the predecessor pos is a backedge in the intraprocedural view. */
int is_intra_backedge(ir_node *n, int pos);
+#endif
/** Returns non-zero if the predecessor pos is a backedge. */
int is_backedge (ir_node *n, int pos);
/** Marks edge pos as a backedge. */
/* @@@ Well, maybe construct_loop_information or analyze_loops ? */
int construct_backedges(ir_graph *irg);
+#ifdef INTERPROCEDURAL_VIEW
/** Constructs backedges for all irgs in interprocedural view.
*
* @see As construct_backedges(), but for interprocedural view.
* @returns Maximal depth of loop tree.
*/
int construct_ip_backedges(void);
+#endif
/** Construct loop tree only for control flow.
*
*/
int construct_cf_backedges(ir_graph *irg);
+#ifdef INTERPROCEDURAL_VIEW
/** Construct interprocedural loop tree for control flow.
*
* @see construct_cf_backedges() and construct_ip_backedges().
*/
int construct_ip_cf_backedges (void);
+#endif
/** Removes all loop information.
* Resets all backedges. Works for any construction algorithm.
int Block_not_block_visited(const ir_node *node);
int Block_block_visited(const ir_node *node);
+#ifdef INTERPROCEDURAL_VIEW
/* Set and remove interprocedural predecessors. If the interprocedural
* predecessors are removed, the node has the same predecessors in
* both views.
ir_node *get_Block_cg_cfgpred(ir_node *node, int pos);
/** Frees the memory allocated for interprocedural predecessors. */
void remove_Block_cg_cfgpred_arr(ir_node *node);
+#endif
+
/** Returns the extended basic block a block belongs to. */
ir_extblk *get_Block_extbb(const ir_node *block);
/** Sets the extended basic block a block belongs to. */
void assure_irg_outs(ir_graph *irg);
+#ifdef INTERPROCEDURAL_VIEW
/** Computes the out edges in interprocedural view */
void compute_ip_outs(void);
/** Frees the out datastructures. Sets the flag in irg to "outs_none". */
void free_ip_outs(void);
+#endif
+
void free_irg_outs(ir_graph *irg);
void free_irp_outs(void);
# include "config.h"
#endif
+#ifdef INTERPROCEDURAL_VIEW
+
#ifdef HAVE_STRING_H
# include <string.h>
#endif
return NULL;
}
+#ifdef INTERPROCEDURAL_VIEW
/* Returns non-zero if the caller at position pos is "a backedge", i.e. a recursion. */
int is_irg_caller_backedge(ir_graph *irg, int pos) {
assert (pos >= 0 && pos < get_irg_n_callers(irg));
}
return 0;
}
+#endif
/**
* Find the reversion position of a caller.
return 0;
}
+#ifdef INTERPROCEDURAL_VIEW
/**
* Mark the callee at position pos as a backedge.
*/
irg->callee_isbe = xcalloc(n, sizeof(irg->callee_isbe[0]));
irg->callee_isbe[pos] = 1;
}
+#endif
/* Returns the maximal loop depth of call nodes that call along this edge. */
int get_irg_callee_loop_depth(ir_graph *irg, int pos) {
static int loop_node_cnt = 0; /**< Counts the number of allocated cfloop nodes.
Each cfloop node gets a unique number.
What for? ev. remove. @@@ */
+#ifdef INTERPROCEDURAL_VIEW
static int current_dfn = 1; /**< Counter to generate depth first numbering
of visited nodes. */
+#endif
/*-----------------*/
} while(m != irg);
}
+#ifdef INTERPROCEDURAL_VIEW
/* GL ??? my last son is my grandson??? Removes cfloops with no
ir_nodes in them. Such loops have only another loop as son. (Why
can't they have two loops as sons? Does it never get that far? ) */
current_loop = l;
}
+#endif
/**
* Removes and unmarks all nodes up to n from the stack.
/* The loop data structure. **/
/**********************************************************************/
+#ifdef INTERPROCEDURAL_VIEW
/**
* Allocates a new loop as son of current_loop. Sets current_loop
* to the new loop and returns the father.
return !some_outof_loop & some_in_loop;
}
-
/**
* Check whether there is a parallel edge in the ip control flow.
* Only
}
#endif
-
/*-----------------------------------------------------------*
* The core algorithm. *
*-----------------------------------------------------------*/
irg->callee_isbe = NULL;
}
}
+#endif
/* nodes to evaluate a callgraph edge. */
/* ----------------------------------------------------------------------------------- */
+#ifdef INTERPROCEDURAL_VIEW
/* Returns the method execution frequency of a graph. */
double get_irg_method_execution_frequency (ir_graph *irg) {
return irg->method_execution_frequency;
}
}
}
+#endif
/* Returns the maximal loop depth of all paths from an external visible method to
this irg. */
if (irp->lnd_state == loop_nesting_depth_consistent)
irp->lnd_state = loop_nesting_depth_inconsistent;
}
+
+#endif
# include "config.h"
#endif
+#ifdef INTERPROCEDURAL_VIEW
+
#include <math.h>
#include "field_temperature.h"
}
#endif /* if 0 */
+
+#endif
}*/
}
+#ifdef INTERPROCEDURAL_VIEW
int is_inter_backedge(ir_node *n, int pos) {
int res;
int rem = get_interprocedural_view();
set_interprocedural_view(rem);
return res;
}
+#endif
/* Returns non-zero if the predecessor pos is a backedge. */
/** Sets all backedge information to zero. */
void clear_backedges (ir_node *n) {
int i, arity;
- int rem = get_interprocedural_view();
int *ba;
+#ifdef INTERPROCEDURAL_VIEW
+ int rem = get_interprocedural_view();
set_interprocedural_view(0);
+#endif
ba = get_backarray (n);
if (ba) {
arity = get_irn_arity(n);
for (i = 0; i < arity; i++)
ba[i] = 0;
}
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(1);
ba = get_backarray (n);
if (ba) {
ba[i] = 0;
}
set_interprocedural_view(rem);
+#endif
}
int *new_backedge_arr(struct obstack *obst, int size) {
irg_walk_graph(irg, init_node, NULL, NULL);
}
+#ifdef INTERPROCEDURAL_VIEW
/**
* Initializes the scc algorithm for the interprocedural case.
*/
cg_walk (link_to_reg_end, NULL, NULL);
#endif
}
+#endif
/**
* Condition for breaking the recursion: n is the block
return max_loop_depth;
}
-
+#ifdef INTERPROCEDURAL_VIEW
int construct_ip_cf_backedges (void) {
ir_graph *rem = current_ir_graph;
int rem_ipv = get_interprocedural_view();
set_interprocedural_view(rem_ipv);
return max_loop_depth;
}
+#endif
/**
* Clear the intra- and the interprocedural
* backedge information pf a block.
*/
static void reset_backedges(ir_node *block) {
- int rem = get_interprocedural_view();
+ int rem;
assert(is_Block(block));
+#ifdef INTERPROCEDURAL_VIEW
+ rem = get_interprocedural_view();
set_interprocedural_view(1);
clear_backedges(block);
set_interprocedural_view(0);
clear_backedges(block);
set_interprocedural_view(rem);
+#else
+ (void) rem;
+ clear_backedges(block);
+#endif
}
/**
void free_all_cfloop_information (void) {
int i;
+#ifdef INTERPROCEDURAL_VIEW
int rem = get_interprocedural_view();
set_interprocedural_view(1); /* To visit all filter nodes */
+#endif
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
free_cfloop_information(get_irp_irg(i));
}
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(rem);
+#endif
}
int i;
assert(blk);
- assert(!get_interprocedural_view()); /* interprocedural_view not implemented */
inc_irg_block_visited(current_ir_graph);
/* assure the start block is the first one */
*------------------------------------------------------------*/
+#ifdef INTERPROCEDURAL_VIEW
/**
* Inits the number of outedges for each node
* before counting.
}
}
-
/*
* Inits all nodes for setting the outedges
* Returns the overall count of edges
}
irp->outs_state = outs_none;
}
+#endif
void free_irg_outs(ir_graph *irg) {
*/
}
+#ifdef INTERPROCEDURAL_VIEW
static INLINE void
init_ip_scc (void) {
init_scc_common();
cg_walk (link_to_reg_end, NULL, NULL);
#endif
}
+#endif
/* Condition for breaking the recursion. */
static int is_outermost_Start(ir_node *n) {
}
+#ifdef INTERPROCEDURAL_VIEW
int construct_ip_backedges (void) {
ir_graph *rem = current_ir_graph;
int rem_ipv = get_interprocedural_view();
current_ir_graph = rem;
set_interprocedural_view(rem_ipv);
}
+#endif
static void reset_backedges(ir_node *n) {
if (is_possible_loop_head(n)) {
+#ifdef INTERPROCEDURAL_VIEW
int rem = get_interprocedural_view();
set_interprocedural_view(1);
set_interprocedural_view(1);
clear_backedges(n);
set_interprocedural_view(rem);
+#else
+ clear_backedges(n);
+#endif
}
}
void free_all_loop_information (void) {
int i;
+#ifdef INTERPROCEDURAL_VIEW
int rem = get_interprocedural_view();
set_interprocedural_view(1); /* To visit all filter nodes */
+#endif
for (i = 0; i < get_irp_n_irgs(); i++) {
free_loop_information(get_irp_irg(i));
}
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(rem);
+#endif
}
ir_type *mtp = get_Call_type(pred_pred);
tp = get_method_res_type(mtp, get_Proj_proj(n));
} else if (get_irn_op(pred_pred) == op_Tuple) {
- assert(0 && "Encountered nested Tuple");
+ panic("Encountered nested Tuple");
} else {
VERBOSE_UNKNOWN_TYPE(("Proj %ld from Proj from ??: unknown type\n", get_irn_node_nr(n)));
tp = firm_unknown_type;
int i;
int n_runs = 0;
int rerun = TRUE;
+#ifdef INTERPROCEDURAL_VIEW
int old_ip_view = get_interprocedural_view();
set_interprocedural_view(0); /* save this for later */
+#endif
/* init_tables has added main_irg to _live_graphs */
n_runs ++;
}
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(old_ip_view); /* cover up our traces */
+#endif
return (n_runs);
}
* totals. */
void print_graph_counts(int verbosity) {
int i, counter, total = 0;
- int view = get_interprocedural_view();
ir_graph *old = current_ir_graph;
+#ifdef INTERPROCEDURAL_VIEW
+ int view = get_interprocedural_view();
set_interprocedural_view(0);
+#endif
for (i = 0; i < get_irp_n_irgs(); i++) {
counter = 0;
printf(" +++ There are %d graphs with total %d nodes.\n", get_irp_n_irgs(), total);
current_ir_graph = old;
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(view);
+#endif
}
/** Prints number of types, number of entities and totals.
# include "config.h"
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
+#ifdef INTERPROCEDURAL_VIEW
+#include <string.h>
#include <stdbool.h>
#include "ircgcons.h"
return true;
}
+#ifdef INTERPROCEDURAL_VIEW
/* Grundblock der Call-Operation aufteilen. CallBegin- und Filter-Operationen
* einfügen. Die Steuer- und Datenflussabhängigkeiten von den aufgerufenen
* Methoden auf die CallBegin-Operation, und von der Aufrufstelle auf die
DEL_ARR_F(irgs);
DEL_ARR_F(data);
}
+#endif
void cg_construct(int arr_len, ir_entity ** free_methods_arr) {
set_irp_ip_view(ip_view_no);
}
}
+
+#endif
*/
static ir_node **construct_block_lists(ir_graph *irg) {
int i;
+#ifdef INTERPROCEDURAL_VIEW
int rem_view = get_interprocedural_view();
+#endif
int walk_flag = using_visited(irg);
ir_graph *rem = current_ir_graph;
ird_walk_graph(current_ir_graph, clear_link, collect_node, current_ir_graph);
+#ifdef INTERPROCEDURAL_VIEW
/* Collect also EndReg and EndExcept. We do not want to change the walker. */
set_interprocedural_view(0);
+#endif
set_irg_visited(current_ir_graph, get_irg_visited(current_ir_graph)-1);
irg_walk(get_irg_end_reg(current_ir_graph), clear_link, collect_node, current_ir_graph);
set_irg_visited(current_ir_graph, get_irg_visited(current_ir_graph)-1);
irg_walk(get_irg_end_except(current_ir_graph), clear_link, collect_node, current_ir_graph);
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(rem_view);
+#endif
if(walk_flag)
set_using_visited(current_ir_graph);
#include "execution_frequency.h"
static void dump_node_ana_vals(FILE *F, ir_node *n) {
+ (void) F;
+ (void) n;
return;
+#ifdef INTERPROCEDURAL_VIEW
fprintf(F, " %lf*(%2.0lf + %2.0lf) = %2.0lf ",
get_irn_exec_freq(n),
get_irg_method_execution_frequency(get_irn_irg(n)),
pow(5, get_irg_recursion_depth(get_irn_irg(n))),
get_irn_exec_freq(n) * (get_irg_method_execution_frequency(get_irn_irg(n)) + pow(5, get_irg_recursion_depth(get_irn_irg(n))))
);
+#endif
}
f = vcg_open(irg, suffix, "-cfg");
if (f != NULL) {
ir_graph *rem = current_ir_graph;
+#ifdef INTERPROCEDURAL_VIEW
int ipv = get_interprocedural_view();
+#endif
current_ir_graph = irg;
dump_vcg_header(f, get_irg_dump_name(irg), NULL);
+#ifdef INTERPROCEDURAL_VIEW
if (ipv) {
printf("Warning: dumping cfg not in interprocedural view!\n");
set_interprocedural_view(0);
}
+#endif
/* walk over the blocks in the graph */
irg_block_walk(get_irg_end(irg), dump_block_to_cfg, NULL, f);
dump_node(f, get_irg_bad(irg));
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(ipv);
+#endif
vcg_close(f);
current_ir_graph = rem;
}
}
}
-
+#if 0
static int weight_overall(int rec, int loop) {
return 2*rec + loop;
}
return my_overall_color;
}
}
+#endif
+#ifdef INTERPROCEDURAL_VIEW
void dump_callgraph(const char *suffix) {
FILE *F = vcg_open_name("Callgraph", suffix);
if (F != NULL) {
- int i, rem = edge_label, colorize;
+ int i, rem = edge_label;
+ //int colorize;
edge_label = 1;
dump_vcg_header(F, "Callgraph", NULL);
- colorize = get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent;
+ //colorize = get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent;
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph *irg = get_irp_irg(i);
ir_entity *ent = get_irg_entity(irg);
- int j, n_callees = get_irg_n_callees(irg);
+ int j;
+ //int n_callees = get_irg_n_callees(irg);
int color;
- color = colorize ? get_entity_color(ent) : ird_color_green;
+ //color = colorize ? get_entity_color(ent) : ird_color_green;
+ color = ird_color_green;
dump_entity_node(F, ent, color);
for (j = 0; j < n_callees; ++j) {
ir_entity *c = get_irg_entity(get_irg_callee(irg, j));
set_interprocedural_view(rem_view);
}
}
+#endif
/*---------------------------------------------------------------------*/
/* the following routines dumps type information without any ir nodes. */
fprintf(F, " %ld\n", get_irn_node_nr(get_irn_n(n, -1)));
}
+#ifdef INTERPROCEDURAL_VIEW
fprintf(F, " arity: %d\n", get_irn_intra_arity(n));
/* show all predecessor nodes */
fprintf(F, " pred nodes: \n");
dump_node_opcode(F, get_irn_intra_n(n, i));
fprintf(F, " %ld\n", get_irn_node_nr(get_irn_intra_n(n, i)));
}
+#else
+ fprintf(F, " arity: %d\n", get_irn_arity(n));
+ /* show all predecessor nodes */
+ fprintf(F, " pred nodes: \n");
+ if (!is_Block(n)) {
+ fprintf(F, " -1: ");
+ dump_node_opcode(F, get_irn_n(n, -1));
+ fprintf(F, " %ld\n", get_irn_node_nr(get_irn_n(n, -1)));
+ }
+ for ( i = 0; i < get_irn_arity(n); ++i) {
+ fprintf(F, " %d: %s ", i, is_backedge(n, i) ? "be" : " ");
+ dump_node_opcode(F, get_irn_n(n, i));
+ fprintf(F, " %ld\n", get_irn_node_nr(get_irn_n(n, i)));
+ }
+#endif
fprintf(F, " Private Attributes:\n");
if (get_irn_opcode(n) == iro_Proj)
fprintf(F, " proj nr: %ld\n", get_Proj_proj(n));
+#ifdef INTERPROCEDURAL_VIEW
if ((get_irp_ip_view_state() != ip_view_no)
&& (get_irn_opcode(n) == iro_Filter || get_irn_opcode(n) == iro_Block)) {
fprintf(F, " inter arity: %d\n", get_irn_inter_arity(n));
fprintf(F, " %ld\n", get_irn_node_nr(get_irn_inter_n(n, i)));
}
}
+#endif
if (is_fragile_op(n)) {
fprintf(F, " pinned state: %s\n", get_op_pin_state_name(get_irn_pinned(n)));
fprintf(F, " Execution freqency statistics:\n");
if (get_irg_exec_freq_state(get_irn_irg(n)) != exec_freq_none)
fprintf(F, " procedure local evaluation: %8.2lf\n", get_irn_exec_freq(n));
+#ifdef INTERPROCEDURAL_VIEW
if (get_irp_loop_nesting_depth_state() != loop_nesting_depth_none)
fprintf(F, " call freqency of procedure: %8.2lf\n",
get_irg_method_execution_frequency(get_irn_irg(n)));
(get_irp_loop_nesting_depth_state() != loop_nesting_depth_none) &&
(get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent))
fprintf(F, " final evaluation: **%8.2lf**\n", get_irn_final_cost(n));
+#endif
if (has_Block_label(n))
fprintf(F, " Label: %lu\n", get_Block_label(n));
fprintf(F, " start of method of type %s \n", get_type_name_ex(tp, &bad));
for (i = 0; i < get_method_n_params(tp); ++i)
fprintf(F, " param %d type: %s \n", i, get_type_name_ex(get_method_param_type(tp, i), &bad));
+#ifdef INTERPROCEDURAL_VIEW
if ((get_irp_ip_view_state() == ip_view_valid) && !get_interprocedural_view()) {
ir_node *sbl = get_nodes_block(n);
int i, n_cfgpreds = get_Block_cg_n_cfgpreds(sbl);
get_irg_dump_name(get_irn_irg(cfgpred)));
}
}
+#endif
} break;
case iro_Cond: {
fprintf(F, " condition kind: %s\n", get_Cond_kind(n) == dense ? "dense" : "fragmentary");
if (is_Method_type(get_entity_type(ent))) {
if (get_entity_irg(ent)) /* can be null */ {
fprintf(F, "\n%s irg = %ld", prefix, get_irg_graph_nr(get_entity_irg(ent)));
+#ifdef INTERPROCEDURAL_VIEW
if (get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent) {
fprintf(F, "\n%s recursion depth %d", prefix, get_irg_recursion_depth(get_entity_irg(ent)));
fprintf(F, "\n%s loop depth %d", prefix, get_irg_loop_depth(get_entity_irg(ent)));
}
+#endif
} else {
fprintf(F, "\n%s irg = NULL", prefix);
}
free(L_freq);
#endif
if (get_trouts_state() != outs_none) {
+#ifdef INTERPROCEDURAL_VIEW
if (is_Method_type(get_entity_type(ent))) {
fprintf(F, "%s Estimated #Calls: %lf\n", prefix, get_entity_estimated_n_calls(ent));
fprintf(F, "%s Estimated #dynCalls: %lf\n", prefix, get_entity_estimated_n_calls(ent));
fprintf(F, "%s Estimated #Loads: %lf\n", prefix, get_entity_estimated_n_loads(ent));
fprintf(F, "%s Estimated #Stores: %lf\n", prefix, get_entity_estimated_n_stores(ent));
}
+#endif
}
}
}
/* Output the entity name. */
fprintf(F, "%s%-40s ", prefix, get_entity_ld_name(ent));
+#ifdef INTERPROCEDURAL_VIEW
if (get_trouts_state() != outs_none) {
if (is_Method_type(get_entity_type(ent))) {
//fprintf(F, "%s Estimated #Calls: %lf\n", prefix, get_entity_estimated_n_calls(ent));
fprintf(F, "%6.2lf", get_entity_estimated_n_stores(ent));
}
}
+#endif
fprintf(F, "\n");
}
}
+#ifdef INTERPROCEDURAL_VIEW
/* A fast hack to dump a CSV-file. */
void dump_typecsv_to_file(FILE *F, ir_type *tp, dump_verbosity verbosity, const char *comma) {
int i;
}
}
}
+#endif
void dump_type_to_file(FILE *F, ir_type *tp, dump_verbosity verbosity) {
int i;
free(freq);
#endif
+#ifdef INTERPROCEDURAL_VIEW
if (get_trouts_state() != outs_none) {
fprintf(F, " Estimated #Instances: %lf\n", get_type_estimated_n_instances(tp));
if (is_Class_type(tp) && (get_irp_typeinfo_state() != ir_typeinfo_none)) {
assert(get_class_n_upcasts(tp) + get_class_n_downcasts(tp) == get_type_n_casts(tp));
}
}
+#endif
}
//if (is_jack_rts_class(t)) continue;
dump_type_to_file(F, t, verbosity);
+#ifdef INTERPROCEDURAL_VIEW
if (CSV) {
dump_typecsv_to_file(CSV, t, verbosity, "");
}
+#endif
}
fclose(F);
dead_node_elimination(ir_graph *irg) {
if (get_opt_optimize() && get_opt_dead_node_elimination()) {
ir_graph *rem;
+#ifdef INTERPROCEDURAL_VIEW
int rem_ipview = get_interprocedural_view();
+#endif
struct obstack *graveyard_obst = NULL;
struct obstack *rebirth_obst = NULL;
assert(! edges_activated(irg) && "dead node elimination requires disabled edges");
/* Remember external state of current_ir_graph. */
rem = current_ir_graph;
current_ir_graph = irg;
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(0);
+#endif
assert(get_irg_phase_state(irg) != phase_building);
hook_dead_node_elim(irg, 0);
current_ir_graph = rem;
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(rem_ipview);
+#endif
}
}
current_ir_graph = graph;
}
-
+#ifdef INTERPROCEDURAL_VIEW
int firm_interprocedural_view = 0;
int (get_interprocedural_view)(void) {
_get_irn_n = _get_irn_intra_n;
}
}
+#endif
/** contains the suffix for frame type names */
static ident *frame_type_suffix = NULL;
/* inline functions for graphs */
/*-------------------------------------------------------------------*/
-extern int firm_interprocedural_view;
-
-static INLINE int
-_get_interprocedural_view(void) {
- return firm_interprocedural_view;
-}
-
static INLINE int
_is_ir_graph(const void *thing) {
return (get_kind(thing) == k_ir_graph);
set_irn_n(irg->anchor, idx, irn);
}
+#ifdef INTERPROCEDURAL_VIEW
+extern int firm_interprocedural_view;
+
+static INLINE int
+_get_interprocedural_view(void) {
+ return firm_interprocedural_view;
+}
#define get_interprocedural_view() _get_interprocedural_view()
+#endif
+
#define is_ir_graph(thing) _is_ir_graph(thing)
#define get_irg_start_block(irg) _get_irg_start_block(irg)
#define set_irg_start_block(irg, node) _set_irg_start_block(irg, node)
{
assert(is_ir_node(node));
+#ifdef INTERPROCEDURAL_VIEW
if (get_interprocedural_view()) {
pset_new_t irg_set;
pset_new_iterator_t iter;
irg_walk_cg(node, visited, &irg_set, pre, post, env);
pset_new_destroy(&irg_set);
} else {
+#endif
set_using_visited(current_ir_graph);
inc_irg_visited(current_ir_graph);
nodes_touched = irg_walk_2(node, pre, post, env);
clear_using_visited(current_ir_graph);
+#ifdef INTERPROCEDURAL_VIEW
}
+#endif
return;
}
return;
}
-
+#ifdef INTERPROCEDURAL_VIEW
/* Walks all irgs in interprocedural view. Visits each node only once. */
void cg_walk(irg_walk_func *pre, irg_walk_func *post, void *env) {
int i;
set_interprocedural_view(rem_view);
current_ir_graph = rem;
}
+#endif
/***************************************************************************/
ir_node *end_node = get_irg_end(irg);
ir_node *end_blk = get_irg_end_block(irg);
blk_collect_data_t blks;
- int old_view = get_interprocedural_view();
block_entry_t *entry;
+#ifdef INTERPROCEDURAL_VIEW
/* switch off interprocedural view */
+ int old_view = get_interprocedural_view();
set_interprocedural_view(0);
+#endif
obstack_init(&blks.obst);
blks.blk_map = new_pset(addr_cmp, 1);
del_pset(blks.blk_map);
obstack_free(&blks.obst, NULL);
+#ifdef INTERPROCEDURAL_VIEW
set_interprocedural_view(old_view);
+#endif
clear_using_visited(irg);
}
node->attr.block.graph_arr[pos+1] = value;
}
+#ifdef INTERPROCEDURAL_VIEW
void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]) {
assert(node->op == op_Block);
if (node->attr.block.in_cg == NULL || arity != ARR_LEN(node->attr.block.in_cg) - 1) {
assert(node->op == op_Block);
node->attr.block.in_cg = NULL;
}
+#endif
ir_node *(set_Block_dead)(ir_node *block) {
return _set_Block_dead(block);
return _get_irn_intra_arity(node);
}
+#ifdef INTERPROCEDURAL_VIEW
/**
* Returns the number of predecessors without the block predecessor.
* Intern version for libFirm.
*/
extern int (*_get_irn_arity)(const ir_node *node);
+#else
+
+#define _get_irn_arity(n) _get_irn_intra_arity(n)
+#endif
+
/**
* Intern version for libFirm.
*/
* If it is a block, the entry -1 is NULL.
* Intern version for libFirm.
*/
+#ifdef INTERPROCEDURAL_VIEW
extern ir_node *(*_get_irn_n)(const ir_node *node, int n);
+#else
+#define _get_irn_n(n,i) _get_irn_intra_n(n,i)
+#endif
static INLINE int _get_irn_deps(const ir_node *node) {
return node->deps ? ARR_LEN(node->deps) : 0;
double max_method_execution_frequency; /**< needed in callgraph. */
irp_temperature_state temperature_state; /**< accumulated temperatures computed? */
exec_freq_state execfreq_state; /**< The state of execution frequency information */
+#ifdef INTERPROCEDURAL_VIEW
loop_nesting_depth_state lnd_state; /**< The state of loop nesting depth information. */
+#endif
ir_class_cast_state class_cast_state; /**< The state of cast operations in code. */
ir_address_taken_computed_state globals_adr_taken_state; /**< Address taken state of the globals. */
static int verify_node_Proj_EndReg(ir_node *n, ir_node *p) {
(void) n;
(void) p;
+#ifdef INTERPROCEDURAL_VIEW
ASSERT_AND_RET(
(get_irp_ip_view_state() != ip_view_no),
"EndReg may only appear if ip view is constructed.", 0);
+#endif
return 1;
}
static int verify_node_Proj_EndExcept(ir_node *n, ir_node *p) {
(void) n;
(void) p;
+#ifdef INTERPROCEDURAL_VIEW
ASSERT_AND_RET(
(get_irp_ip_view_state() != ip_view_no),
"EndExcept may only appear if ip view is constructed.", 0);
+#endif
return 1;
}
ir_mode *mymode = get_irn_mode(n);
(void) irg;
+#ifdef INTERPROCEDURAL_VIEW
ASSERT_AND_RET((get_irp_ip_view_state() != ip_view_no),
"Break may only appear if ip view is constructed.", 0);
+#endif
ASSERT_AND_RET(
/* Jmp: BB --> X */
mymode == mode_X, "Break node", 0
static int verify_node_Filter(ir_node *n, ir_graph *irg) {
(void) n;
(void) irg;
+#ifdef INTERPROCEDURAL_VIEW
ASSERT_AND_RET((get_irp_ip_view_state() != ip_view_no),
"Filter may only appear if ip view is constructed.", 0);
+#endif
/* We should further do tests as for Proj and Phi. */
return 1;
}
* Lowers unaligned Loads.
*/
static void lower_unaligned_Load(ir_node *load) {
+ (void) load;
/* NYI */
}
* Lowers unaligned Stores
*/
static void lower_unaligned_Store(ir_node *store) {
+ (void) store;
/* NYI */
}
}
void free_method_entities(ir_type *method) {
+ (void) method;
assert(method && (method->type_op == type_method));
}
}
void free_array_entities (ir_type *array) {
+ (void) array;
assert(array && (array->type_op == type_array));
}
}
void free_enumeration_entities(ir_type *enumeration) {
+ (void) enumeration;
assert(enumeration && (enumeration->type_op == type_enumeration));
}
void free_enumeration_attrs(ir_type *enumeration) {
}
void free_pointer_entities(ir_type *pointer) {
+ (void) pointer;
assert(pointer && (pointer->type_op == type_pointer));
}
void free_pointer_attrs(ir_type *pointer) {
+ (void) pointer;
assert(pointer && (pointer->type_op == type_pointer));
}