Beispiel #1
0
static void sparc_determine_frameoffset(ir_node *const node,
                                        int const sp_offset)
{
	if (is_sparc_FrameAddr(node)) {
		sparc_attr_t    *const attr   = get_sparc_attr(node);
		ir_entity const *const entity = attr->immediate_value_entity;
		if (entity != NULL) {
			attr->immediate_value += get_entity_offset(entity);
			if (node_has_sp_base(node))
				attr->immediate_value += sp_offset + SPARC_MIN_STACKSIZE;
		}
	} else if (sparc_has_load_store_attr(node)) {
		sparc_load_store_attr_t *const attr = get_sparc_load_store_attr(node);
		if (!attr->is_frame_entity)
			return;
		ir_entity const *const entity
			= attr->base.immediate_value_entity;
		if (entity != NULL) {
			attr->base.immediate_value += get_entity_offset(entity);
			if (node_has_sp_base(node))
				attr->base.immediate_value += sp_offset + SPARC_MIN_STACKSIZE;
		}
	} else if (be_is_MemPerm(node)) {
		ir_graph *irg = get_irn_irg(node);
		if (sparc_get_irg_data(irg)->omit_fp)
			be_set_MemPerm_offset(node, sp_offset + SPARC_MIN_STACKSIZE);
	}
}
static void sparc_set_frame_offset(ir_node *node, int offset)
{
	if (be_is_MemPerm(node)) {
		be_set_MemPerm_offset(node, offset);
	} else {
		sparc_attr_t *attr = get_sparc_attr(node);
		attr->immediate_value += offset;

		/* must be a FrameAddr or a load/store node with frame_entity */
		assert(is_sparc_FrameAddr(node) ||
				get_sparc_load_store_attr_const(node)->is_frame_entity);
	}
}