Beispiel #1
0
ir_label_t get_ia32_exc_label_id(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);

	assert(attr->has_except_label);
	return attr->exc_label;
}
Beispiel #2
0
const ia32_immediate_attr_t *get_ia32_immediate_attr_const(const ir_node *node)
{
	const ia32_attr_t           *attr     = get_ia32_attr_const(node);
	const ia32_immediate_attr_t *imm_attr = CONST_CAST_IA32_ATTR(ia32_immediate_attr_t, attr);

	return imm_attr;
}
Beispiel #3
0
const ia32_climbframe_attr_t *get_ia32_climbframe_attr_const(const ir_node *node)
{
	const ia32_attr_t            *attr            = get_ia32_attr_const(node);
	const ia32_climbframe_attr_t *climbframe_attr = CONST_CAST_IA32_ATTR(ia32_climbframe_attr_t, attr);

	return climbframe_attr;
}
Beispiel #4
0
const ia32_condcode_attr_t *get_ia32_condcode_attr_const(const ir_node *node)
{
	assert(has_ia32_condcode_attr(node));
	const ia32_attr_t          *attr    = get_ia32_attr_const(node);
	const ia32_condcode_attr_t *cc_attr = CONST_CAST_IA32_ATTR(ia32_condcode_attr_t, attr);

	return cc_attr;
}
Beispiel #5
0
void ia32_copy_am_attrs(ir_node *to, const ir_node *from)
{
	ia32_attr_t const *const from_attr = get_ia32_attr_const(from);
	ia32_attr_t       *const to_attr   = get_ia32_attr(to);
	to_attr->addr      = from_attr->addr;
	to_attr->frame_use = from_attr->frame_use;
	to_attr->size      = from_attr->size;

#ifndef NDEBUG
	to_attr->old_frame_ent = from_attr->old_frame_ent;
#endif
}
Beispiel #6
0
void ia32_copy_am_attrs(ir_node *to, const ir_node *from)
{
	ia32_attr_t const *const from_attr = get_ia32_attr_const(from);
	ia32_attr_t       *const to_attr   = get_ia32_attr(to);
	to_attr->am_imm = from_attr->am_imm;
	to_attr->frame_use = from_attr->frame_use;

	set_ia32_ls_mode(to, get_ia32_ls_mode(from));
	set_ia32_am_scale(to, get_ia32_am_scale(from));
#ifndef NDEBUG
	to_attr->old_frame_ent = from_attr->old_frame_ent;
#endif
}
Beispiel #7
0
ia32_am_type_t get_ia32_am_support(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return (ia32_am_type_t)attr->am_arity;
}
Beispiel #8
0
ia32_op_type_t get_ia32_op_type(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return (ia32_op_type_t)attr->tp;
}
Beispiel #9
0
const ia32_copyb_attr_t *get_ia32_copyb_attr_const(const ir_node *node)
{
	ia32_attr_t const *const attr = get_ia32_attr_const(node);
	return CONST_CAST_IA32_ATTR(ia32_copyb_attr_t, attr);
}
Beispiel #10
0
int is_ia32_is_remat(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->is_remat;
}
Beispiel #11
0
bool get_ia32_am_tls_segment(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->am_tls_segment;
}
Beispiel #12
0
ir_entity *get_ia32_am_ent(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->am_imm.entity;
}
Beispiel #13
0
int32_t get_ia32_am_offs_int(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->am_imm.offset;
}
Beispiel #14
0
const ia32_return_attr_t *get_ia32_return_attr_const(const ir_node *node)
{
	const ia32_attr_t        *attr        = get_ia32_attr_const(node);
	const ia32_return_attr_t *return_attr = CONST_CAST_IA32_ATTR(ia32_return_attr_t, attr);
	return return_attr;
}
Beispiel #15
0
int is_ia32_commutative(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->is_commutative;
}
Beispiel #16
0
int is_ia32_is_spill(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->is_spill;
}
Beispiel #17
0
unsigned get_ia32_am_scale(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->am_scale;
}
Beispiel #18
0
unsigned get_ia32_exc_label(const ir_node *node)
{
	const ia32_attr_t *attr = get_ia32_attr_const(node);
	return attr->has_except_label;
}
Beispiel #19
0
void ia32_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));

			if (is_ia32_Immediate(n) || is_ia32_Const(n)) {
				ia32_immediate_attr_t const *const attr
					= get_ia32_immediate_attr_const(n);
				fputc(' ', F);
				ia32_dump_immediate(F, attr->imm.entity, attr->imm.offset);
			} else {
				ia32_attr_t const *const attr   = get_ia32_attr_const(n);
				int32_t            const offset = attr->addr.immediate.offset;
				ir_entity         *const entity = attr->addr.immediate.entity;
				if (entity || offset != 0) {
					fputs(" [", F);
					ia32_dump_immediate(F, entity, offset);
					fputc(']', F);
				}
			}
			break;

		case dump_node_mode_txt:
			break;

		case dump_node_nodeattr_txt:
			if (! is_ia32_Lea(n)) {
				switch (get_ia32_op_type(n)) {
				case ia32_Normal:    break;
				case ia32_AddrModeS: fprintf(F, "[AM S] "); break;
				case ia32_AddrModeD: fprintf(F, "[AM D] "); break;
				}
			}
			break;

		case dump_node_info_txt:
			/* dump op type */
			fprintf(F, "op = ");
			switch (get_ia32_op_type(n)) {
				case ia32_Normal:
					fprintf(F, "Normal");
					break;
				case ia32_AddrModeD:
					fprintf(F, "AM Dest (Load+Store)");
					break;
				case ia32_AddrModeS:
					fprintf(F, "AM Source (Load)");
					break;
				default:
					fprintf(F, "unknown (%d)", (int)get_ia32_op_type(n));
					break;
			}
			fprintf(F, "\n");

			/* dump supported am */
			fprintf(F, "AM support = ");
			switch (get_ia32_am_support(n)) {
				case ia32_am_none:   fputs("none\n",            F); break;
				case ia32_am_unary:  fputs("source (unary)\n",  F); break;
				case ia32_am_binary: fputs("source (binary)\n", F); break;

				default:
					fprintf(F, "unknown (%d)\n", (int)get_ia32_am_support(n));
					break;
			}

			const ia32_attr_t *attr = get_ia32_attr_const(n);
			fputs("AM immediate = ", F);
			x86_dump_imm32(&attr->addr.immediate, F);
			fputc('\n', F);

			/* dump AM scale */
			fprintf(F, "AM log_scale = %u\n", attr->addr.log_scale);

			/* dump pn code */
			if (has_ia32_condcode_attr(n)) {
				const char *cc_name = condition_code_name(get_ia32_condcode(n));
				if (cc_name) {
					fprintf(F, "condition_code = %s\n", cc_name);
				} else {
					fprintf(F, "condition_code = <invalid (0x%X)>\n",
					        (unsigned)get_ia32_condcode(n));
				}
				fprintf(F, "ins_permuted = %s\n",
				        be_dump_yesno(attr->ins_permuted));
			} else if (is_ia32_CopyB(n) || is_ia32_CopyB_i(n)) {
				fprintf(F, "size = %u\n", get_ia32_copyb_size(n));
			} else if (has_ia32_x87_attr(n)) {
				ia32_x87_attr_t const *const attr = get_ia32_x87_attr_const(n);
				fprintf(F, "explicit operand = %s\n",
				        be_dump_reg_name(attr->x87.reg));
				fprintf(F, "result to explicit operand = %s\n",
				        be_dump_yesno(attr->x87.res_in_reg));
				fprintf(F, "pop = %s\n", be_dump_yesno(attr->x87.pop));
			}

			fprintf(F, "commutative = %s\n",
			        be_dump_yesno(is_ia32_commutative(n)));
			fprintf(F, "sign_extend = %s\n", be_dump_yesno(attr->sign_extend));
			fprintf(F, "use_8bit_high = %s\n",
			        be_dump_yesno(attr->use_8bit_high));
			fprintf(F, "is reload = %s\n", be_dump_yesno(is_ia32_is_reload(n)));
			fprintf(F, "latency = %u\n", get_ia32_latency(n));

			/* dump modes */
			fprintf(F, "size = %u\n", x86_bytes_from_size(attr->size) * 8);

