Commit 3e32262d authored by Matthias Braun's avatar Matthias Braun
Browse files

Move current_ir_graph from ir_graph to ir_cons

It should only be used by construction algorithms
parent 6bc15eba
......@@ -810,6 +810,17 @@ FIRM_API ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
* @{
*/
/** Global variable holding the current ir graph.
*
* This global variable is used by the ir construction
* interface in ircons and by the optimizations.
* Further it is set by all walker functions.
*/
FIRM_API ir_graph *current_ir_graph;
FIRM_API ir_graph *get_current_ir_graph(void);
FIRM_API void set_current_ir_graph(ir_graph *graph);
/** Create an immature Block.
*
* An immature Block has an unknown number of predecessors. Predecessors
......
......@@ -109,17 +109,6 @@
* @{
*/
/** Global variable holding the current ir graph.
*
* This global variable is used by the ir construction
* interface in ircons and by the optimizations.
* Further it is set by all walker functions.
*/
FIRM_API ir_graph *current_ir_graph;
FIRM_API ir_graph *get_current_ir_graph(void);
FIRM_API void set_current_ir_graph(ir_graph *graph);
/**
* Create a new ir graph to build ir for a procedure.
*
......
......@@ -37,6 +37,7 @@
#include "irgwalk.h"
#include "irprog_t.h"
#include "irdump.h"
#include "ircons_t.h"
#define NO_CFLOOPS_WITHOUT_HEAD 1
......
......@@ -29,6 +29,7 @@
#include "irgraph_t.h"
#include "irextbb.h"
#include "irtools.h"
#include "ircons.h"
/**
* An extended block.
......
......@@ -36,6 +36,7 @@
#include "util.h"
#include "irprintf.h"
#include "error.h"
#include "ircons.h"
/*--------------------------------------------------------------------*/
/** Accessing the out datastructures **/
......
......@@ -40,6 +40,7 @@
#include "irdump.h"
#include "array.h"
#include "pmap.h"
#include "ircons.h"
/* A variant of the loop tree that avoids loops without head.
This reduces the depth of the loop tree. */
......
......@@ -133,7 +133,7 @@ ir_type *get_irn_typeinfo_type(const ir_node *n)
void set_irn_typeinfo_type(ir_node *n, ir_type *tp)
{
assert(get_irg_typeinfo_state(current_ir_graph) != ir_typeinfo_none);
assert(get_irg_typeinfo_state(get_irn_irg(n)) != ir_typeinfo_none);
pmap_insert(type_node_map, (void *)n, (void *)tp);
}
......@@ -515,7 +515,7 @@ static void vrp_first_pass(ir_node *n, void *e)
vrp_update_node(env->info, n);
assure_irg_outs(get_current_ir_graph());
assure_irg_outs(get_irn_irg(n));
for (i = get_irn_n_outs(n) - 1; i >=0; --i) {
ir_node *succ = get_irn_out(n, i);
if (bitset_is_set(env->visited, get_irn_idx(succ))) {
......
......@@ -833,7 +833,7 @@ static void arm_emit_node(const ir_node *irn)
(*emit)(irn);
} else {
panic("Error: No emit handler for node %+F (graph %+F)\n",
irn, current_ir_graph);
irn, get_irn_irg(irn));
}
}
......
......@@ -36,7 +36,7 @@
static copy_attr_func old_phi_copy_attr;
void be_info_new_node(ir_node *node)
void be_info_new_node(ir_graph *irg, ir_node *node)
{
struct obstack *obst;
backend_info_t *info;
......@@ -45,7 +45,7 @@ void be_info_new_node(ir_node *node)
if (is_Proj(node))
return;
obst = be_get_be_obst(current_ir_graph);
obst = be_get_be_obst(irg);
info = OALLOCZ(obst, backend_info_t);
assert(node->backend_info == NULL);
......@@ -124,8 +124,9 @@ int be_nodes_equal(const ir_node *node1, const ir_node *node2)
static void init_walker(ir_node *node, void *data)
{
ir_graph *irg = get_irn_irg(node);
(void) data;
be_info_new_node(node);
be_info_new_node(irg, node);
}
static bool initialized = false;
......
......@@ -60,7 +60,7 @@ static inline backend_info_t *be_get_info(const ir_node *node)
void be_info_init(void);
void be_info_free(void);
void be_info_init_irg(ir_graph *irg);
void be_info_new_node(ir_node *node);
void be_info_new_node(ir_graph *irg, ir_node *node);
void be_info_duplicate(const ir_node *old_node, ir_node *new_node);
int be_info_initialized(const ir_graph *irg);
......
......@@ -49,6 +49,7 @@
#include "execfreq.h"
#include "irprofile.h"
#include "irpass_t.h"
#include "ircons.h"
#include "bearch.h"
#include "be_t.h"
......
......@@ -238,7 +238,7 @@ unsigned long be_count_insns(ir_graph *irg)
static void block_count_walker(ir_node *node, void *data)
{
unsigned long *cnt = (unsigned long*)data;
if (node == get_irg_end_block(current_ir_graph))
if (node == get_irg_end_block(get_irn_irg(node)))
return;
(*cnt)++;
}
......
......@@ -66,7 +66,7 @@ static bool do_is_immediate(const ir_node *node, int *symconsts, bool negate)
#ifdef DEBUG_libfirm
ir_fprintf(stderr,
"Optimisation warning tarval of %+F(%+F) is not a long.\n",
node, current_ir_graph);
node, get_irn_irg(node));
#endif
return false;
}
......
......@@ -60,6 +60,7 @@
#include "raw_bitset.h"
#include "dbginfo.h"
#include "lc_opts.h"
#include "ircons.h"
#include "besched.h"
#include "benode.h"
......
......@@ -1251,7 +1251,7 @@ static void sparc_emit_node(const ir_node *node)
(*func) (node);
} else {
panic("No emit handler for node %+F (graph %+F)\n", node,
current_ir_graph);
get_irn_irg(node));
}
}
......
......@@ -35,6 +35,7 @@
#include "irgopt.h"
#include "irgmod.h"
#include "irgwalk.h"
#include "ircons.h"
#include "adt/pdeq.h"
......
......@@ -36,6 +36,7 @@
#include "irgwalk.h"
#include "irhooks.h"
#include "entity_t.h"
#include "ircons.h"
#include "error.h"
#include "pset_new.h"
......
......@@ -31,6 +31,7 @@
#include "irhooks.h"
#include "array.h"
#include "hashptr.h"
#include "ircons.h"
#define _get_walk_arity(env, node) \
((env)->follow_deps ? get_irn_ins_or_deps((node)) : get_irn_arity((node)))
......
......@@ -183,7 +183,7 @@ ir_node *new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op,
hook_new_node(irg, res);
if (get_irg_phase_state(irg) == phase_backend) {
be_info_new_node(res);
be_info_new_node(irg, res);
}
return res;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment