X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=scripts%2Fspec_util.py;h=6e15063f8b636bb32d5fb321423f15cf6273183f;hb=b3b65d5e83b23c0d6c748c6caa4863803c58cc87;hp=7fd35a4a82d316ccc7f0f1cf746063a6a71a711e;hpb=99f23ed8dfa68ab6d96a4080e1d83fc8d4d68dd2;p=libfirm diff --git a/scripts/spec_util.py b/scripts/spec_util.py index 7fd35a4a8..6e15063f8 100644 --- a/scripts/spec_util.py +++ b/scripts/spec_util.py @@ -8,6 +8,9 @@ def isAbstract(nodetype): def is_dynamic_pinned(node): return node.pinned in ["memory", "exception"] +def is_fragile(node): + return hasattr(node, "flags") and "fragile" in node.flags + def inout_contains(l, name): for entry in l: if entry[0] == name: @@ -24,15 +27,23 @@ def verify_node(node): print "WARNING: no flags specified for %s\n" % node.__name__ elif type(node.flags) != list: print "ERROR: flags of %s not a list" % node.__name__ - if hasattr(node, "flags"): - flags = node.flags - if "fragile" in flags: - if not inout_contains(node.ins, "mem"): - print "ERROR: fragile node %s needs an input named 'mem'" % node.__name__ - if not inout_contains(node.outs, "X_regular"): - print "ERROR: fragile node %s needs an output named 'X_regular'" % node.__name__ - if not inout_contains(node.outs, "X_except"): - print "ERROR: fragile node %s needs an output named 'X_except'" % node.__name__ + if hasattr(node, "pinned_init") and not is_dynamic_pinned(node): + print "ERROR: node %s has pinned_init attribute but is not marked as dynamically pinned" % node.__name__ + if is_fragile(node): + if not is_dynamic_pinned(node): + print "ERROR: fragile node %s must be dynamically pinned" % node.__name__ + if not hasattr(node, "throws_init"): + print "ERROR: fragile node %s needs a throws_init attribute" % node.__name__ + if not inout_contains(node.ins, "mem"): + print "ERROR: fragile node %s needs an input named 'mem'" % node.__name__ + if not inout_contains(node.outs, "X_regular"): + print "ERROR: fragile node %s needs an output named 'X_regular'" % node.__name__ + if not inout_contains(node.outs, "X_except"): + print "ERROR: fragile node %s needs an output named 'X_except'" % node.__name__ + else: + if hasattr(node, "throws_init"): + print "ERROR: throws_init only makes sense for fragile nodes" + def setldefault(node, attr, val): # Don't use hasattr, as these things should not be inherited