#ifndef NDEBUG
			/* dump frame entity */
			fprintf(F, "frame use = %s\n", get_frame_use_str(n));
			if (attr->old_frame_ent != NULL) {
				fprintf(F, "frame entity = ");
				ir_entity *entity = attr->addr.immediate.entity;
				if (entity != NULL) {
					ir_fprintf(F, "%+F", entity);
				} else {
					fprintf(F, "n/a");
				}
				fprintf(F, "\n");
			}
#endif
			break;
	}
}
Beispiel #20
0
int ia32_attrs_equal(const ir_node *a, const ir_node *b)
{
	const ia32_attr_t* attr_a = get_ia32_attr_const(a);
	const ia32_attr_t* attr_b = get_ia32_attr_const(b);
	return ia32_attrs_equal_(attr_a, attr_b);
}
Beispiel #21
0
/**
 * Dumper interface for dumping ia32 nodes in vcg.
 * @param n        the node to dump
 * @param F        the output file
 * @param reason   indicates which kind of information should be dumped
 * @return 0 on success or != 0 on failure
 */
static void ia32_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
{
	ir_mode *mode = NULL;

	switch (reason) {
		case dump_node_opcode_txt:
			fprintf(F, "%s", get_irn_opname(n));

			if (is_ia32_Immediate(n) || is_ia32_Const(n)) {
				const ia32_immediate_attr_t *attr
					= get_ia32_immediate_attr_const(n);

				fputc(' ', F);
				ir_entity *entity = attr->imm.entity;
				if (entity)
					fputs(get_entity_name(entity), F);
				int32_t offset = attr->imm.offset;
				if (offset != 0 || entity == NULL) {
					if (offset > 0 && entity != NULL) {
						fputc('+', F);
					}
					fprintf(F, "%"PRId32, offset);
				}
			} else {
				const ia32_attr_t *attr = get_ia32_attr_const(n);

				int32_t    offset = attr->am_imm.offset;
				ir_entity *entity = attr->am_imm.entity;
				if (entity != NULL || offset != 0) {
					fputs(" [", F);

					if (entity != NULL)
						fputs(get_entity_name(entity), F);
					if (offset != 0) {
						if (offset > 0 && entity != NULL) {
							fputc('+', F);
						}
						fprintf(F, "%d", offset);
					}

					fputc(']', F);
				}
			}
			break;

		case dump_node_mode_txt:
			mode = get_ia32_ls_mode(n);
			if (mode != NULL)
				fprintf(F, "[%s]", get_mode_name(mode));
			break;

		case dump_node_nodeattr_txt:
			if (! is_ia32_Lea(n)) {
				switch (get_ia32_op_type(n)) {
				case ia32_Normal:    break;
				case ia32_AddrModeS: fprintf(F, "[AM S] "); break;
				case ia32_AddrModeD: fprintf(F, "[AM D] "); break;
				}
			}
			break;

		case dump_node_info_txt:
			be_dump_reqs_and_registers(F, n);

			/* dump op type */
			fprintf(F, "op = ");
			switch (get_ia32_op_type(n)) {
				case ia32_Normal:
					fprintf(F, "Normal");
					break;
				case ia32_AddrModeD:
					fprintf(F, "AM Dest (Load+Store)");
					break;
				case ia32_AddrModeS:
					fprintf(F, "AM Source (Load)");
					break;
				default:
					fprintf(F, "unknown (%d)", (int)get_ia32_op_type(n));
					break;
			}
			fprintf(F, "\n");

			/* dump supported am */
			fprintf(F, "AM support = ");
			switch (get_ia32_am_support(n)) {
				case ia32_am_none:   fputs("none\n",            F); break;
				case ia32_am_unary:  fputs("source (unary)\n",  F); break;
				case ia32_am_binary: fputs("source (binary)\n", F); break;

				default:
					fprintf(F, "unknown (%d)\n", (int)get_ia32_am_support(n));
					break;
			}

			const ia32_attr_t *attr = get_ia32_attr_const(n);
			fputs("AM immediate = ", F);
			x86_dump_imm32(&attr->am_imm, F);
			fputc('\n', F);

			/* dump AM scale */
			fprintf(F, "AM scale = %u\n", get_ia32_am_scale(n));

			/* dump pn code */
			if (has_ia32_condcode_attr(n)) {
				const char *cc_name = condition_code_name(get_ia32_condcode(n));
				if (cc_name) {
					fprintf(F, "condition_code = %s\n", cc_name);
				} else {
					fprintf(F, "condition_code = <invalid (0x%X)>\n",
					        (unsigned)get_ia32_condcode(n));
				}
				fprintf(F, "ins_permuted = %s\n", be_dump_yesno(attr->ins_permuted));
			} else if (is_ia32_CopyB(n) || is_ia32_CopyB_i(n)) {
				fprintf(F, "size = %u\n", get_ia32_copyb_size(n));
			} else if (has_ia32_x87_attr(n)) {
				ia32_x87_attr_t const *const attr = get_ia32_x87_attr_const(n);
				fprintf(F, "explicit operand = %s\n", be_dump_reg_name(attr->reg));
				fprintf(F, "result to explicit operand = %s\n", be_dump_yesno(attr->res_in_reg));
				fprintf(F, "pop = %s\n", be_dump_yesno(attr->pop));
			}

			fprintf(F, "commutative = %s\n", be_dump_yesno(is_ia32_commutative(n)));
			fprintf(F, "is reload = %s\n", be_dump_yesno(is_ia32_is_reload(n)));
			fprintf(F, "latency = %u\n", get_ia32_latency(n));

			/* dump modes */
			fprintf(F, "ls_mode = ");
			if (get_ia32_ls_mode(n)) {
				ir_fprintf(F, "%+F", get_ia32_ls_mode(n));
			} else {
				fprintf(F, "n/a");
			}
			fprintf(F, "\n");

#ifndef NDEBUG
			/* dump frame entity */
			fprintf(F, "frame use = %s\n", get_frame_use_str(n));
			if (attr->old_frame_ent != NULL) {
				fprintf(F, "frame entity = ");
				ir_entity *entity = attr->am_imm.entity;
				if (entity != NULL) {
					ir_fprintf(F, "%+F", entity);
				} else {
					fprintf(F, "n/a");
				}
			}
			/* dump original ir node name */
			char const *orig = get_ia32_attr_const(n)->orig_node;
			fprintf(F, "orig node = %s\n", orig ? orig : "n/a");
#endif /* NDEBUG */

			break;
	}
}