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

Add an ir_mode * parameter to all SymConst constructors (avoiding the...

Add an ir_mode * parameter to all SymConst constructors (avoiding the "builtin" mode_Is/mode_P_data)

[r16911]
parent a9e97387
This diff is collapsed.
......@@ -87,7 +87,7 @@ static ir_node *own_gen_convert_call(ppc32_transform_env_t *env, ir_node *op, co
set_method_res_type(method_type, 0, new_type_primitive(new_id_from_str("conv_result"), to_mode));
method_ent = new_entity(get_glob_type(), new_id_from_str(funcname), method_type);
callee = new_rd_SymConst_addr_ent(env->dbg, env->irg, method_ent, method_type);
callee = new_rd_SymConst_addr_ent(env->dbg, env->irg, mode_P_code, method_ent, method_type);
call = new_rd_Call(env->dbg, env->irg, env->block, memory, callee, 1, in, method_type);
call_results = new_rd_Proj(env->dbg, env->irg, env->block, call, mode_T, pn_Call_T_result);
memory = new_rd_Proj(env->dbg, env->irg, env->block, call, mode_M, pn_Call_M_regular);
......
......@@ -592,18 +592,10 @@ new_bd_Sel(dbg_info *db, ir_node *block, ir_node *store, ir_node *objptr,
} /* new_bd_Sel */
static ir_node *
new_bd_SymConst_type(dbg_info *db, ir_node *block, symconst_symbol value,
symconst_kind symkind, ir_type *tp) {
ir_node *res;
ir_mode *mode;
new_bd_SymConst_type(dbg_info *db, ir_node *block, ir_mode *mode,
symconst_symbol value,symconst_kind symkind, ir_type *tp) {
ir_graph *irg = current_ir_graph;
if ((symkind == symconst_addr_name) || (symkind == symconst_addr_ent))
mode = mode_P_data; /* FIXME: can be mode_P_code */
else
mode = mode_Iu;
res = new_ir_node(db, irg, block, op_SymConst, mode, 0, NULL);
ir_node *res = new_ir_node(db, irg, block, op_SymConst, mode, 0, NULL);
res->attr.symc.num = symkind;
res->attr.symc.sym = value;
......@@ -1196,59 +1188,58 @@ new_rd_Sel(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store, ir_node
} /* new_rd_Sel */
ir_node *
new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_node *block, symconst_symbol value,
symconst_kind symkind, ir_type *tp) {
new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
symconst_symbol value, symconst_kind symkind, ir_type *tp) {
ir_node *res;
ir_graph *rem = current_ir_graph;
current_ir_graph = irg;
res = new_bd_SymConst_type(db, block, value, symkind, tp);
res = new_bd_SymConst_type(db, block, mode, value, symkind, tp);
current_ir_graph = rem;
return res;
} /* new_rd_SymConst_type */
ir_node *
new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_node *block, symconst_symbol value,
symconst_kind symkind) {
ir_node *res = new_rd_SymConst_type(db, irg, block, value, symkind, firm_unknown_type);
return res;
new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
symconst_symbol value, symconst_kind symkind) {
return new_rd_SymConst_type(db, irg, block, mode, value, symkind, firm_unknown_type);
} /* new_rd_SymConst */
ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp) {
ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_entity *symbol, ir_type *tp) {
symconst_symbol sym;
sym.entity_p = symbol;
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), sym, symconst_addr_ent, tp);
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), mode, sym, symconst_addr_ent, tp);
} /* new_rd_SymConst_addr_ent */
ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp) {
ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_entity *symbol, ir_type *tp) {
symconst_symbol sym;
sym.entity_p = symbol;
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), sym, symconst_ofs_ent, tp);
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), mode, sym, symconst_ofs_ent, tp);
} /* new_rd_SymConst_ofs_ent */
ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp) {
ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode, ident *symbol, ir_type *tp) {
symconst_symbol sym;
sym.ident_p = symbol;
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), sym, symconst_addr_name, tp);
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), mode, sym, symconst_addr_name, tp);
} /* new_rd_SymConst_addr_name */
ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp) {
ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp) {
symconst_symbol sym;
sym.type_p = symbol;
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), sym, symconst_type_tag, tp);
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), mode, sym, symconst_type_tag, tp);
} /* new_rd_SymConst_type_tag */
ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp) {
ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp) {
symconst_symbol sym;
sym.type_p = symbol;
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), sym, symconst_type_size, tp);
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), mode, sym, symconst_type_size, tp);
} /* new_rd_SymConst_size */
ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp) {
ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode, ir_type *symbol, ir_type *tp) {
symconst_symbol sym;
sym.type_p = symbol;
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), sym, symconst_type_align, tp);
return new_rd_SymConst_type(db, irg, get_irg_start_block(irg), mode, sym, symconst_type_align, tp);
} /* new_rd_SymConst_align */
ir_node *
......@@ -1493,9 +1484,9 @@ ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
ir_mode *mode, tarval *con, ir_type *tp) {
return new_rd_Const_type(NULL, irg, block, mode, con, tp);
}
ir_node *new_r_SymConst(ir_graph *irg, ir_node *block,
ir_node *new_r_SymConst(ir_graph *irg, ir_node *block, ir_mode *mode,
symconst_symbol value, symconst_kind symkind) {
return new_rd_SymConst(NULL, irg, block, value, symkind);
return new_rd_SymConst(NULL, irg, block, mode, value, symkind);
}
ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
ir_node *objptr, ir_entity *ent) {
......@@ -2521,14 +2512,14 @@ new_d_Sel(dbg_info *db, ir_node *store, ir_node *objptr, int n_index, ir_node **
} /* new_d_Sel */
ir_node *
new_d_SymConst_type(dbg_info *db, symconst_symbol value, symconst_kind kind, ir_type *tp) {
return new_bd_SymConst_type(db, get_irg_start_block(current_ir_graph),
new_d_SymConst_type(dbg_info *db, ir_mode *mode, symconst_symbol value, symconst_kind kind, ir_type *tp) {
return new_bd_SymConst_type(db, get_irg_start_block(current_ir_graph), mode,
value, kind, tp);
} /* new_d_SymConst_type */
ir_node *
new_d_SymConst(dbg_info *db, symconst_symbol value, symconst_kind kind) {
return new_bd_SymConst_type(db, get_irg_start_block(current_ir_graph),
new_d_SymConst(dbg_info *db, ir_mode *mode, symconst_symbol value, symconst_kind kind) {
return new_bd_SymConst_type(db, get_irg_start_block(current_ir_graph), mode,
value, kind, firm_unknown_type);
} /* new_d_SymConst */
......@@ -2895,11 +2886,11 @@ ir_node *new_Const_type(tarval *con, ir_type *tp) {
return new_d_Const_type(NULL, get_type_mode(tp), con, tp);
}
ir_node *new_SymConst_type(symconst_symbol value, symconst_kind kind, ir_type *type) {
return new_d_SymConst_type(NULL, value, kind, type);
ir_node *new_SymConst_type(ir_mode *mode, symconst_symbol value, symconst_kind kind, ir_type *type) {
return new_d_SymConst_type(NULL, mode, value, kind, type);
}
ir_node *new_SymConst(symconst_symbol value, symconst_kind kind) {
return new_d_SymConst(NULL, value, kind);
ir_node *new_SymConst(ir_mode *mode, symconst_symbol value, symconst_kind kind) {
return new_d_SymConst(NULL, mode, value, kind);
}
ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent) {
return new_d_simpleSel(NULL, store, objptr, ent);
......
......@@ -3358,8 +3358,8 @@ static ir_node *transform_node_Cast(ir_node *n) {
get_Const_tarval(pred), tp);
DBG_OPT_CSTEVAL(oldn, n);
} else if (is_SymConst(pred) && get_SymConst_value_type(pred) != tp) {
n = new_rd_SymConst_type(NULL, current_ir_graph, get_irn_n(pred, -1), get_SymConst_symbol(pred),
get_SymConst_kind(pred), tp);
n = new_rd_SymConst_type(NULL, current_ir_graph, get_irn_n(pred, -1), get_irn_mode(pred),
get_SymConst_symbol(pred), get_SymConst_kind(pred), tp);
DBG_OPT_CSTEVAL(oldn, n);
}
......
......@@ -220,14 +220,14 @@ gen_initializer_irg(ir_entity * ent_filename, ir_entity * bblock_id, ir_entity *
start_block = get_irg_start_block(irg);
sym.entity_p = init_ent;
symconst = new_r_SymConst(irg, start_block, sym, symconst_addr_ent);
symconst = new_r_SymConst(irg, start_block, mode_P_data, sym, symconst_addr_ent);
sym.entity_p = ent_filename;
ins[0] = new_r_SymConst(irg, start_block, sym, symconst_addr_ent);
ins[0] = new_r_SymConst(irg, start_block, mode_P_data, sym, symconst_addr_ent);
sym.entity_p = bblock_id;
ins[1] = new_r_SymConst(irg, start_block, sym, symconst_addr_ent);
ins[1] = new_r_SymConst(irg, start_block, mode_P_data, sym, symconst_addr_ent);
sym.entity_p = bblock_counts;
ins[2] = new_r_SymConst(irg, start_block, sym, symconst_addr_ent);
ins[2] = new_r_SymConst(irg, start_block, mode_P_data, sym, symconst_addr_ent);
ins[3] = new_r_Const_long(irg, start_block, mode_Iu, n_blocks);
call = new_r_Call(irg, bb, get_irg_initial_mem(irg), symconst, 4, ins, init_type);
......@@ -449,7 +449,7 @@ ir_profile_instrument(const char *filename, unsigned flags)
/* generate a symbolic constant pointing to the count array */
sym.entity_p = bblock_counts;
wd.symconst = new_r_SymConst(irg, get_irg_start_block(irg), sym, symconst_addr_ent);
wd.symconst = new_r_SymConst(irg, get_irg_start_block(irg), mode_P_data, sym, symconst_addr_ent);
irg_block_walk_graph(irg, block_id_walker, NULL, &wd);
start_block = get_irg_start_block(irg);
......@@ -509,7 +509,7 @@ ir_profile_instrument(const char *filename, unsigned flags)
set_compound_graph_path_node(path, 1, loc_name);
if (wd.locs[i].fname) {
sym.entity_p = wd.locs[i].fname;
n = new_SymConst(sym, symconst_addr_ent);
n = new_SymConst(mode_P_data, sym, symconst_addr_ent);
} else {
n = new_Const(mode_P_data, get_mode_null(mode_P_data));
}
......
......@@ -525,7 +525,7 @@ static ir_node *get_intrinsic_address(ir_type *method, ir_op *op,
ent = entry->ent;
} /* if */
sym.entity_p = ent;
return new_r_SymConst(current_ir_graph, block, sym, symconst_addr_ent);
return new_r_SymConst(current_ir_graph, block, mode_P_code, sym, symconst_addr_ent);
} /* get_intrinsic_address */
/**
......
......@@ -79,7 +79,7 @@ static void lower_sel(ir_node *sel) {
sym.entity_p = ent;
bl = get_nodes_block(sel);
cnst = new_rd_SymConst(dbg, irg, bl, sym, symconst_addr_ent);
cnst = new_rd_SymConst(dbg, irg, bl, mode, sym, symconst_addr_ent);
newn = new_rd_Add(dbg, irg, bl, ptr, cnst, mode);
} else {
/* not TLS */
......@@ -195,9 +195,9 @@ static void lower_sel(ir_node *sel) {
mode);
}
} else if (is_Method_type(get_entity_type(ent)) &&
is_Class_type(owner) &&
(owner != get_glob_type()) &&
(!is_frame_type(owner))) {
is_Class_type(owner) &&
(owner != get_glob_type()) &&
(!is_frame_type(owner))) {
ir_node *add;
ir_mode *ent_mode = get_type_mode(get_entity_type(ent));
......@@ -223,7 +223,7 @@ static void lower_sel(ir_node *sel) {
newn = new_rd_Add(dbg, irg, bl, get_Sel_ptr(sel), cnst, mode);
} else {
/* global_type */
newn = new_rd_SymConst_addr_ent(NULL, current_ir_graph, ent, firm_unknown_type);
newn = new_rd_SymConst_addr_ent(NULL, current_ir_graph, mode, ent, firm_unknown_type);
}
}
/* run the hooks */
......
......@@ -924,7 +924,7 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt) {
/* step 1: create the call */
sym.entity_p = rt->ent;
addr = new_r_SymConst(irg, bl, sym, symconst_addr_ent);
addr = new_r_SymConst(irg, bl, mode_P_code, sym, symconst_addr_ent);
call = new_rd_Call(get_irn_dbg_info(node), irg, bl, mem, addr, n_param, in, mtp);
set_irn_pinned(call, get_irn_pinned(node));
......
......@@ -438,7 +438,7 @@ static ir_entity *clone_method(quadruple_t *q) {
sym.entity_p = new_entity;
rem = current_ir_graph;
current_ir_graph = get_const_code_irg();
new_entity->value = new_SymConst(sym, symconst_addr_ent);
new_entity->value = new_SymConst(mode_P_code, sym, symconst_addr_ent);
current_ir_graph = rem;
/* The "new_entity" don't have this information. */
......@@ -465,7 +465,7 @@ static ir_node *new_cl_Call(ir_node *call, ir_entity *new_entity, int pos) {
ir_node *bl = get_nodes_block(call);
sym.entity_p = new_entity;
callee = new_r_SymConst(irg, bl, sym, symconst_addr_ent);
callee = new_r_SymConst(irg, bl, mode_P_code, sym, symconst_addr_ent);
mtp = get_entity_type(new_entity);
n_params = get_Call_n_params(call);
......
......@@ -157,10 +157,11 @@ new_rd_entity(dbg_info *db, ir_type *owner, ident *name, ir_type *type)
if (is_Method_type(type)) {
symconst_symbol sym;
ir_mode *mode = is_Method_type(type) ? mode_P_code : mode_P_data;
sym.entity_p = res;
rem = current_ir_graph;
current_ir_graph = get_const_code_irg();
res->value = new_SymConst(sym, symconst_addr_ent);
res->value = new_SymConst(mode, sym, symconst_addr_ent);
current_ir_graph = rem;
res->allocation = allocation_static;
res->variability = variability_constant;
......@@ -651,7 +652,7 @@ ir_node *copy_const_value(dbg_info *dbg, ir_node *n) {
nn = new_d_Const_type(dbg, m, get_Const_tarval(n), get_Const_type(n));
break;
case iro_SymConst:
nn = new_d_SymConst_type(dbg, get_SymConst_symbol(n), get_SymConst_kind(n),
nn = new_d_SymConst_type(dbg, get_irn_mode(n), get_SymConst_symbol(n), get_SymConst_kind(n),
get_SymConst_value_type(n));
break;
case iro_Add:
......@@ -1369,5 +1370,6 @@ void firm_init_entity(void)
current_ir_graph = get_const_code_irg();
sym.entity_p = unknown_entity;
unknown_entity->value = new_SymConst(sym, symconst_addr_ent);
/* TODO: we need two unknown_entities here, one for code and one for data */
unknown_entity->value = new_SymConst(mode_P_data, sym, symconst_addr_ent);
} /* firm_init_entity */
Supports Markdown
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