Commit 6571aa27 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

gen_ir: Remove the attribute knownBlock.

Just inspecting the attribute block is sufficient.
parent 1966adc7
......@@ -30,45 +30,51 @@ def format_a_an(text):
return "a " + text
def format_blockparameter(node):
if hasattr(node, "knownBlock"):
if not node.block:
return "ir_node *block"
else:
if hasattr(node, "knownGraph"):
return ""
return "ir_graph *irg"
else:
return "ir_node *block"
def format_blockparameterhelp(node):
if hasattr(node, "knownBlock"):
if not node.block:
return " * @param block The IR block the node belongs to.\n"
else:
if hasattr(node, "knownGraph"):
return ""
return " * @param irg The IR graph the node belongs to.\n"
else:
return " * @param block The IR block the node belongs to.\n"
def format_blockargument(node):
if hasattr(node, "knownBlock"):
if not node.block:
return "block"
else:
if hasattr(node, "knownGraph"):
return ""
return "irg"
def format_blockassign(node):
if node.block:
return "ir_node *block = %s;" % node.block
else:
return "block"
return ""
def format_irgassign(node):
if hasattr(node, "knownGraph"):
return "ir_graph *irg = %s;\n" % node.graph
if hasattr(node, "knownBlock"):
if node.block:
return ""
else:
return "ir_graph *irg = get_irn_irg(block);\n"
def format_curblock(node):
if hasattr(node, "knownBlock"):
if not node.block:
return "get_cur_block()"
else:
if hasattr(node, "knownGraph"):
return ""
return "current_ir_graph"
else:
return "get_cur_block()"
def format_insdecl(node):
arity = node.arity
......@@ -160,12 +166,12 @@ def format_args(arglist):
return "\n".join(argument_names)
def format_block(node):
if hasattr(node, "knownBlock"):
if not node.block:
return "block"
else:
if hasattr(node, "knownGraph"):
return ""
return "env->irg"
else:
return "block"
def format_simplify_type(string):
"""Returns a simplified version of a C type for use in a function name.
......@@ -194,6 +200,7 @@ env.filters['filtjoin'] = format_filtjoin
env.filters['has'] = filter_has
env.filters['hasnot'] = filter_hasnot
env.filters['insdecl'] = format_insdecl
env.filters['blockassign'] = format_blockassign
env.filters['irgassign'] = format_irgassign
env.filters['nodearguments'] = format_nodearguments
env.filters['nodeparameters'] = format_nodeparameters
......@@ -207,7 +214,7 @@ env.filters['stringformat'] = format_stringformat
def preprocess_node(node):
setdefault(node, "attrs_name", node.name.lower())
setdefault(node, "block", "block")
setdefault(node, "block", None)
# construct node arguments
arguments = [ ]
......
......@@ -28,7 +28,6 @@ class EntConst(object):
name = "entconst"
flags = [ "constlike", "start_block" ]
block = "get_irg_start_block(irg)"
knownBlock = True
pinned = "no"
attrs = [
Attribute("entity", type="ir_entity*", comment="entity to operate on"),
......@@ -43,7 +42,6 @@ class TypeConst(object):
name = "typeconst"
flags = [ "constlike", "start_block" ]
block = "get_irg_start_block(irg)"
knownBlock = True
pinned = "no"
attrs = [
Attribute("type", type="ir_type*", comment="type to operate on"),
......@@ -97,7 +95,6 @@ class Anchor:
flags = [ "dump_noblock" ]
pinned = "yes"
attr_struct = "irg_attr"
knownBlock = True
singleton = True
noconstructor = True
customSerializer = True
......@@ -189,7 +186,6 @@ class Bad:
from undefined behaviour like reading uninitialized local variables in C."""
flags = [ "start_block", "dump_noblock" ]
pinned = "yes"
knownBlock = True
block = "get_irg_start_block(irg)"
attr_struct = "bad_attr"
init = '''
......@@ -210,7 +206,6 @@ class Deleted:
class Block:
"""A basic block"""
mode = "mode_BB"
knownBlock = True
block = "NULL"
pinned = "yes"
arity = "variable"
......@@ -373,7 +368,6 @@ class Const:
flags = [ "constlike", "start_block" ]
block = "get_irg_start_block(irg)"
mode = "get_tarval_mode(tarval)"
knownBlock = True
pinned = "no"
attrs = [
Attribute("tarval", type="ir_tarval*",
......@@ -458,7 +452,6 @@ class Dummy:
nodes are used for the unknown predecessors and replaced later."""
ins = []
flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
knownBlock = True
pinned = "yes"
block = "get_irg_start_block(irg)"
......@@ -471,7 +464,6 @@ class End:
arity = "dynamic"
input_name = "keepalive"
flags = [ "cfopcode" ]
knownBlock = True
block = "get_irg_end_block(irg)"
singleton = True
......@@ -628,7 +620,6 @@ class NoMem:
mode = "mode_M"
flags = [ "dump_noblock" ]
pinned = "yes"
knownBlock = True
block = "get_irg_start_block(irg)"
singleton = True
......@@ -684,7 +675,6 @@ class Proj:
]
flags = []
pinned = "no"
knownBlock = True
knownGraph = True
block = "get_nodes_block(irn_pred)"
graph = "get_irn_irg(irn_pred)"
......@@ -785,7 +775,6 @@ class Start:
pinned = "yes"
flags = [ "cfopcode" ]
singleton = True
knownBlock = True
block = "get_irg_start_block(irg)"
@op
......@@ -867,7 +856,6 @@ class Unknown:
Be careful when optimising Unknown values, you cannot simply replace
Unknown+x or Unknown<x with a new Unknown node if there are multiple
users of the original unknown node!"""
knownBlock = True
pinned = "yes"
block = "get_irg_start_block(irg)"
flags = [ "start_block", "constlike", "dump_noblock" ]
......@@ -2,7 +2,7 @@
{%- for node in nodes|hasnot('customSerializer') %}
static ir_node *read_{{node.name}}(read_env_t *env)
{
{%- if not node.knownBlock %}
{%- if not node.block %}
ir_node *block = read_node_ref(env);
{%- endif %}
{%- for input in node.ins %}
......@@ -68,7 +68,7 @@ static void write_{{node.name}}(write_env_t *env, const ir_node *node)
{
write_symbol(env, "{{node.name}}");
write_node_nr(env, node);
{%- if not node.knownBlock %}
{%- if not node.block %}
write_node_ref(env, get_nodes_block(node));
{%- endif %}
{%- for input in node.ins %}
......
......@@ -48,6 +48,7 @@ ir_node *new_rd_{{node.name}}(
{{node|nodeparameters}}
{% endfilter %})
{
{{node|blockassign}}
{{node|irgassign}}
{{node|insdecl}}
......@@ -55,7 +56,7 @@ ir_node *new_rd_{{node.name}}(
{%- filter arguments %}
dbgi
irg
{{node.block}}
block
op_{{node.name}}
{% if hasattr(node, 'mode') -%}
{{node.mode}}
......
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