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

gen_ir: Replace knownGraph + graph by the boolean usesGraph.

By default a node needs the graph explicitly given iff it has a known block.
parent 6571aa27
......@@ -32,26 +32,26 @@ def format_a_an(text):
def format_blockparameter(node):
if not node.block:
return "ir_node *block"
else:
if hasattr(node, "knownGraph"):
return ""
elif node.usesGraph:
return "ir_graph *irg"
else:
return ""
def format_blockparameterhelp(node):
if not node.block:
return " * @param block The IR block the node belongs to.\n"
else:
if hasattr(node, "knownGraph"):
return ""
elif node.usesGraph:
return " * @param irg The IR graph the node belongs to.\n"
else:
return ""
def format_blockargument(node):
if not node.block:
return "block"
else:
if hasattr(node, "knownGraph"):
return ""
elif node.usesGraph:
return "irg"
else:
return ""
def format_blockassign(node):
if node.block:
......@@ -60,10 +60,7 @@ def format_blockassign(node):
return ""
def format_irgassign(node):
if hasattr(node, "knownGraph"):
return "ir_graph *irg = %s;\n" % node.graph
if node.block:
if node.usesGraph:
return ""
else:
return "ir_graph *irg = get_irn_irg(block);\n"
......@@ -71,10 +68,10 @@ def format_irgassign(node):
def format_curblock(node):
if not node.block:
return "get_cur_block()"
else:
if hasattr(node, "knownGraph"):
return ""
elif node.usesGraph:
return "current_ir_graph"
else:
return ""
def format_insdecl(node):
arity = node.arity
......@@ -168,10 +165,10 @@ def format_args(arglist):
def format_block(node):
if not node.block:
return "block"
else:
if hasattr(node, "knownGraph"):
return ""
elif node.usesGraph:
return "env->irg"
else:
return ""
def format_simplify_type(string):
"""Returns a simplified version of a C type for use in a function name.
......@@ -215,6 +212,7 @@ env.filters['stringformat'] = format_stringformat
def preprocess_node(node):
setdefault(node, "attrs_name", node.name.lower())
setdefault(node, "block", None)
setdefault(node, "usesGraph", node.block != None)
# construct node arguments
arguments = [ ]
......
......@@ -675,9 +675,8 @@ class Proj:
]
flags = []
pinned = "no"
knownGraph = True
block = "get_nodes_block(irn_pred)"
graph = "get_irn_irg(irn_pred)"
usesGraph = False
attrs = [
Attribute("proj", type="long",
comment="number of tuple component to be extracted"),
......
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