Commit 5140ee36 authored by Michael Beck's avatar Michael Beck
Browse files

add unaligned Load/Stores

[r15432]
parent 7af381f3
......@@ -503,6 +503,7 @@ new_bd_Load(dbg_info *db, ir_node *block,
res->attr.load.exc.pin_state = op_pin_state_pinned;
res->attr.load.load_mode = mode;
res->attr.load.volatility = volatility_non_volatile;
res->attr.load.aligned = align_is_aligned;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
......@@ -521,6 +522,7 @@ new_bd_Store(dbg_info *db, ir_node *block,
res = new_ir_node(db, irg, block, op_Store, mode_T, 3, in);
res->attr.store.exc.pin_state = op_pin_state_pinned;
res->attr.store.volatility = volatility_non_volatile;
res->attr.store.aligned = align_is_aligned;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
......
......@@ -752,8 +752,15 @@ int dump_node_opcode(FILE *F, ir_node *n)
break;
}
case iro_Load:
if (get_Load_align(n) == align_non_aligned)
fprintf(F, "ua");
fprintf(F, "%s[%s]", get_irn_opname(n), get_mode_name_ex(get_Load_mode(n), &bad));
break;
case iro_Store:
if (get_Store_align(n) == align_non_aligned)
fprintf(F, "ua");
fprintf(F, "%s", get_irn_opname(n));
break;
case iro_Block:
fprintf(F, "%s%s", is_Block_dead(n) ? "Dead " : "", get_irn_opname(n));
break;
......
......@@ -336,9 +336,11 @@ int dump_irnode_to_file(FILE *F, ir_node *n) {
case iro_Load:
fprintf(F, " mode of loaded value: %s\n", get_mode_name_ex(get_Load_mode(n), &bad));
fprintf(F, " volatility: %s\n", get_volatility_name(get_Load_volatility(n)));
fprintf(F, " align: %s\n", get_align_name(get_Load_align(n)));
break;
case iro_Store:
fprintf(F, " volatility: %s\n", get_volatility_name(get_Store_volatility(n)));
fprintf(F, " align: %s\n", get_align_name(get_Store_align(n)));
break;
case iro_Confirm:
fprintf(F, " compare operation: %s\n", get_pnc_string(get_Confirm_cmp(n)));
......
......@@ -1725,6 +1725,18 @@ set_Load_volatility(ir_node *node, ir_volatility volatility) {
node->attr.load.volatility = volatility;
}
ir_align
get_Load_align(ir_node *node) {
assert(node->op == op_Load);
return node->attr.load.aligned;
}
void
set_Load_align(ir_node *node, ir_align align) {
assert(node->op == op_Load);
node->attr.load.aligned = align;
}
ir_node *
get_Store_mem(ir_node *node) {
......@@ -1774,6 +1786,18 @@ set_Store_volatility(ir_node *node, ir_volatility volatility) {
node->attr.store.volatility = volatility;
}
ir_align
get_Store_align(ir_node *node) {
assert(node->op == op_Store);
return node->attr.store.aligned;
}
void
set_Store_align(ir_node *node, ir_align align) {
assert(node->op == op_Store);
node->attr.store.aligned = align;
}
ir_node *
get_Alloc_mem(ir_node *node) {
......
......@@ -3891,12 +3891,19 @@ static int node_cmp_attr_Load(ir_node *a, ir_node *b) {
get_Load_volatility(b) == volatility_is_volatile)
/* NEVER do CSE on volatile Loads */
return 1;
/* do not CSE Loads with different alignment. Be conservative. */
if (get_Load_align(a) != get_Load_align(b))
return 1;
return get_Load_mode(a) != get_Load_mode(b);
} /* node_cmp_attr_Load */
/** Compares the attributes of two Store nodes. */
static int node_cmp_attr_Store(ir_node *a, ir_node *b) {
/* do not CSE Stores with different alignment. Be conservative. */
if (get_Store_align(a) != get_Store_align(b))
return 1;
/* NEVER do CSE on volatile Stores */
return (get_Store_volatility(a) == volatility_is_volatile ||
get_Store_volatility(b) == volatility_is_volatile);
......
......@@ -226,13 +226,15 @@ typedef struct {
typedef struct {
except_attr exc; /**< The exception attribute. MUST be the first one. */
ir_mode *load_mode; /**< The mode of this Load operation. */
ir_volatility volatility; /**< The volatility of a Load/Store operation. */
unsigned volatility:1; /**< The volatility of this Load operation. */
unsigned aligned:1; /**< The align attribute of this Load operation. */
} load_attr;
/** Store attributes. */
typedef struct {
except_attr exc; /**< the exception attribute. MUST be the first one. */
ir_volatility volatility; /**< the volatility of a Store operation */
unsigned volatility:1; /**< The volatility of this Store operation. */
unsigned aligned:1; /**< The align attribute of this Store operation. */
} store_attr;
typedef struct {
......
......@@ -481,7 +481,7 @@ void
_set_entity_volatility(ent, vol);
} /* set_entity_volatility */
/* return the name of the volatility */
/* Return the name of the volatility. */
const char *get_volatility_name(ir_volatility var)
{
#define X(a) case a: return #a
......@@ -493,6 +493,18 @@ const char *get_volatility_name(ir_volatility var)
#undef X
} /* get_volatility_name */
/* Return the name of the alignment. */
const char *get_align_name(ir_align a)
{
#define X(a) case a: return #a
switch (a) {
X(align_non_aligned);
X(align_is_aligned);
default: return "BAD VALUE";
}
#undef X
} /* get_align_name */
ir_peculiarity
(get_entity_peculiarity)(const ir_entity *ent) {
return _get_entity_peculiarity(ent);
......
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