Commit b2a6cd6e authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Merge ia32_am_type_t and ia32_am_arity_t, because (type == ia32_am_None) ==...

Merge ia32_am_type_t and ia32_am_arity_t, because (type == ia32_am_None) == (arity == ia32_am_arity_none).

[r22463]
parent 14c0e61b
......@@ -819,12 +819,14 @@ static int ia32_possible_memory_operand(const ir_node *irn, unsigned int i)
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;
......@@ -853,7 +855,7 @@ static int ia32_possible_memory_operand(const ir_node *irn, unsigned int i)
}
default:
panic("Unknown arity");
panic("Unknown AM type");
}
}
......@@ -875,8 +877,8 @@ static void ia32_perform_memory_operand(ir_node *irn, ir_node *spill,
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);
......@@ -1038,7 +1040,7 @@ static void turn_back_am(ir_node *node)
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;
......@@ -1054,7 +1056,7 @@ static void turn_back_am(ir_node *node)
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);
......
......@@ -403,7 +403,7 @@ static void fix_am_source(ir_node *irn, void *env)
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);
......
......@@ -257,17 +257,14 @@ static int ia32_dump_node(ir_node *n, FILE *F, dump_reason_t reason) {
/* 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) {
......@@ -471,15 +468,8 @@ void set_ia32_op_type(ir_node *node, ia32_op_type_t tp) {
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;
}
......@@ -487,15 +477,10 @@ ia32_am_arity_t get_ia32_am_arity(const ir_node *node) {
/**
* 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;
}
/**
......
......@@ -103,17 +103,14 @@ ia32_op_type_t get_ia32_op_type(const ir_node *node);
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.
......
......@@ -44,16 +44,11 @@ typedef enum {
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 */
......@@ -98,19 +93,18 @@ typedef struct ia32_attr_t ia32_attr_t;
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
......
......@@ -253,9 +253,9 @@ sub ia32_custom_init_attr {
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 {
......
......@@ -819,7 +819,7 @@ static ir_node *gen_binop(ir_node *node, ir_node *op1, ir_node *op2,
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);
......@@ -869,7 +869,7 @@ static ir_node *gen_binop_flags(ir_node *node, construct_binop_flags_func *func,
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);
......@@ -1209,7 +1209,7 @@ static ir_node *gen_Mulh(ir_node *node)
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment