Exemplo n.º 1
0
ir_node *new_rd_ASM(dbg_info *db, ir_node *block, ir_node *mem,
                    int arity, ir_node *in[], ir_asm_constraint *inputs,
                    size_t n_outs, ir_asm_constraint *outputs, size_t n_clobber,
	                ident *clobber[], ident *text)
{
	ir_graph *const irg = get_irn_irg(block);

	int       const r_arity = arity + 1;
	ir_node **const r_in    = ALLOCAN(ir_node*, r_arity);
	r_in[0] = mem;
	MEMCPY(&r_in[1], in, arity);

	ir_node *res = new_ir_node(db, irg, block, op_ASM, mode_T, r_arity, r_in);

	struct obstack *const obst = get_irg_obstack(irg);
	asm_attr       *const a    = &res->attr.assem;
	a->exc.pinned         = true;
	a->input_constraints  = NEW_ARR_D(ir_asm_constraint, obst, arity);
	a->output_constraints = NEW_ARR_D(ir_asm_constraint, obst, n_outs);
	a->clobbers           = NEW_ARR_D(ident*,            obst, n_clobber);
	a->text               = text;

	MEMCPY(a->input_constraints,  inputs,  arity);
	MEMCPY(a->output_constraints, outputs, n_outs);
	MEMCPY(a->clobbers,           clobber, n_clobber);

	verify_new_node(res);
	res = optimize_node(res);
	return res;
}
Exemplo n.º 2
0
ir_node *be_new_Relocation(dbg_info *const dbgi, ir_graph *const irg, unsigned const kind, ir_entity *const entity, ir_mode *const mode)
{
	ir_node *const block = get_irg_start_block(irg);
	ir_node *const node  = new_ir_node(dbgi, irg, block, op_be_Relocation,
	                                   mode, 0, NULL);
	be_relocation_attr_t *const attr
		= (be_relocation_attr_t*)get_irn_generic_attr(node);
	attr->entity = entity;
	attr->kind   = kind;
	ir_node *const optimized = optimize_node(node);
	return optimized;
}
Exemplo n.º 3
0
ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, arch_register_req_t const *req)
{
	ir_graph *irg  = get_irn_irg(block);
	ir_node  *phi = new_ir_node(NULL, irg, block, op_Phi, req->cls->mode, n_ins, ins);
	phi->attr.phi.u.backedge = new_backedge_arr(get_irg_obstack(irg), n_ins);
	struct obstack *obst = be_get_be_obst(irg);
	backend_info_t *info = be_get_info(phi);
	info->out_infos = NEW_ARR_DZ(reg_out_info_t, obst, 1);
	info->in_reqs   = be_allocate_in_reqs(irg, n_ins);

	info->out_infos[0].req = req;
	for (int i = 0; i < n_ins; ++i) {
		info->in_reqs[i] = req;
	}
	verify_new_node(phi);
	return optimize_node(phi);
}