Commit 8f7699e7 authored by Matthias Braun's avatar Matthias Braun
Browse files

rename Store_align/Load_align to XXX_unaligned and correctly put it into the spec file

parent 7142e46b
......@@ -286,6 +286,22 @@ typedef enum ir_value_classify_sign {
no signed zero exists or < 0 else */
} ir_value_classify_sign;
/**
* This enumeration flags the volatility of entities and Loads/Stores.
*/
typedef enum {
volatility_non_volatile, /**< The entity is not volatile. Default. */
volatility_is_volatile /**< The entity is volatile. */
} ir_volatility;
/**
* This enumeration flags the align of Loads/Stores.
*/
typedef enum {
align_is_aligned = 0, /**< The entity is aligned. Default */
align_non_aligned, /**< The entity is not aligned. */
} ir_align;
#include "end.h"
#endif
......@@ -547,16 +547,6 @@ FIRM_API void set_memop_mem(ir_node *node, ir_node *mem);
FIRM_API ir_node *get_memop_ptr(const ir_node *node);
FIRM_API void set_memop_ptr(ir_node *node, ir_node *ptr);
FIRM_API ir_volatility get_Load_volatility(const ir_node *node);
FIRM_API void set_Load_volatility(ir_node *node, ir_volatility volatility);
FIRM_API ir_align get_Load_align(const ir_node *node);
FIRM_API void set_Load_align(ir_node *node, ir_align align);
FIRM_API ir_volatility get_Store_volatility(const ir_node *node);
FIRM_API void set_Store_volatility(ir_node *node, ir_volatility volatility);
FIRM_API ir_align get_Store_align(const ir_node *node);
FIRM_API void set_Store_align(ir_node *node, ir_align align);
FIRM_API ir_node **get_Sync_preds_arr(ir_node *node);
FIRM_API int get_Sync_n_preds(const ir_node *node);
FIRM_API ir_node *get_Sync_pred(const ir_node *node, int pos);
......
......@@ -278,15 +278,6 @@ FIRM_API void set_entity_linkage(ir_entity *entity, ir_linkage linkage);
FIRM_API void add_entity_linkage(ir_entity *entity, ir_linkage linkage);
FIRM_API void remove_entity_linkage(ir_entity *entity, ir_linkage linkage);
/**
* This enumeration flags the volatility of entities and Loads/Stores.
* @deprecated
*/
typedef enum {
volatility_non_volatile, /**< The entity is not volatile. Default. */
volatility_is_volatile /**< The entity is volatile. */
} ir_volatility;
/**
* Returns the volatility of an entity.
* @deprecated
......@@ -312,15 +303,6 @@ FIRM_API unsigned get_entity_alignment(const ir_entity *entity);
FIRM_API void set_entity_alignment(ir_entity *entity, unsigned alignment);
/**
* This enumeration flags the align of Loads/Stores.
* @deprecated
*/
typedef enum {
align_non_aligned, /**< The entity is not aligned. */
align_is_aligned /**< The entity is aligned. Default */
} ir_align;
/**
* Returns indication whether entity is aligned in memory.
* @deprecated
......
......@@ -913,6 +913,9 @@ static ir_node *gen_Load(ir_node *node)
dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *new_load = NULL;
if (get_Load_unaligned(node) == align_non_aligned)
panic("arm: unaligned Loads not supported yet");
if (mode_is_float(mode)) {
if (USE_FPA(isa)) {
new_load = new_bd_arm_Ldf(dbgi, block, new_ptr, new_mem, mode,
......@@ -953,6 +956,9 @@ static ir_node *gen_Store(ir_node *node)
dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *new_store = NULL;
if (get_Store_unaligned(node) == align_non_aligned)
panic("arm: unaligned Stores not supported yet");
if (mode_is_float(mode)) {
if (USE_FPA(isa)) {
new_store = new_bd_arm_Stf(dbgi, block, new_ptr, new_val,
......
......@@ -520,6 +520,10 @@ static ir_node *gen_Load(ir_node *node)
ir_node *new_load = NULL;
address_t address;
if (get_Load_unaligned(node) == align_non_aligned) {
panic("sparc: transformation of unaligned Loads not implemented yet");
}
if (mode_is_float(mode)) {
match_address(ptr, &address, false);
new_load = create_ldf(dbgi, block, address.ptr, new_mem, mode,
......@@ -560,6 +564,10 @@ static ir_node *gen_Store(ir_node *node)
ir_node *new_store = NULL;
address_t address;
if (get_Store_unaligned(node) == align_non_aligned) {
panic("sparc: transformation of unaligned Stores not implemented yet");
}
if (mode_is_float(mode)) {
/* TODO: variants with reg+reg address mode */
match_address(ptr, &address, false);
......
......@@ -691,12 +691,12 @@ void dump_node_opcode(FILE *F, ir_node *n)
} break;
case iro_Load:
if (get_Load_align(n) == align_non_aligned)
if (get_Load_unaligned(n) == align_non_aligned)
fprintf(F, "ua");
fprintf(F, "%s[%s]", get_irn_opname(n), get_mode_name_ex(get_Load_mode(n), NULL));
break;
case iro_Store:
if (get_Store_align(n) == align_non_aligned)
if (get_Store_unaligned(n) == align_non_aligned)
fprintf(F, "ua");
fprintf(F, "%s", get_irn_opname(n));
break;
......
......@@ -252,11 +252,11 @@ void 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), NULL));
fprintf(F, " volatility: %s\n", get_volatility_name(get_Load_volatility(n)));
fprintf(F, " align: %s\n", get_align_name(get_Load_align(n)));
fprintf(F, " align: %s\n", get_align_name(get_Load_unaligned(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)));
fprintf(F, " align: %s\n", get_align_name(get_Store_unaligned(n)));
break;
case iro_Confirm:
fprintf(F, " compare operation: %s\n", get_relation_string(get_Confirm_relation(n)));
......
......@@ -396,17 +396,8 @@ static void write_tarval(io_env_t *env, ir_tarval *tv)
fputc(' ', env->file);
}
static void write_align(io_env_t *env, ir_node *irn)
static void write_align(io_env_t *env, ir_align align)
{
ir_align align;
if (is_Load(irn))
align = get_Load_align(irn);
else if (is_Store(irn))
align = get_Store_align(irn);
else
panic("Invalid optype for write_align");
fputs(get_align_name(align), env->file);
fputc(' ', env->file);
}
......@@ -472,17 +463,8 @@ static void write_pin_state(io_env_t *env, ir_node *irn)
fputc(' ', env->file);
}
static void write_volatility(io_env_t *env, ir_node *irn)
static void write_volatility(io_env_t *env, ir_volatility vol)
{
ir_volatility vol;
if (is_Load(irn))
vol = get_Load_volatility(irn);
else if (is_Store(irn))
vol = get_Store_volatility(irn);
else
panic("Invalid optype for write_volatility");
fputs(get_volatility_name(vol), env->file);
fputc(' ', env->file);
}
......
......@@ -1261,55 +1261,6 @@ void set_memop_ptr(ir_node *node, ir_node *ptr)
set_irn_n(node, 1, ptr);
}
ir_volatility get_Load_volatility(const ir_node *node)
{
assert(is_Load(node));
return (ir_volatility)node->attr.load.volatility;
}
void set_Load_volatility(ir_node *node, ir_volatility volatility)
{
assert(is_Load(node));
node->attr.load.volatility = volatility;
}
ir_align get_Load_align(const ir_node *node)
{
assert(is_Load(node));
return (ir_align)node->attr.load.aligned;
}
void set_Load_align(ir_node *node, ir_align align)
{
assert(is_Load(node));
node->attr.load.aligned = align;
}
ir_volatility get_Store_volatility(const ir_node *node)
{
assert(is_Store(node));
return (ir_volatility)node->attr.store.volatility;
}
void set_Store_volatility(ir_node *node, ir_volatility volatility)
{
assert(is_Store(node));
node->attr.store.volatility = volatility;
}
ir_align get_Store_align(const ir_node *node)
{
assert(is_Store(node));
return (ir_align)node->attr.store.aligned;
}
void set_Store_align(ir_node *node, ir_align align)
{
assert(is_Store(node));
node->attr.store.aligned = align;
}
ir_node **get_Sync_preds_arr(ir_node *node)
{
......
......@@ -5929,7 +5929,7 @@ static int node_cmp_attr_Load(const ir_node *a, const ir_node *b)
/* 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))
if (get_Load_unaligned(a) != get_Load_unaligned(b))
return 1;
return get_Load_mode(a) != get_Load_mode(b);
......@@ -5939,7 +5939,7 @@ static int node_cmp_attr_Load(const ir_node *a, const ir_node *b)
static int node_cmp_attr_Store(const ir_node *a, const ir_node *b)
{
/* do not CSE Stores with different alignment. Be conservative. */
if (get_Store_align(a) != get_Store_align(b))
if (get_Store_unaligned(a) != get_Store_unaligned(b))
return 1;
/* NEVER do CSE on volatile Stores */
......
......@@ -243,7 +243,7 @@ typedef struct cast_attr {
typedef struct load_attr {
except_attr exc; /**< The exception attribute. MUST be the first one. */
unsigned volatility:1; /**< The volatility of this Load operation. */
unsigned aligned:1; /**< The align attribute of this Load operation. */
unsigned unaligned:1; /**< The align attribute of this Load operation. */
ir_mode *mode; /**< The mode of this Load operation. */
} load_attr;
......@@ -251,7 +251,7 @@ typedef struct load_attr {
typedef struct store_attr {
except_attr exc; /**< the exception attribute. MUST be the first one. */
unsigned volatility:1; /**< The volatility of this Store operation. */
unsigned aligned:1; /**< The align attribute of this Store operation. */
unsigned unaligned:1; /**< The align attribute of this Store operation. */
} store_attr;
typedef struct phi_attr {
......
......@@ -496,24 +496,6 @@ static void lower_bitfields_stores(ir_node *store)
set_Store_ptr(store, ptr);
} /* lower_bitfields_stores */
/**
* Lowers unaligned Loads.
*/
static void lower_unaligned_Load(ir_node *load)
{
(void) load;
/* NYI */
}
/**
* Lowers unaligned Stores
*/
static void lower_unaligned_Store(ir_node *store)
{
(void) store;
/* NYI */
}
/**
* lowers IR-nodes, called from walker
*/
......@@ -527,14 +509,6 @@ static void lower_irnode(ir_node *irn, void *env)
case iro_SymConst:
lower_symconst(irn);
break;
case iro_Load:
if (env != NULL && get_Load_align(irn) == align_non_aligned)
lower_unaligned_Load(irn);
break;
case iro_Store:
if (env != NULL && get_Store_align(irn) == align_non_aligned)
lower_unaligned_Store(irn);
break;
case iro_Cast:
exchange(irn, get_Cast_op(irn));
break;
......
......@@ -252,7 +252,6 @@ def preprocess_node(node):
if "init" in attr:
continue
arguments.append(attr)
#arguments.append(prepare_attr(attr))
# dynamic pin state means more constructor arguments
if is_dynamic_pinned(node):
......
......@@ -53,26 +53,25 @@ def get_io_type(type, attrname, node):
exportcmd = "write_mode(env, %(val)s);"
elif type == "ir_entity*":
importcmd = "ir_entity *%s = read_entity(env);" % attrname
exportcmd = """write_entity_ref(env, %(val)s);"""
exportcmd = "write_entity_ref(env, %(val)s);"
elif type == "ir_type*":
importcmd = "ir_type *%s = read_type(env);" % attrname
exportcmd = """write_type_ref(env, %(val)s);"""
exportcmd = "write_type_ref(env, %(val)s);"
elif type == "long" and node.name == "Proj":
importcmd = "long %s = read_long(env);" % attrname
exportcmd = """write_long(env, %(val)s);"""
exportcmd = "write_long(env, %(val)s);"
elif type == "ir_relation" or type == "ir_where_alloc":
importcmd = "%s %s = (%s) read_long(env);" % (type, attrname, type)
exportcmd = """write_long(env, (long) %(val)s);"""
elif type == "ir_cons_flags" and node.name == "Store":
exportcmd = "write_long(env, (long) %(val)s);"
elif type == "ir_align":
importcmd = "ir_align %s = read_align(env);" % attrname
exportcmd = "write_align(env, %(val)s);"
elif type == "ir_volatility":
importcmd = "ir_volatility %s = read_volatility(env);" % attrname
exportcmd = "write_volatility(env, %(val)s);"
elif type == "ir_cons_flags":
importcmd = "ir_cons_flags %s = get_cons_flags(env);" % attrname
exportcmd = """write_pin_state(env, irn);
write_volatility(env, irn);
write_align(env, irn);"""
elif type == "ir_cons_flags" and node.name == "Load":
importcmd = "ir_cons_flags %s = get_cons_flags(env);" % attrname
exportcmd = """write_pin_state(env, irn);
write_volatility(env, irn);
write_align(env, irn);"""
exportcmd = "" # can't really export cons_flags
elif type == "op_pin_state":
importcmd = "op_pin_state %s = read_pin_state(env);" % attrname
exportcmd = "write_pin_state(env, irn);"
......@@ -87,13 +86,13 @@ def get_io_type(type, attrname, node):
exportcmd = "write_cond_jmp_predicate(env, irn);"
elif type == "int":
importcmd = "int %s = read_int(env);" % attrname
exportcmd = """write_int(env, %(val)s);"""
exportcmd = "write_int(env, %(val)s);"
elif type == "unsigned":
importcmd = "unsigned %s = read_unsigned(env);" % attrname
exportcmd = """write_unsigned(env, %(val)s);"""
exportcmd = "write_unsigned(env, %(val)s);"
elif type == "long":
importcmd = "long %s = read_long(env);" % attrname
exportcmd = """write_long(env, %(val)s);"""
exportcmd = "write_long(env, %(val)s);"
else:
warning("cannot generate import/export for node %s: unsupported attribute type: %s" % (node.name, type))
importcmd = """// BAD: %s %s
......
......@@ -587,9 +587,20 @@ class Load(Op):
dict(
type = "ir_mode*",
name = "mode",
java_name = "load_mode",
comment = "mode of the value to be loaded",
),
dict(
type = "ir_volatility",
name = "volatility",
comment = "volatile loads are a visible side-effect and may not be optimized",
init = "flags & cons_volatile ? volatility_is_volatile : volatility_non_volatile",
),
dict(
type = "ir_align",
name = "unaligned",
comment = "pointers to unaligned loads don't need to respect the load-mode/type alignments",
init = "flags & cons_unaligned ? align_non_aligned : align_is_aligned",
),
]
attr_struct = "load_attr"
constructor_args = [
......@@ -600,10 +611,6 @@ class Load(Op):
),
]
pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
init = '''
res->attr.load.volatility = flags & cons_volatile ? volatility_is_volatile : volatility_non_volatile;
res->attr.load.aligned = flags & cons_unaligned ? align_non_aligned : align_is_aligned;
'''
class Minus(Unop):
"""returns the difference between its operands"""
......@@ -830,6 +837,20 @@ class Store(Op):
pinned = "exception"
attr_struct = "store_attr"
pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
attrs = [
dict(
type = "ir_volatility",
name = "volatility",
comment = "volatile stores are a visible side-effect and may not be optimized",
init = "flags & cons_volatile ? volatility_is_volatile : volatility_non_volatile",
),
dict(
type = "ir_align",
name = "unaligned",
comment = "pointers to unaligned stores don't need to respect the load-mode/type alignments",
init = "flags & cons_unaligned ? align_non_aligned : align_is_aligned",
),
]
constructor_args = [
dict(
type = "ir_cons_flags",
......@@ -837,10 +858,6 @@ class Store(Op):
comment = "specifies alignment, volatility and pin state",
),
]
init = '''
res->attr.store.volatility = flags & cons_volatile ? volatility_is_volatile : volatility_non_volatile;
res->attr.store.aligned = flags & cons_unaligned ? align_non_aligned : align_is_aligned;
'''
class Sub(Binop):
"""returns the difference of its operands"""
......
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