if (!is_ia32_irn(irn) || /* must be an ia32 irn */
get_ia32_op_type(irn) != ia32_Normal || /* must not already be a addressmode irn */
- !(get_ia32_am_support(irn) & ia32_am_Source) || /* must be capable of source addressmode */
!ia32_is_spillmode_compatible(mode, spillmode) ||
is_ia32_use_frame(irn)) /* must not already use frame */
return 0;
- switch (get_ia32_am_arity(irn)) {
+ switch (get_ia32_am_support(irn)) {
+ case ia32_am_none:
+ return 0;
+
case ia32_am_unary:
return i == n_ia32_unary_op;
}
default:
- panic("Unknown arity");
+ panic("Unknown AM type");
}
}
set_ia32_use_frame(irn);
set_ia32_need_stackent(irn);
- if (i == n_ia32_binary_left &&
- get_ia32_am_arity(irn) == ia32_am_binary &&
+ if (i == n_ia32_binary_left &&
+ get_ia32_am_support(irn) == ia32_am_binary &&
/* immediates are only allowed on the right side */
!is_ia32_Immediate(get_irn_n(irn, n_ia32_binary_right))) {
ia32_swap_left_right(irn);
set_ia32_is_reload(load);
set_irn_n(node, n_ia32_mem, new_NoMem());
- switch (get_ia32_am_arity(node)) {
+ switch (get_ia32_am_support(node)) {
case ia32_am_unary:
set_irn_n(node, n_ia32_unary_op, load_res);
break;
break;
default:
- panic("Unknown arity");
+ panic("Unknown AM type");
}
noreg = ia32_new_NoReg_gp(ia32_current_cg);
set_irn_n(node, n_ia32_base, noreg);
if (! is_ia32_irn(irn) || get_ia32_op_type(irn) != ia32_AddrModeS)
return;
/* only need to fix binary operations */
- if (get_ia32_am_arity(irn) != ia32_am_binary)
+ if (get_ia32_am_support(irn) != ia32_am_binary)
return;
base = get_irn_n(irn, n_ia32_base);
/* dump supported am */
fprintf(F, "AM support = ");
switch (get_ia32_am_support(n)) {
- case ia32_am_None:
- fprintf(F, "none");
- break;
- case ia32_am_Source:
- fprintf(F, "source only (Load)");
- break;
+ 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)", get_ia32_am_support(n));
+ fprintf(F, "unknown (%d)\n", get_ia32_am_support(n));
break;
}
- fprintf(F, "\n");
/* dump AM offset */
if(get_ia32_am_offs_int(n) != 0) {
attr->data.tp = tp;
}
-/**
- * Gets the supported address mode of an ia32 node
- */
-ia32_am_type_t get_ia32_am_support(const ir_node *node) {
- const ia32_attr_t *attr = get_ia32_attr_const(node);
- return attr->data.am_support;
-}
-
-ia32_am_arity_t get_ia32_am_arity(const ir_node *node) {
+ia32_am_type_t get_ia32_am_support(const ir_node *node)
+{
const ia32_attr_t *attr = get_ia32_attr_const(node);
return attr->data.am_arity;
}
/**
* Sets the supported address mode of an ia32 node
*/
-void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp,
- ia32_am_arity_t arity) {
- ia32_attr_t *attr = get_ia32_attr(node);
- attr->data.am_support = am_tp;
- attr->data.am_arity = arity;
-
- assert(am_tp == ia32_am_None ?
- arity == ia32_am_arity_none :
- arity == ia32_am_unary || arity == ia32_am_binary);
+void set_ia32_am_support(ir_node *node, ia32_am_type_t arity)
+{
+ ia32_attr_t *attr = get_ia32_attr(node);
+ attr->data.am_arity = arity;
}
/**
void set_ia32_op_type(ir_node *node, ia32_op_type_t tp);
/**
- * Gets the supported addrmode of an ia32 node
+ * Gets the supported address mode of an ia32 node
*/
ia32_am_type_t get_ia32_am_support(const ir_node *node);
-ia32_am_arity_t get_ia32_am_arity(const ir_node *node);
-
/**
* Sets the supported addrmode of an ia32 node
*/
-void set_ia32_am_support(ir_node *node, ia32_am_type_t am_tp,
- ia32_am_arity_t am_arity);
+void set_ia32_am_support(ir_node *node, ia32_am_type_t am_arity);
/**
* Gets the addressmode offset as long.
ia32_AddrModeS
} ia32_op_type_t;
-typedef enum {
- ia32_am_None = 0, /**< no addrmode support */
- ia32_am_Source = 2 /**< addrmode for source only */
-} ia32_am_type_t;
-
typedef enum {
- ia32_am_arity_none = 0,
- ia32_am_unary = 1,
- ia32_am_binary = 2
-} ia32_am_arity_t;
+ ia32_am_none = 0,
+ ia32_am_unary = 1,
+ ia32_am_binary = 2
+} ia32_am_type_t;
typedef enum {
match_commutative = 1 << 0, /**< inputs are commutative */
struct ia32_attr_t {
except_attr exc; /**< the exception attribute. MUST be the first one. */
struct ia32_attr_data_bitfield {
- unsigned flags:5; /**< Indicating if spillable, rematerializeable, stack modifying and/or ignore. */
- unsigned tp:3; /**< ia32 node type. */
- unsigned am_support:2; /**< Indicates the address mode type supported by this node. */
- unsigned am_arity : 2;
- unsigned am_scale:2; /**< The address mode scale for index register. */
- unsigned am_sc_sign:1; /**< The sign bit of the address mode symconst. */
+ unsigned flags:5; /**< Indicating if spillable, rematerializeable, stack modifying and/or ignore. */
+ unsigned tp:3; /**< ia32 node type. */
+ unsigned am_arity:2; /**< Indicates the address mode type supported by this node. */
+ unsigned am_scale:2; /**< The address mode scale for index register. */
+ unsigned am_sc_sign:1; /**< The sign bit of the address mode symconst. */
- unsigned use_frame:1; /**< Indicates whether the operation uses the frame pointer or not. */
- unsigned has_except_label:1; /**< Set if this node needs a label because of possible exception. */
+ unsigned use_frame:1; /**< Indicates whether the operation uses the frame pointer or not. */
+ unsigned has_except_label:1; /**< Set if this node needs a label because of possible exception. */
- unsigned is_commutative:1; /**< Indicates whether op is commutative or not. */
+ unsigned is_commutative:1; /**< Indicates whether op is commutative or not. */
- unsigned need_stackent:1; /**< Set to 1 if node need space on stack. */
+ unsigned need_stackent:1; /**< Set to 1 if node need space on stack. */
unsigned need_64bit_stackent:1; /**< needs a 64bit stack entity (see double->unsigned int conv) */
unsigned need_32bit_stackent:1; /**< needs a 32bit stack entity */
unsigned ins_permuted : 1; /**< inputs of node have been permuted
if(defined($node->{am})) {
my $am = $node->{am};
if($am eq "source,unary") {
- $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_unary);";
+ $res .= "\tset_ia32_am_support(res, ia32_am_unary);";
} elsif($am eq "source,binary") {
- $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
+ $res .= "\tset_ia32_am_support(res, ia32_am_binary);";
} elsif($am eq "none") {
# nothing to do
} else {
set_am_attributes(new_node, &am);
/* we can't use source address mode anymore when using immediates */
if (is_ia32_Immediate(am.new_op1) || is_ia32_Immediate(am.new_op2))
- set_ia32_am_support(new_node, ia32_am_None, ia32_am_arity_none);
+ set_ia32_am_support(new_node, ia32_am_none);
SET_IA32_ORIG_NODE(new_node, ia32_get_old_node_name(env_cg, node));
new_node = fix_mem_proj(new_node, &am);
set_am_attributes(new_node, &am);
/* we can't use source address mode anymore when using immediates */
if(is_ia32_Immediate(am.new_op1) || is_ia32_Immediate(am.new_op2))
- set_ia32_am_support(new_node, ia32_am_None, ia32_am_arity_none);
+ set_ia32_am_support(new_node, ia32_am_none);
SET_IA32_ORIG_NODE(new_node, ia32_get_old_node_name(env_cg, node));
new_node = fix_mem_proj(new_node, &am);
set_am_attributes(new_node, &am);
/* we can't use source address mode anymore when using immediates */
if(is_ia32_Immediate(am.new_op1) || is_ia32_Immediate(am.new_op2))
- set_ia32_am_support(new_node, ia32_am_None, ia32_am_arity_none);
+ set_ia32_am_support(new_node, ia32_am_none);
SET_IA32_ORIG_NODE(new_node, ia32_get_old_node_name(env_cg, node));
assert(get_irn_mode(new_node) == mode_T);