Commit 9c6ef39a authored by Michael Beck's avatar Michael Beck
Browse files

- get_irg_initial_exec()/set_irg_initial_exec() added

- removed the unused globals Proj
- BugFix: is_tls_pointer()

[r19268]
parent 71712d24
......@@ -236,16 +236,16 @@ void set_irg_end_reg(ir_graph *irg, ir_node *node);
ir_node *get_irg_end_except(const ir_graph *irg);
void set_irg_end_except(ir_graph *irg, ir_node *node);
/** Returns the node that represents the initial control flow of the given IR graph. */
ir_node *get_irg_initial_exec(const ir_graph *irg);
/** Sets the node that represents the initial control of the given IR graph. */
void set_irg_initial_exec(ir_graph *irg, ir_node *node);
/** Returns the node that represents the frame pointer of the given IR graph. */
ir_node *get_irg_frame(const ir_graph *irg);
/** Sets the node that represents the frame pointer of the given IR graph. */
void set_irg_frame(ir_graph *irg, ir_node *node);
/** Returns the node that represents the global pointer of the given IR graph. */
ir_node *get_irg_globals(const ir_graph *irg);
/** Sets the node that represents the global pointer of the given IR graph. */
void set_irg_globals(ir_graph *irg, ir_node *node);
/** Returns the node that represents the tls pointer of the given IR graph. */
ir_node *get_irg_tls(const ir_graph *irg);
/** Sets the node that represents the tls pointer of the given IR graph. */
......
......@@ -310,9 +310,6 @@ typedef enum {
pn_Start_X_initial_exec, /**< Projection on the initial control flow. */
pn_Start_M, /**< Projection on the initial memory. */
pn_Start_P_frame_base, /**< Projection on the frame base pointer. */
pn_Start_P_globals, /**< Projection on the pointer to the data segment
containing _all_ global entities. Use for
position independent data/code access. */
pn_Start_P_tls, /**< Projection on the pointer to the thread local store
segment containing _all_thread local variables. */
pn_Start_T_args, /**< Projection on all arguments. */
......@@ -327,12 +324,6 @@ typedef enum {
* from Start. If so returns frame type, else Null. */
ir_type *is_frame_pointer(const ir_node *n);
/** Test whether arbitrary node is globals pointer.
*
* Test whether arbitrary node is globals pointer, i.e. Proj(pn_Start_P_globals)
* from Start. If so returns global type, else Null. */
ir_type *is_globals_pointer(const ir_node *n);
/** Test whether arbitrary node is the thread local storage (tls) pointer.
*
* Test whether arbitrary node is tls pointer, i.e. Proj(pn_Start_P_tls)
......
......@@ -137,9 +137,6 @@ static ir_type *find_type_for_Proj(ir_node *n) {
case pn_Start_P_frame_base:
tp = find_pointer_type_to(get_irg_frame_type(get_irn_irg(pred)));
break;
case pn_Start_P_globals:
tp = find_pointer_type_to(get_glob_type());
break;
case pn_Start_P_tls:
tp = find_pointer_type_to(get_tls_type());
break;
......
......@@ -424,9 +424,6 @@ void be_transform_graph(be_irg_t *birg, arch_pretrans_nodes *func, void *cg)
/* do the main transformation */
transform_nodes(irg, func, cg);
/* we don't want the globals anchor anymore */
set_irg_globals(irg, new_r_Bad(irg));
/* free the old obstack */
obstack_free(old_obst, 0);
xfree(old_obst);
......
......@@ -938,6 +938,8 @@ static void ia32_before_abi(void *self) {
ir_lower_mode_b(cg->irg, &lower_mode_b_config);
if (cg->dump)
be_dump(cg->irg, "-lower_modeb", dump_ir_block_graph_sched);
if (cg->gprof)
instrument_initcall(cg->irg);
}
/**
......@@ -1516,14 +1518,16 @@ static void ia32_codegen(void *self) {
free(cg);
}
/**
* Returns the node representing the PIC base.
*/
static ir_node *ia32_get_pic_base(void *self) {
ir_node *block;
ia32_code_gen_t *cg = self;
ir_node *get_eip = cg->get_eip;
if(get_eip != NULL)
if (get_eip != NULL)
return get_eip;
block = get_irg_start_block(cg->irg);
get_eip = new_rd_ia32_GetEIP(NULL, cg->irg, block);
cg->get_eip = get_eip;
......@@ -1537,7 +1541,7 @@ static void *ia32_cg_init(be_irg_t *birg);
static const arch_code_generator_if_t ia32_code_gen_if = {
ia32_cg_init,
ia32_get_pic_base,
ia32_get_pic_base, /* return node used as base in pic code addresses */
ia32_before_abi, /* before abi introduce hook */
ia32_prepare_graph,
NULL, /* spill */
......@@ -1563,6 +1567,7 @@ static void *ia32_cg_init(be_irg_t *birg) {
cg->birg = birg;
cg->blk_sched = NULL;
cg->dump = (birg->main_env->options->dump_flags & DUMP_BE) ? 1 : 0;
cg->gprof = (birg->main_env->options->gprof) ? 1 : 0;
/* enter it */
isa->cg = cg;
......
......@@ -65,19 +65,20 @@ struct ia32_code_gen_t {
ia32_isa_t *isa; /**< for fast access to the isa object */
be_irg_t *birg; /**< The be-irg (contains additional information about the irg) */
ir_node **blk_sched; /**< an array containing the scheduled blocks */
char do_x87_sim; /**< set to 1 if x87 simulation should be enforced */
char dump; /**< set to 1 if graphs should be dumped */
ir_node *unknown_gp; /**< unique Unknown_GP node */
ir_node *unknown_vfp; /**< unique Unknown_VFP node */
ir_node *unknown_xmm; /**< unique Unknown_XMM node */
ir_node *noreg_gp; /**< unique NoReg_GP node */
ir_node *noreg_vfp; /**< unique NoReg_VFP node */
ir_node *noreg_xmm; /**< unique NoReg_XMM node */
ir_node *fpu_trunc_mode; /**< truncate fpu mode */
ir_node *get_eip; /**< get eip node */
struct obstack *obst;
unsigned do_x87_sim:1; /**< set to 1 if x87 simulation should be enforced */
unsigned dump:1; /**< set to 1 if graphs should be dumped */
unsigned gprof:1; /**< set to 1 grof profiling is in use */
ir_node *unknown_gp; /**< unique Unknown_GP node */
ir_node *unknown_vfp; /**< unique Unknown_VFP node */
ir_node *unknown_xmm; /**< unique Unknown_XMM node */
ir_node *noreg_gp; /**< unique NoReg_GP node */
ir_node *noreg_vfp; /**< unique NoReg_VFP node */
ir_node *noreg_xmm; /**< unique NoReg_XMM node */
ir_node *fpu_trunc_mode; /**< truncate fpu mode */
ir_node *get_eip; /**< get eip node */
struct obstack *obst;
};
/**
......
......@@ -75,10 +75,10 @@ copy_irn_to_irg(ir_node *n, ir_graph *irg) {
else if (op == op_Proj) {
old_irg = get_irn_irg(n);
if (n == get_irg_frame(old_irg))
if (n == get_irg_initial_exec(old_irg))
nn = get_irg_initial_exec(irg);
else if (n == get_irg_frame(old_irg))
nn = get_irg_frame(irg);
else if (n == get_irg_globals(old_irg))
nn = get_irg_globals(irg);
else if (n == get_irg_initial_mem(old_irg))
nn = get_irg_initial_mem(irg);
else if (n == get_irg_args(old_irg))
......
......@@ -178,7 +178,6 @@ static void collect_phicallproj(void) {
* auch wenn sie nicht im intraprozeduralen Graphen erreichbar
* sind. */
link(start, get_irg_frame(irg));
link(start, get_irg_globals(irg));
/* walk */
irg_walk_graph(irg, firm_clear_link, (irg_walk_func *) collect_phicallproj_walker, &end);
......@@ -272,9 +271,9 @@ static void prepare_irg(ir_graph * irg, irg_data_t * data) {
}
}
/* Globle Eintrge fr ersetzte Operationen korrigieren. */
set_irg_frame (irg, skip_Id(get_irg_frame(irg)));
set_irg_globals (irg, skip_Id(get_irg_globals(irg)));
set_irg_initial_mem(irg, skip_Id(get_irg_initial_mem(irg)));
set_irg_initial_exec(irg, skip_Id(get_irg_initial_exec(irg)));
set_irg_frame (irg, skip_Id(get_irg_frame(irg)));
set_irg_initial_mem (irg, skip_Id(get_irg_initial_mem(irg)));
/* Unbekannten Aufrufer sofort eintragen. */
if (data->open) {
......@@ -914,11 +913,11 @@ void cg_destruct(void) {
ir_graph * irg = get_irp_irg(i);
irg_walk_graph(irg, destruct_walker, firm_clear_link, NULL);
set_irg_frame (irg, skip_Id(get_irg_frame(irg)));
set_irg_globals (irg, skip_Id(get_irg_globals(irg)));
set_irg_initial_mem(irg, skip_Id(get_irg_initial_mem(irg)));
set_irg_end_reg (irg, get_irg_end(irg));
set_irg_end_except (irg, get_irg_end(irg));
set_irg_initial_exec(irg, skip_Id(get_irg_initial_exec(irg)));
set_irg_frame (irg, skip_Id(get_irg_frame(irg)));
set_irg_initial_mem (irg, skip_Id(get_irg_initial_mem(irg)));
set_irg_end_reg (irg, get_irg_end(irg));
set_irg_end_except (irg, get_irg_end(irg));
set_irg_callee_info_state(irg, irg_callee_info_none);
}
......
......@@ -922,7 +922,6 @@ static const pns_lookup_t start_lut[] = {
#define X(a) { pn_Start_##a, #a }
X(X_initial_exec),
X(P_frame_base),
X(P_globals),
X(P_tls),
X(T_args),
X(P_value_arg_base)
......
......@@ -259,8 +259,8 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
/* Proj results of start node */
projX = new_Proj(start, mode_X, pn_Start_X_initial_exec);
set_irg_initial_exec (res, projX);
set_irg_frame (res, new_Proj(start, mode_P_data, pn_Start_P_frame_base));
set_irg_globals (res, new_Proj(start, mode_P_data, pn_Start_P_globals));
set_irg_tls (res, new_Proj(start, mode_P_data, pn_Start_P_tls));
set_irg_args (res, new_Proj(start, mode_T, pn_Start_T_args));
set_irg_value_param_base(res, new_Proj(start, mode_P_data, pn_Start_P_value_arg_base));
......@@ -642,23 +642,23 @@ void
}
ir_node *
(get_irg_frame)(const ir_graph *irg) {
return _get_irg_frame(irg);
(get_irg_initial_exec)(const ir_graph *irg) {
return _get_irg_initial_exec(irg);
}
void
(set_irg_frame)(ir_graph *irg, ir_node *node) {
_set_irg_frame(irg, node);
(set_irg_initial_exec)(ir_graph *irg, ir_node *node) {
_set_irg_initial_exec(irg, node);
}
ir_node *
(get_irg_globals)(const ir_graph *irg) {
return _get_irg_globals(irg);
(get_irg_frame)(const ir_graph *irg) {
return _get_irg_frame(irg);
}
void
(set_irg_globals)(ir_graph *irg, ir_node *node) {
_set_irg_globals(irg, node);
(set_irg_frame)(ir_graph *irg, ir_node *node) {
_set_irg_frame(irg, node);
}
ir_node *
......
......@@ -169,23 +169,23 @@ _set_irg_end_except(ir_graph *irg, ir_node *node) {
}
static INLINE ir_node *
_get_irg_frame(const ir_graph *irg) {
return get_irn_intra_n(irg->anchor, anchor_frame);
_get_irg_initial_exec(const ir_graph *irg) {
return get_irn_intra_n(irg->anchor, anchor_initial_exec);
}
static INLINE void
_set_irg_frame(ir_graph *irg, ir_node *node) {
set_irn_n(irg->anchor, anchor_frame, node);
_set_irg_initial_exec(ir_graph *irg, ir_node *node) {
set_irn_n(irg->anchor, anchor_initial_exec, node);
}
static INLINE ir_node *
_get_irg_globals(const ir_graph *irg) {
return get_irn_intra_n(irg->anchor, anchor_globals);
_get_irg_frame(const ir_graph *irg) {
return get_irn_intra_n(irg->anchor, anchor_frame);
}
static INLINE void
_set_irg_globals(ir_graph *irg, ir_node *node) {
set_irn_n(irg->anchor, anchor_globals, node);
_set_irg_frame(ir_graph *irg, ir_node *node) {
set_irn_n(irg->anchor, anchor_frame, node);
}
static INLINE ir_node *
......@@ -547,10 +547,10 @@ _get_interprocedural_view(void) {
#define set_irg_end_reg(irg, node) _set_irg_end_reg(irg, node)
#define get_irg_end_except(irg) _get_irg_end_except(irg)
#define set_irg_end_except(irg, node) _set_irg_end_except(irg, node)
#define get_irg_initial_exec(irg) _get_irg_initial_exec(irg)
#define set_irg_initial_exec(irg, node) _set_irg_initial_exec(irg, node)
#define get_irg_frame(irg) _get_irg_frame(irg)
#define set_irg_frame(irg, node) _set_irg_frame(irg, node)
#define get_irg_globals(irg) _get_irg_globals(irg)
#define set_irg_globals(irg, node) _set_irg_globals(irg, node)
#define get_irg_tls(irg) _get_irg_tls(irg)
#define set_irg_tls(irg, node) _set_irg_tls(irg, node)
#define get_irg_initial_mem(irg) _get_irg_initial_mem(irg)
......
......@@ -649,22 +649,10 @@ ir_type *is_frame_pointer(const ir_node *n) {
return NULL;
}
/* Test whether arbitrary node is globals pointer, i.e. Proj(pn_Start_P_globals)
* from Start. If so returns global type, else Null. */
ir_type *is_globals_pointer(const ir_node *n) {
if (is_Proj(n) && (get_Proj_proj(n) == pn_Start_P_globals)) {
ir_node *start = get_Proj_pred(n);
if (is_Start(start)) {
return get_glob_type();
}
}
return NULL;
}
/* Test whether arbitrary node is tls pointer, i.e. Proj(pn_Start_P_tls)
* from Start. If so returns tls type, else Null. */
ir_type *is_tls_pointer(const ir_node *n) {
if (is_Proj(n) && (get_Proj_proj(n) == pn_Start_P_globals)) {
if (is_Proj(n) && (get_Proj_proj(n) == pn_Start_P_tls)) {
ir_node *start = get_Proj_pred(n);
if (is_Start(start)) {
return get_tls_type();
......
......@@ -397,9 +397,8 @@ enum irg_anchors {
anchor_start, /**< start node of this ir_graph */
anchor_end_reg, /**< end node of this ir_graph */
anchor_end_except, /**< end node of this ir_graph */
anchor_frame, /**< method's frame */
anchor_globals, /**< pointer to the data segment containing all
globals as well as global procedures. */
anchor_initial_exec, /**< methods initial control flow */
anchor_frame, /**< methods frame */
anchor_tls, /**< pointer to the thread local storage containing all
thread local data. */
anchor_initial_mem, /**< initial memory of this graph */
......
......@@ -304,7 +304,6 @@ static int verify_node_Proj_Start(ir_node *n, ir_node *p) {
(proj == pn_Start_X_initial_exec && mode == mode_X) ||
(proj == pn_Start_M && mode == mode_M) ||
(proj == pn_Start_P_frame_base && mode_is_reference(mode)) ||
(proj == pn_Start_P_globals && mode_is_reference(mode)) ||
(proj == pn_Start_P_tls && mode_is_reference(mode)) ||
(proj == pn_Start_T_args && mode == mode_T) ||
(proj == pn_Start_P_value_arg_base && mode_is_reference(mode)) ||
......
......@@ -54,7 +54,7 @@ static void lower_sel(ir_node *sel) {
/* Do not lower frame type/global offset table access: must be lowered by the backend. */
ptr = get_Sel_ptr(sel);
if (ptr == get_irg_frame(current_ir_graph) || ptr == get_irg_globals(current_ir_graph))
if (ptr == get_irg_frame(current_ir_graph))
return;
ent = get_Sel_entity(sel);
......
......@@ -936,7 +936,6 @@ int inline_method(ir_node *call, ir_graph *called_graph) {
in[pn_Start_X_initial_exec] = new_Jmp();
in[pn_Start_M] = get_Call_mem(call);
in[pn_Start_P_frame_base] = get_irg_frame(irg);
in[pn_Start_P_globals] = get_irg_globals(irg);
in[pn_Start_P_tls] = get_irg_tls(irg);
in[pn_Start_T_args] = new_Tuple(get_Call_n_params(call), get_Call_param_arr(call));
/* in[pn_Start_P_value_arg_base] = ??? */
......
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