Пример #1
0
ir_graph *create_irg_copy(ir_graph *irg)
{
	ir_graph *res = alloc_graph();

	res->irg_pinned_state = irg->irg_pinned_state;

	/* clone the frame type here for safety */
	irp_reserve_resources(irp, IRP_RESOURCE_ENTITY_LINK);
	res->frame_type  = clone_frame_type(irg->frame_type);

	ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);

	/* copy all nodes from the graph irg to the new graph res */
	irg_walk_anchors(irg, copy_all_nodes, rewire, res);

	/* copy the Anchor node */
	res->anchor = get_new_node(irg->anchor);

	/* -- The end block -- */
	set_irg_end_block (res, get_new_node(get_irg_end_block(irg)));
	set_irg_end       (res, get_new_node(get_irg_end(irg)));

	/* -- The start block -- */
	set_irg_start_block(res, get_new_node(get_irg_start_block(irg)));
	set_irg_no_mem     (res, get_new_node(get_irg_no_mem(irg)));
	set_irg_start      (res, get_new_node(get_irg_start(irg)));

	/* Proj results of start node */
	set_irg_initial_mem(res, get_new_node(get_irg_initial_mem(irg)));

	ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
	irp_free_resources(irp, IRP_RESOURCE_ENTITY_LINK);

	return res;
}
Пример #2
0
void irg_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
              void *env)
{
	ir_graph *irg = get_irn_irg(node);

	ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED);
	inc_irg_visited(irg);
	irg_walk_core(node, pre, post, env);
	ir_free_resources(irg, IR_RESOURCE_IRN_VISITED);
}
Пример #3
0
void ssa_cons_start(ir_graph *irg, int n_loc)
{
	add_irg_constraints(irg, IR_GRAPH_CONSTRAINT_CONSTRUCTION);

	irg_set_nloc(irg, n_loc);

	/*
	 * Note: we could try to reuse existing frag arrays, but it does not
	 * seems worth to do this.  First, we have to check if they really exists and
	 * then clear them.  We do not expect SSA construction is used often.
	 */
	ir_reserve_resources(irg, IR_RESOURCE_PHI_LIST);
	ssa_cons_walker(irg, NULL, prepare_blocks, NULL);
}
Пример #4
0
void analyze_irg_args_weight(ir_graph *irg)
{
	ir_entity *entity = get_irg_entity(irg);
	if (entity == NULL)
		return;

	assert(is_method_entity(entity));
	if (entity->attr.mtd_attr.param_weight != NULL)
		return;

	ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED);
	inc_irg_visited(irg);
	analyze_method_params_weight(entity);
	ir_free_resources(irg, IR_RESOURCE_IRN_VISITED);
}