static ir_node *be_abi_reg_map_get(pmap *map, const arch_register_t *reg)
{
- return (ir_node*)pmap_get(map, reg);
+ return pmap_get(ir_node, map, reg);
}
static void be_abi_reg_map_set(pmap *map, const arch_register_t* reg,
hash = is_res * 128 + pos;
- return (be_abi_call_arg_t*)set_find(call->params, &arg, sizeof(arg), hash);
+ return set_find(be_abi_call_arg_t, call->params, &arg, sizeof(arg), hash);
}
/**
unsigned hash = arg->is_res * 128 + arg->pos;
if (context & ABI_CONTEXT_CALLEE) {
arg->callee = 1;
- set_insert(call->params, arg, sizeof(*arg), hash);
+ (void)set_insert(be_abi_call_arg_t, call->params, arg, sizeof(*arg), hash);
}
if (context & ABI_CONTEXT_CALLER) {
arg->callee = 0;
- set_insert(call->params, arg, sizeof(*arg), hash);
+ (void)set_insert(be_abi_call_arg_t, call->params, arg, sizeof(*arg), hash);
}
}
* @param args the stack argument layout type
* @param between the between layout type
* @param locals the method frame type
- * @param param_map an array mapping method argument positions to the stack argument type
*
* @return the initialized stack layout
*/
static be_stack_layout_t *stack_frame_init(be_stack_layout_t *frame, ir_type *args,
- ir_type *between, ir_type *locals,
- ir_entity *param_map[])
+ ir_type *between, ir_type *locals)
{
frame->arg_type = args;
frame->between_type = between;
frame->initial_offset = 0;
frame->initial_bias = 0;
frame->order[1] = between;
- frame->param_map = param_map;
/* typical decreasing stack: locals have the
* lowest addresses, arguments the highest */
ir_node **in;
ir_node **res_projs;
int n_reg_results = 0;
- const ir_edge_t *edge;
int *reg_param_idxs;
int *stack_param_idx;
int i, n;
arch_env_get_call_abi(arch_env, call_tp, call);
/* Insert code to put the stack arguments on the stack. */
- assert(get_Call_n_params(irn) == n_params);
+ assert((size_t)get_Call_n_params(irn) == n_params);
stack_param_idx = ALLOCAN(int, n_params);
for (p = 0; p < n_params; ++p) {
be_abi_call_arg_t *arg = get_call_arg(call, 0, p, 0);
res_projs = ALLOCANZ(ir_node*, n_res);
foreach_out_edge(irn, edge) {
- const ir_edge_t *res_edge;
- ir_node *irn = get_edge_src_irn(edge);
+ ir_node *irn = get_edge_src_irn(edge);
if (!is_Proj(irn) || get_Proj_proj(irn) != pn_Call_T_result)
continue;
throws_exception = ir_throws_exception(irn);
if (env->call->flags.bits.call_has_imm && is_SymConst(call_ptr)) {
/* direct call */
- low_call = be_new_Call(dbgi, irg, bl, curr_mem, curr_sp, curr_sp,
+ low_call = be_new_Call(dbgi, irg, bl, curr_mem, sp->single_req, curr_sp,
+ sp->single_req, curr_sp,
n_reg_results + pn_be_Call_first_res + ARR_LEN(destroyed_regs),
n_ins, in, get_Call_type(irn));
be_Call_set_entity(low_call, get_SymConst_entity(call_ptr));
} else {
/* indirect call */
- low_call = be_new_Call(dbgi, irg, bl, curr_mem, curr_sp, call_ptr,
+ low_call = be_new_Call(dbgi, irg, bl, curr_mem, sp->single_req, curr_sp,
+ call->cls_addr->class_req, call_ptr,
n_reg_results + pn_be_Call_first_res + ARR_LEN(destroyed_regs),
n_ins, in, get_Call_type(irn));
}
for (i = 0; i < n_res; ++i) {
ir_node *proj = res_projs[i];
be_abi_call_arg_t *arg = get_call_arg(call, 1, i, 0);
- long pn = i + pn_be_Call_first_res;
/* returns values on stack not supported yet */
assert(arg->in_reg);
unspeakable Proj_T from the Call. Therefore, all real argument
Proj numbers must be increased by pn_be_Call_first_res
*/
- pn = i + pn_be_Call_first_res;
+ long pn = i + pn_be_Call_first_res;
if (proj == NULL) {
ir_type *res_type = get_method_res_type(call_tp, i);
}
}
- /*
- Set the register class of the call address to
- the backend provided class (default: stack pointer class)
- */
- be_node_set_reg_class_in(low_call, n_be_Call_ptr, call->cls_addr);
-
DBG((dbg, LEVEL_3, "\tcreated backend call %+F\n", low_call));
/* Set the register classes and constraints of the Call parameters. */
ir_type *type = get_Alloc_type(alloc);
dbg_info *dbg;
- const ir_edge_t *edge;
ir_node *new_alloc;
ir_node *count;
ir_node *size;
*
* @param call the current call ABI
* @param method_type the method type
- * @param param_map an array mapping method arguments to the stack layout
- * type
*
* @return the stack argument layout type
*/
static ir_type *compute_arg_type(ir_graph *irg, be_abi_call_t *call,
- ir_type *method_type, ir_entity ***param_map)
+ ir_type *method_type)
{
struct obstack *obst = be_get_be_obst(irg);
ir_type *frame_type = get_irg_frame_type(irg);
ir_type *res;
size_t i;
- ir_entity **map;
-
- *param_map = map = OALLOCNZ(obst, ir_entity*, n_params);
+ ir_entity **map = OALLOCNZ(obst, ir_entity*, n_params);
res = new_type_struct(new_id_from_chars("arg_type", 8));
/* collect existing entities for value_param_types */
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
dbg_info *dbgi;
pmap *reg_map = pmap_create();
- ir_node *keep = (ir_node*)pmap_get(env->keep_map, bl);
+ ir_node *keep = pmap_get(ir_node, env->keep_map, bl);
size_t in_max;
ir_node *ret;
int i, n;
/* merge start block with successor if possible */
{
- const ir_edge_t *edge;
foreach_out_edge(jmp, edge) {
ir_node *succ = get_edge_src_irn(edge);
if (!is_Block(succ))
ir_node *start_bl;
ir_node **args;
ir_node *arg_tuple;
- const ir_edge_t *edge;
ir_type *arg_type, *bet_type;
lower_frame_sels_env_t ctx;
- ir_entity **param_map;
DBG((dbg, LEVEL_1, "introducing abi on %+F\n", irg));
irp_reserve_resources(irp, IRP_RESOURCE_ENTITY_LINK);
- arg_type = compute_arg_type(irg, call, method_type, ¶m_map);
+ arg_type = compute_arg_type(irg, call, method_type);
/* Convert the Sel nodes in the irg to frame addr nodes: */
ctx.frame = get_irg_frame(irg);
stack_layout->sp_relative = call->flags.bits.try_omit_fp;
bet_type = call->cb->get_between_type(irg);
stack_frame_init(stack_layout, arg_type, bet_type,
- get_irg_frame_type(irg), param_map);
+ get_irg_frame_type(irg));
/* Count the register params and add them to the number of Projs for the RegParams node */
for (i = 0; i < n_params; ++i) {
param_type = get_method_param_type(method_type, nr);
if (arg->in_reg) {
- repl = (ir_node*)pmap_get(env->regs, arg->reg);
+ repl = pmap_get(ir_node, env->regs, arg->reg);
} else if (arg->on_stack) {
ir_node *addr = be_new_FrameAddr(sp->reg_class, start_bl, frame_pointer, arg->stack_ent);
*/
static ir_entity *get_trampoline(be_main_env_t *env, ir_entity *method)
{
- ir_entity *result = (ir_entity*)pmap_get(env->ent_trampoline_map, method);
+ ir_entity *result = pmap_get(ir_entity, env->ent_trampoline_map, method);
if (result == NULL) {
result = create_trampoline(env, method);
pmap_insert(env->ent_trampoline_map, method, result);
static ir_entity *get_pic_symbol(be_main_env_t *env, ir_entity *entity)
{
- ir_entity *result = (ir_entity*)pmap_get(env->ent_pic_symbol_map, entity);
+ ir_entity *result = pmap_get(ir_entity, env->ent_pic_symbol_map, entity);
if (result == NULL) {
result = create_pic_symbol(env, entity);
pmap_insert(env->ent_pic_symbol_map, entity, result);
*/
static int can_address_relative(ir_entity *entity)
{
- return get_entity_visibility(entity) != ir_visibility_external
- && !(get_entity_linkage(entity) & IR_LINKAGE_MERGE);
+ return entity_has_definition(entity) && !(get_entity_linkage(entity) & IR_LINKAGE_MERGE);
}
static ir_node *get_pic_base(ir_graph *irg)
{
be_abi_irg_t *env = XMALLOCZ(be_abi_irg_t);
ir_node *old_frame = get_irg_frame(irg);
- be_options_t *options = be_get_irg_options(irg);
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
ir_entity *entity = get_irg_entity(irg);
ir_type *method_type = get_entity_type(entity);
*/
be_set_irg_abi(irg, env);
- be_omit_fp = options->omit_fp;
+ be_omit_fp = be_options.omit_fp;
env->keep_map = pmap_create();
env->call = be_abi_call_new(arch_env->sp->reg_class);
env->init_sp = dummy;
env->calls = NEW_ARR_F(ir_node*, 0);
- edges_assure(irg);
+ assure_edges(irg);
- if (options->pic) {
+ if (be_options.pic) {
irg_walk_graph(irg, fix_pic_symconsts, NULL, env);
}