Commit 066e8d77 authored by Matthias Braun's avatar Matthias Braun
Browse files

move Proj attributes into a proj_attr struct, so we can get rid of more special cases

[r28234]
parent 3ba6b4a5
......@@ -1379,18 +1379,6 @@ void add_Sync_pred(ir_node *node, ir_node *pred)
add_irn_n(node, pred);
}
long get_Proj_proj(const ir_node *node)
{
assert(is_Proj(node));
return node->attr.proj;
}
void set_Proj_proj(ir_node *node, long proj)
{
assert(is_Proj(node));
node->attr.proj = proj;
}
int (is_arg_Proj)(const ir_node *node)
{
return _is_arg_Proj(node);
......
......@@ -6143,7 +6143,7 @@ static int node_cmp_attr_Const(ir_node *a, ir_node *b)
/** Compares the attributes of two Proj nodes. */
static int node_cmp_attr_Proj(ir_node *a, ir_node *b)
{
return a->attr.proj != b->attr.proj;
return a->attr.proj.proj != b->attr.proj.proj;
} /* node_cmp_attr_Proj */
/** Compares the attributes of two Alloc nodes. */
......
......@@ -306,6 +306,10 @@ typedef struct asm_attr {
ident **clobbers; /**< List of clobbered registers. */
} asm_attr;
typedef struct proj_attr {
long proj; /**< position of tuple sub-value which is projected */
} proj_attr;
/** Some IR-nodes just have one attribute, these are stored here,
some have more. Their name is 'irnodename_attr' */
typedef union ir_attr {
......@@ -326,7 +330,7 @@ typedef union ir_attr {
load_attr load; /**< For Load. */
store_attr store; /**< For Store. */
phi_attr phi; /**< For Phi. */
long proj; /**< For Proj: contains the result position to project */
proj_attr proj; /**< For Proj. */
confirm_attr confirm; /**< For Confirm: compare operation and region. */
except_attr except; /**< For Phi node construction in case of exceptions */
copyb_attr copyb; /**< For CopyB operation */
......
......@@ -207,7 +207,7 @@ def preprocess_node(node):
node.mode = "mode"
for attr in node.attrs:
attr.setdefault("initname", "." + attr["name"])
attr["fqname"] = "." + attr["name"]
if not "init" in attr:
arguments.append(prepare_attr(attr))
......@@ -216,8 +216,8 @@ def preprocess_node(node):
if is_dynamic_pinned(node):
if hasattr(node, "pinned_init"):
initattrs.append(dict(
initname = ".exc.pin_state",
init = node.pinned_init
fqname = ".exc.pin_state",
init = node.pinned_init
))
else:
node.constructor_args.append(
......@@ -227,19 +227,19 @@ def preprocess_node(node):
)
)
initattrs.append(dict(
initname = ".exc.pin_state",
init = "pin_state"
fqname = ".exc.pin_state",
init = "pin_state"
))
for arg in node.constructor_args:
arguments.append(prepare_attr(arg))
if arg["type"] == "ir_cons_flags":
name = arg["name"]
initattrs.append(dict(initname = ".exc.pin_state",
initattrs.append(dict(fqname = ".exc.pin_state",
init = name + " & cons_floats ? op_pin_state_floats : op_pin_state_pinned"))
initattrs.append(dict(initname = ".volatility",
initattrs.append(dict(fqname = ".volatility",
init = name + " & cons_volatile ? volatility_is_volatile : volatility_non_volatile"))
initattrs.append(dict(initname = ".aligned",
initattrs.append(dict(fqname = ".aligned",
init = name + " & cons_unaligned ? align_non_aligned : align_is_aligned"))
node.arguments = arguments
......@@ -278,13 +278,13 @@ ir_node *new_rd_{{node.name}}(
}
{%- endif %}
{%- for attr in node.attrs %}
res->attr.{{node.attrs_name}}{{attr["initname"]}} =
res->attr.{{node.attrs_name}}{{attr["fqname"]}} =
{%- if "init" in attr %} {{ attr["init"] -}};
{%- else %} {{ attr["name"] -}};
{%- endif %}
{%- endfor %}
{%- for attr in node.initattrs %}
res->attr.{{node.attrs_name}}{{attr["initname"]}} = {{ attr["init"] -}};
res->attr.{{node.attrs_name}}{{attr["fqname"]}} = {{ attr["init"] -}};
{%- endfor %}
{{- node.init }}
res = optimize_node(res);
......
......@@ -637,11 +637,9 @@ class Proj(Op):
dict(
type = "long",
name = "proj",
initname = "",
noprop = False,
)
]
attr_struct = "long"
attr_struct = "proj_attr"
class Quot(Op):
"""returns the quotient of its 2 operands, floatingpoint version"""
......
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