示例#1
0
arch_register_req_t *be_create_cls_req(ir_graph *const irg, arch_register_class_t const *const cls, unsigned char const width)
{
	struct obstack      *const obst = be_get_be_obst(irg);
	arch_register_req_t *const req  = OALLOCZ(obst, arch_register_req_t);
	req->cls   = cls;
	req->width = width;
	return req;
}
示例#2
0
static irn_height_t *get_height_data(ir_heights_t *heights, const ir_node *node)
{
	irn_height_t *height = ir_nodemap_get(irn_height_t, &heights->data, node);
	if (height == NULL) {
		height = OALLOCZ(&heights->obst, irn_height_t);
		ir_nodemap_insert(&heights->data, node, height);
	}
	return height;
}
示例#3
0
文件: driver.c 项目: MatzeB/cparser
void driver_add_input(const char *filename, compilation_unit_type_t type)
{
	compilation_unit_t *entry = OALLOCZ(&file_obst, compilation_unit_t);
	entry->name          = filename;
	entry->original_name = filename;
	entry->type          = type;

	*unit_anchor = entry;
	unit_anchor  = &entry->next;
}
示例#4
0
/*
 * Creates a new mode.
 */
static ir_mode *alloc_mode(const char *name, ir_mode_sort sort,
                           ir_mode_arithmetic arithmetic, unsigned bit_size,
                           int sign, unsigned modulo_shift)
{
    ir_mode *mode_tmpl = OALLOCZ(&modes, ir_mode);

    mode_tmpl->name         = new_id_from_str(name);
    mode_tmpl->sort         = sort;
    mode_tmpl->size         = bit_size;
    mode_tmpl->sign         = sign ? 1 : 0;
    mode_tmpl->modulo_shift = modulo_shift;
    mode_tmpl->arithmetic   = arithmetic;
    return mode_tmpl;
}
示例#5
0
const arch_register_req_t *be_create_reg_req(struct obstack *obst,
                                             const arch_register_t *reg,
                                             bool ignore)
{
	arch_register_class_t const *cls     = reg->cls;
	unsigned                    *limited
		= rbitset_obstack_alloc(obst, cls->n_regs);
	rbitset_set(limited, reg->index);
	arch_register_req_t *req = OALLOCZ(obst, arch_register_req_t);
	req->cls     = cls;
	req->limited = limited;
	req->width   = 1;
	req->ignore  = ignore;
	return req;
}
示例#6
0
arch_register_req_t const *be_create_reg_req(ir_graph *const irg, arch_register_t const *const reg, bool const ignore)
{
	if (!ignore)
		return reg->single_req;

	struct obstack              *const obst    = be_get_be_obst(irg);
	arch_register_class_t const *const cls     = reg->cls;
	unsigned                    *const limited = rbitset_obstack_alloc(obst, cls->n_regs);
	rbitset_set(limited, reg->index);
	arch_register_req_t *const req = OALLOCZ(obst, arch_register_req_t);
	req->cls     = cls;
	req->limited = limited;
	req->width   = 1;
	req->ignore  = ignore;
	return req;
}
示例#7
0
文件: beinfo.c 项目: lamproae/libfirm
void be_info_new_node(ir_graph *irg, ir_node *node)
{
	/* Projs need no be info, all info is fetched from their predecessor */
	if (is_Proj(node))
		return;

	struct obstack *obst = be_get_be_obst(irg);
	backend_info_t *info = OALLOCZ(obst, backend_info_t);

	assert(node->backend_info == NULL);
	node->backend_info = info;

	/*
	 * Set backend info for some middleend nodes which still appear in
	 * backend graphs
	 */
	arch_irn_flags_t           flags = arch_irn_flag_not_scheduled;
	arch_register_req_t const *req   = arch_no_register_req;
	switch (get_irn_opcode(node)) {
	case iro_Block:
	case iro_Dummy:
	case iro_Anchor:
	case iro_Bad:
	case iro_End:
	case iro_Unknown:
		break;
	case iro_NoMem:
	case iro_Pin:
	case iro_Sync:
		req = arch_memory_req;
		break;
	case iro_Phi:
		flags = arch_irn_flag_schedule_first;
		break;
	default:
		return;
	}

	info->flags     = flags;
	info->out_infos = NEW_ARR_DZ(reg_out_info_t, obst, 1);
	info->out_infos[0].req = req;
}
示例#8
0
static void arm_generate_code(FILE *output, const char *cup_name)
{
	be_gas_emit_types = false;
	be_gas_elf_type_char = '%';

	be_begin(output, cup_name);
	unsigned *const sp_is_non_ssa = rbitset_alloca(N_ARM_REGISTERS);
	rbitset_set(sp_is_non_ssa, REG_SP);

	arm_emit_file_prologue();

	foreach_irp_irg(i, irg) {
		if (!be_step_first(irg))
			continue;

		struct obstack *obst = be_get_be_obst(irg);
		be_birg_from_irg(irg)->isa_link = OALLOCZ(obst, arm_irg_data_t);

		be_birg_from_irg(irg)->non_ssa_regs = sp_is_non_ssa;
		arm_select_instructions(irg);

		be_step_schedule(irg);

		be_timer_push(T_RA_PREPARATION);
		be_sched_fix_flags(irg, &arm_reg_classes[CLASS_arm_flags], NULL, NULL, NULL);
		be_timer_pop(T_RA_PREPARATION);

		be_step_regalloc(irg, &arm_regalloc_if);

		be_timer_push(T_EMIT);
		arm_finish_graph(irg);
		arm_emit_function(irg);
		be_timer_pop(T_EMIT);

		be_step_last(irg);
	}

	be_finish();
}
示例#9
0
be_insn_t *be_scan_insn(be_chordal_env_t *const env, ir_node *const irn)
{
	struct obstack              *const obst = &env->obst;
	const arch_register_class_t *const cls = env->cls;

	be_insn_t *const insn = OALLOCZ(obst, be_insn_t);
	insn->irn = irn;
	be_operand_t o;
	bool has_constraints = false;
	be_foreach_definition(irn, cls, p, req,
		/* found a def: create a new operand */
		if (req->limited != NULL) {
			o.regs          = req->limited;
			has_constraints = true;
		} else {
			o.regs           = env->allocatable_regs->data;
			has_constraints |= req->width > 1;
		}
		o.carrier = p;
		o.partner = NULL;
		obstack_grow(obst, &o, sizeof(o));
		insn->n_ops++;
	);
示例#10
0
void ia32_init_op(ir_op *op, unsigned latency)
{
	ia32_op_attr_t *attr = OALLOCZ(&opcodes_obst, ia32_op_attr_t);
	attr->latency = latency;
	set_op_attr(op, attr);
}
示例#11
0
文件: ircfscc.c 项目: qznc/libfirm
/** Allocate a new scc_info on the given obstack */
static inline scc_info *new_scc_info(struct obstack *obst)
{
	return OALLOCZ(obst, scc_info);
}
示例#12
0
static arch_register_req_t *allocate_reg_req(ir_graph *const irg)
{
	struct obstack *obst = be_get_be_obst(irg);
	arch_register_req_t *req = OALLOCZ(obst, arch_register_req_t);
	return req;
}