Commit 830ae44f authored by Matthias Braun's avatar Matthias Braun
Browse files

you can specify in the spec now for which nodes no standard import/export code...

you can specify in the spec now for which nodes no standard import/export code is generated; fix bug with Proj nodes block

[r28215]
parent 2dd8ca17
......@@ -680,7 +680,23 @@ static void export_node(ir_node *irn, void *ctx)
fprintf(env->file, "] { ");
switch (opcode) {
case iro_Start:
case iro_End:
case iro_Block:
case iro_Anchor:
break;
case iro_SymConst:
/* TODO: only symconst_addr_ent implemented yet */
assert(get_SymConst_kind(irn) == symconst_addr_ent);
fprintf(env->file, "%ld ", get_entity_nr(get_SymConst_entity(irn)));
break;
case iro_Proj:
write_mode(env, get_irn_mode(irn));
fprintf(env->file, "%ld ", get_Proj_proj(irn));
break;
#include "gen_irio_export.inl"
default:
panic("no export code for node %+F\n", irn);
}
fputs("}\n", env->file);
}
......@@ -1499,8 +1515,7 @@ static int parse_graph(io_env_t *env, ir_graph *irg)
EXPECT('{');
switch (symbol(nodename, tt_iro)) {
case iro_End:
{
case iro_End: {
ir_node *newendblock = preds[0];
newnode = get_irg_end(irg);
exchange(get_nodes_block(newnode), newendblock);
......@@ -1509,8 +1524,7 @@ static int parse_graph(io_env_t *env, ir_graph *irg)
break;
}
case iro_Start:
{
case iro_Start: {
ir_node *newstartblock = preds[0];
newnode = get_irg_start(irg);
exchange(get_nodes_block(newnode), newstartblock);
......@@ -1528,8 +1542,7 @@ static int parse_graph(io_env_t *env, ir_graph *irg)
set_nodes_block(newnode, preds[0]);
break;
case iro_SymConst:
{
case iro_SymConst: {
long entnr = read_long(env);
union symconst_symbol sym;
sym.entity_p = get_entity(env, entnr);
......@@ -1537,6 +1550,16 @@ static int parse_graph(io_env_t *env, ir_graph *irg)
break;
}
case iro_Proj: {
ir_mode *mode = read_mode(env);
long pn = read_long(env);
newnode = new_r_Proj(preds[1], mode, pn);
/* explicitely set block, since preds[1] might be a dummy node
* which is always in the startblock */
set_nodes_block(newnode, preds[0]);
break;
}
#include "gen_irio_import.inl"
default:
......
......@@ -228,10 +228,6 @@ def main(argv):
sys.exit(1)
gendir = argv[2]
# these nodes don't work correctly yet for some reasons...
niynodes = [ "ASM" ]
# these have custom im-/export code
customcode = [ "Start", "End", "Anchor", "SymConst", "Block", "Deleted" ]
real_nodes = []
for node in ir_spec.nodes:
......@@ -241,7 +237,7 @@ def main(argv):
file = open(gendir + "/gen_irio_export.inl", "w");
for node in real_nodes:
if node.__name__ in niynodes:
if node.customSerializer:
continue
preprocess_node(node)
......@@ -251,7 +247,7 @@ def main(argv):
file = open(gendir + "/gen_irio_import.inl", "w");
for node in real_nodes:
if node.name in customcode or node.name in niynodes:
if node.customSerializer:
continue
file.write(import_attrs_template.render(vars()))
file.write("\n")
......@@ -259,8 +255,6 @@ def main(argv):
file = open(gendir + "/gen_irio_lex.inl", "w");
for node in real_nodes:
if node.name in niynodes:
continue
file.write("\tINSERT(tt_iro, \"%s\", iro_%s);\n" % (node.name, node.name));
file.close()
......
......@@ -46,26 +46,28 @@ class Alloc(Op):
attr_struct = "alloc_attr"
class Anchor(Op):
mode = "mode_ANY"
arity = "variable"
flags = [ "dump_noblock" ]
pinned = "yes"
attr_struct = "irg_attr"
knownBlock = True
singleton = True
noconstructor = True
mode = "mode_ANY"
arity = "variable"
flags = [ "dump_noblock" ]
pinned = "yes"
attr_struct = "irg_attr"
knownBlock = True
singleton = True
noconstructor = True
customSerializer = True
class And(Binop):
flags = [ "commutative" ]
class ASM(Op):
mode = "mode_T"
arity = "variable"
flags = [ "keep", "uses_memory" ]
pinned = "memory"
pinned_init = "op_pin_state_pinned"
attr_struct = "asm_attr"
attrs_name = "assem"
mode = "mode_T"
arity = "variable"
flags = [ "keep", "uses_memory" ]
pinned = "memory"
pinned_init = "op_pin_state_pinned"
attr_struct = "asm_attr"
attrs_name = "assem"
customSerializer = True
attrs = [
dict(
name = "input_constraints",
......@@ -108,19 +110,21 @@ class Bad(Op):
'''
class Deleted(Op):
mode = "mode_Bad"
flags = [ ]
pinned = "yes"
noconstructor = True
mode = "mode_Bad"
flags = [ ]
pinned = "yes"
noconstructor = True
customSerializer = True
class Block(Op):
mode = "mode_BB"
knownBlock = True
block = "NULL"
pinned = "yes"
arity = "variable"
flags = [ "labeled" ]
attr_struct = "block_attr"
mode = "mode_BB"
knownBlock = True
block = "NULL"
pinned = "yes"
arity = "variable"
flags = [ "labeled" ]
attr_struct = "block_attr"
customSerializer = True
init = '''
res->attr.block.irg.irg = irg;
......@@ -407,20 +411,21 @@ class DivMod(Op):
arity_override = "oparity_binary"
class Dummy(Op):
ins = []
flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
ins = []
flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
knownBlock = True
pinned = "yes"
block = "get_irg_start_block(irg)"
class End(Op):
mode = "mode_X"
pinned = "yes"
arity = "dynamic"
flags = [ "cfopcode" ]
knownBlock = True
block = "get_irg_end_block(irg)"
singleton = True
mode = "mode_X"
pinned = "yes"
arity = "dynamic"
flags = [ "cfopcode" ]
knownBlock = True
block = "get_irg_end_block(irg)"
singleton = True
customSerializer = True
class Eor(Binop):
flags = [ "commutative" ]
......@@ -572,13 +577,14 @@ class Pin(Op):
pinned = "yes"
class Proj(Op):
ins = [ "pred" ]
flags = []
pinned = "no"
knownBlock = True
knownGraph = True
block = "get_nodes_block(irn_pred)"
graph = "get_irn_irg(irn_pred)"
ins = [ "pred" ]
flags = []
pinned = "no"
knownBlock = True
knownGraph = True
block = "get_nodes_block(irn_pred)"
graph = "get_irn_irg(irn_pred)"
customSerializer = True
attrs = [
dict(
type = "long",
......@@ -660,12 +666,13 @@ class Start(Op):
("P_tls", "pointer to thread local storage segment"),
("T_args", "function arguments")
]
mode = "mode_T"
pinned = "yes"
flags = [ "cfopcode" ]
singleton = True
knownBlock = True
block = "get_irg_start_block(irg)"
mode = "mode_T"
pinned = "yes"
flags = [ "cfopcode" ]
singleton = True
knownBlock = True
customSerializer = True
block = "get_irg_start_block(irg)"
class Store(Op):
ins = [ "mem", "ptr", "value" ]
......@@ -701,6 +708,7 @@ class SymConst(Op):
)
]
attr_struct = "symconst_attr"
customSerializer = True
class Sync(Op):
mode = "mode_M"
......
......@@ -38,6 +38,7 @@ def setnodedefaults(node):
setdefault(node, "arity", len(node.ins))
setdefault(node, "attrs", [])
setdefault(node, "constructor_args", [])
setdefault(node, "customSerializer", False)
setldefault(node, "constrname", node.name)
if hasattr(node, "outs"):
node.mode = "mode_T"
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