Commit 0c2e8bed authored by Matthias Braun's avatar Matthias Braun
Browse files

lowering: fix i_mapper for new exception attributes

parent 195862ac
...@@ -569,7 +569,6 @@ typedef struct runtime_rt { ...@@ -569,7 +569,6 @@ typedef struct runtime_rt {
long mem_proj_nr; /**< if >= 0, create a memory ProjM() */ long mem_proj_nr; /**< if >= 0, create a memory ProjM() */
long regular_proj_nr; /**< if >= 0, create a regular ProjX() */ long regular_proj_nr; /**< if >= 0, create a regular ProjX() */
long exc_proj_nr; /**< if >= 0, create a exception ProjX() */ long exc_proj_nr; /**< if >= 0, create a exception ProjX() */
long exc_mem_proj_nr; /**< if >= 0, create a exception memory ProjM() */
long res_proj_nr; /**< if >= 0, first result projection number */ long res_proj_nr; /**< if >= 0, first result projection number */
} runtime_rt; } runtime_rt;
......
...@@ -323,7 +323,6 @@ static void arm_handle_intrinsics(void) ...@@ -323,7 +323,6 @@ static void arm_handle_intrinsics(void)
rt_iDiv.mem_proj_nr = pn_Div_M; rt_iDiv.mem_proj_nr = pn_Div_M;
rt_iDiv.regular_proj_nr = pn_Div_X_regular; rt_iDiv.regular_proj_nr = pn_Div_X_regular;
rt_iDiv.exc_proj_nr = pn_Div_X_except; rt_iDiv.exc_proj_nr = pn_Div_X_except;
rt_iDiv.exc_mem_proj_nr = pn_Div_M;
rt_iDiv.res_proj_nr = pn_Div_res; rt_iDiv.res_proj_nr = pn_Div_res;
add_entity_linkage(rt_iDiv.ent, IR_LINKAGE_CONSTANT); add_entity_linkage(rt_iDiv.ent, IR_LINKAGE_CONSTANT);
...@@ -350,7 +349,6 @@ static void arm_handle_intrinsics(void) ...@@ -350,7 +349,6 @@ static void arm_handle_intrinsics(void)
rt_uDiv.mem_proj_nr = pn_Div_M; rt_uDiv.mem_proj_nr = pn_Div_M;
rt_uDiv.regular_proj_nr = pn_Div_X_regular; rt_uDiv.regular_proj_nr = pn_Div_X_regular;
rt_uDiv.exc_proj_nr = pn_Div_X_except; rt_uDiv.exc_proj_nr = pn_Div_X_except;
rt_uDiv.exc_mem_proj_nr = pn_Div_M;
rt_uDiv.res_proj_nr = pn_Div_res; rt_uDiv.res_proj_nr = pn_Div_res;
set_entity_visibility(rt_uDiv.ent, ir_visibility_external); set_entity_visibility(rt_uDiv.ent, ir_visibility_external);
...@@ -376,7 +374,6 @@ static void arm_handle_intrinsics(void) ...@@ -376,7 +374,6 @@ static void arm_handle_intrinsics(void)
rt_iMod.mem_proj_nr = pn_Mod_M; rt_iMod.mem_proj_nr = pn_Mod_M;
rt_iMod.regular_proj_nr = pn_Mod_X_regular; rt_iMod.regular_proj_nr = pn_Mod_X_regular;
rt_iMod.exc_proj_nr = pn_Mod_X_except; rt_iMod.exc_proj_nr = pn_Mod_X_except;
rt_iMod.exc_mem_proj_nr = pn_Mod_M;
rt_iMod.res_proj_nr = pn_Mod_res; rt_iMod.res_proj_nr = pn_Mod_res;
set_entity_visibility(rt_iMod.ent, ir_visibility_external); set_entity_visibility(rt_iMod.ent, ir_visibility_external);
...@@ -402,7 +399,6 @@ static void arm_handle_intrinsics(void) ...@@ -402,7 +399,6 @@ static void arm_handle_intrinsics(void)
rt_uMod.mem_proj_nr = pn_Mod_M; rt_uMod.mem_proj_nr = pn_Mod_M;
rt_uMod.regular_proj_nr = pn_Mod_X_regular; rt_uMod.regular_proj_nr = pn_Mod_X_regular;
rt_uMod.exc_proj_nr = pn_Mod_X_except; rt_uMod.exc_proj_nr = pn_Mod_X_except;
rt_uMod.exc_mem_proj_nr = pn_Mod_M;
rt_uMod.res_proj_nr = pn_Mod_res; rt_uMod.res_proj_nr = pn_Mod_res;
set_entity_visibility(rt_uMod.ent, ir_visibility_external); set_entity_visibility(rt_uMod.ent, ir_visibility_external);
......
...@@ -438,7 +438,6 @@ static void sparc_handle_intrinsics(void) ...@@ -438,7 +438,6 @@ static void sparc_handle_intrinsics(void)
rt_iMod.mem_proj_nr = pn_Mod_M; rt_iMod.mem_proj_nr = pn_Mod_M;
rt_iMod.regular_proj_nr = pn_Mod_X_regular; rt_iMod.regular_proj_nr = pn_Mod_X_regular;
rt_iMod.exc_proj_nr = pn_Mod_X_except; rt_iMod.exc_proj_nr = pn_Mod_X_except;
rt_iMod.exc_mem_proj_nr = pn_Mod_M;
rt_iMod.res_proj_nr = pn_Mod_res; rt_iMod.res_proj_nr = pn_Mod_res;
set_entity_visibility(rt_iMod.ent, ir_visibility_external); set_entity_visibility(rt_iMod.ent, ir_visibility_external);
...@@ -464,7 +463,6 @@ static void sparc_handle_intrinsics(void) ...@@ -464,7 +463,6 @@ static void sparc_handle_intrinsics(void)
rt_uMod.mem_proj_nr = pn_Mod_M; rt_uMod.mem_proj_nr = pn_Mod_M;
rt_uMod.regular_proj_nr = pn_Mod_X_regular; rt_uMod.regular_proj_nr = pn_Mod_X_regular;
rt_uMod.exc_proj_nr = pn_Mod_X_except; rt_uMod.exc_proj_nr = pn_Mod_X_except;
rt_uMod.exc_mem_proj_nr = pn_Mod_M;
rt_uMod.res_proj_nr = pn_Mod_res; rt_uMod.res_proj_nr = pn_Mod_res;
set_entity_visibility(rt_uMod.ent, ir_visibility_external); set_entity_visibility(rt_uMod.ent, ir_visibility_external);
......
...@@ -1147,6 +1147,8 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt) ...@@ -1147,6 +1147,8 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt)
ir_type *mtp; ir_type *mtp;
ir_node *mem, *bl, *call, *addr, *res_proj; ir_node *mem, *bl, *call, *addr, *res_proj;
ir_node **in; ir_node **in;
bool throws_exception;
ir_op *op;
ir_graph *irg; ir_graph *irg;
symconst_symbol sym; symconst_symbol sym;
ir_mode *mode = get_irn_mode(node); ir_mode *mode = get_irn_mode(node);
...@@ -1187,15 +1189,17 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt) ...@@ -1187,15 +1189,17 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt)
return 0; return 0;
} }
n_res = get_method_n_ress(mtp); n_res = get_method_n_ress(mtp);
throws_exception = ir_throws_exception(node);
/* step 0: calculate the number of needed Proj's */ /* step 0: calculate the number of needed Proj's */
n_proj = 0; n_proj = 0;
n_proj = LMAX(n_proj, rt->mem_proj_nr + 1); n_proj = LMAX(n_proj, rt->mem_proj_nr + 1);
n_proj = LMAX(n_proj, rt->regular_proj_nr + 1);
n_proj = LMAX(n_proj, rt->exc_proj_nr + 1);
n_proj = LMAX(n_proj, rt->exc_mem_proj_nr + 1);
n_proj = LMAX(n_proj, rt->res_proj_nr + 1); n_proj = LMAX(n_proj, rt->res_proj_nr + 1);
if (throws_exception) {
n_proj = LMAX(n_proj, rt->regular_proj_nr + 1);
n_proj = LMAX(n_proj, rt->exc_proj_nr + 1);
}
if (n_proj > 0) { if (n_proj > 0) {
if (rt->mode != mode_T) /* must be mode_T */ if (rt->mode != mode_T) /* must be mode_T */
...@@ -1209,6 +1213,7 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt) ...@@ -1209,6 +1213,7 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt)
/* ok, when we are here, the number of predecessors match as well as the parameter modes */ /* ok, when we are here, the number of predecessors match as well as the parameter modes */
bl = get_nodes_block(node); bl = get_nodes_block(node);
op = get_irn_op(node);
in = NULL; in = NULL;
if (n_param > 0) { if (n_param > 0) {
...@@ -1236,14 +1241,9 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt) ...@@ -1236,14 +1241,9 @@ int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt)
if (rt->mem_proj_nr >= 0) if (rt->mem_proj_nr >= 0)
set_Tuple_pred(node, rt->mem_proj_nr, new_r_Proj(call, mode_M, pn_Call_M)); set_Tuple_pred(node, rt->mem_proj_nr, new_r_Proj(call, mode_M, pn_Call_M));
if (!is_NoMem(mem)) { if (throws_exception) {
/* Exceptions can only be handled with real memory */ set_Tuple_pred(node, op->pn_x_regular, new_r_Proj(call, mode_X, pn_Call_X_regular));
if (rt->regular_proj_nr >= 0) set_Tuple_pred(node, op->pn_x_except, new_r_Proj(call, mode_X, pn_Call_X_except));
set_Tuple_pred(node, rt->regular_proj_nr, new_r_Proj(call, mode_X, pn_Call_X_regular));
if (rt->exc_proj_nr >= 0)
set_Tuple_pred(node, rt->exc_proj_nr, new_r_Proj(call, mode_X, pn_Call_X_except));
if (rt->exc_mem_proj_nr >= 0)
set_Tuple_pred(node, rt->mem_proj_nr, new_r_Proj(call, mode_M, pn_Call_M));
} }
if (rt->res_proj_nr >= 0) { if (rt->res_proj_nr >= 0) {
......
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