Esempio n. 1
0
static int sparc_get_sp_bias(const ir_node *node)
{
	if (be_is_IncSP(node))
		return be_get_IncSP_offset(node);
	if (is_sparc_Save(node)) {
		const sparc_attr_t *attr = get_sparc_attr_const(node);
		if (get_irn_arity(node) == 3)
			panic("no support for _reg variant yet");

		return -attr->immediate_value;
	}
	if (is_sparc_RestoreZero(node))
		return SP_BIAS_RESET;
	return 0;
}
Esempio n. 2
0
/**
 * Dumper interface for dumping sparc nodes in vcg.
 * @param F        the output file
 * @param n        the node to dump
 * @param reason   indicates which kind of information should be dumped
 */
static void sparc_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
{
	switch (reason) {
	case dump_node_opcode_txt:
		fprintf(F, "%s", get_irn_opname(n));
		break;

	case dump_node_mode_txt:
		break;

	case dump_node_info_txt:
		arch_dump_reqs_and_registers(F, n);
		const sparc_attr_t *sparc_attr = get_sparc_attr_const(n);
		if (sparc_attr->immediate_value_entity) {
			ir_fprintf(F, "entity: %+F (offset %d)\n",
			           sparc_attr->immediate_value_entity,
			           sparc_attr->immediate_value);
		} else {
			ir_fprintf(F, "immediate value: %d\n", sparc_attr->immediate_value);
		}
		if (sparc_has_load_store_attr(n)) {
			const sparc_load_store_attr_t *attr = get_sparc_load_store_attr_const(n);
			ir_fprintf(F, "load store mode: %+F\n", attr->load_store_mode);
			fprintf(F, "is frame entity: %s\n",
			        attr->is_frame_entity ? "true" : "false");
		}
		if (has_jmp_cond_attr(n)) {
			const sparc_jmp_cond_attr_t *attr
				= get_sparc_jmp_cond_attr_const(n);
			fprintf(F, "relation: %d (%s)\n", (int)attr->relation,
			        get_relation_string(attr->relation));
			fprintf(F, "unsigned: %s\n", attr->is_unsigned ? "true" : "false");
		}
		if (has_fp_attr(n)) {
			const sparc_fp_attr_t *attr = get_sparc_fp_attr_const(n);
			ir_fprintf(F, "fp_mode: %+F\n", attr->fp_mode);
		}
		if (has_fp_conv_attr(n)) {
			const sparc_fp_conv_attr_t *attr = get_sparc_fp_conv_attr_const(n);
			ir_fprintf(F, "conv from: %+F\n", attr->src_mode);
			ir_fprintf(F, "conv to: %+F\n", attr->dest_mode);
		}
		break;

	case dump_node_nodeattr_txt:
		break;
	}
}
Esempio n. 3
0
ir_entity *sparc_get_frame_entity(const ir_node *node)
{
	if (be_is_MemPerm(node))
		return be_get_MemPerm_in_entity(node, 0);
	if (is_sparc_FrameAddr(node)) {
		const sparc_attr_t *attr = get_sparc_attr_const(node);
		return attr->immediate_value_entity;
	}

	if (sparc_has_load_store_attr(node)) {
		const sparc_load_store_attr_t *load_store_attr
			= get_sparc_load_store_attr_const(node);
		if (load_store_attr->is_frame_entity) {
			return load_store_attr->base.immediate_value_entity;
		}
	}

	return NULL;
}