Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remember class of an instance statement

  • Loading branch information...
commit 918ca7ec894a8154f7f16049a5eec31e345ebb34 1 parent 00a9d76
@nickg authored
View
6 src/cgen.c
@@ -688,7 +688,7 @@ static void cgen_prototype(tree_t t, LLVMTypeRef *args, bool procedure)
}
break;
- case C_FILE:
+ default:
assert(false);
}
}
@@ -2718,7 +2718,7 @@ static void cgen_func_body(tree_t t)
tree_add_attr_ptr(p, local_var_i, LLVMGetParam(fn, i));
break;
- case C_FILE:
+ default:
assert(false);
}
}
@@ -2776,7 +2776,7 @@ static void cgen_proc_body(tree_t t)
tree_add_attr_ptr(p, local_var_i, LLVMGetParam(fn, i));
break;
- case C_FILE:
+ default:
assert(false);
}
}
View
2  src/dump.c
@@ -494,6 +494,8 @@ static void dump_port(tree_t t, int indent)
case C_DEFAULT: class = ""; break;
case C_CONSTANT: class = "constant"; break;
case C_FILE: class = "file"; break;
+ default:
+ assert(false);
}
switch (tree_port_mode(t)) {
case PORT_IN: dir = "in"; break;
View
5 src/parse.y
@@ -807,6 +807,7 @@ comp_instance_stmt
tree_set_loc($$, &@$);
tree_set_ident($$, $1);
tree_set_ident2($$, $3);
+ tree_set_class($$, C_COMPONENT);
copy_params($5, tree_add_param, $$);
copy_params($4, tree_add_genmap, $$);
}
@@ -816,6 +817,7 @@ comp_instance_stmt
tree_set_loc($$, &@$);
tree_set_ident($$, $1);
tree_set_ident2($$, $4);
+ tree_set_class($$, C_COMPONENT);
copy_params($6, tree_add_param, $$);
copy_params($5, tree_add_genmap, $$);
}
@@ -825,6 +827,7 @@ comp_instance_stmt
tree_set_loc($$, &@$);
tree_set_ident($$, $1);
tree_set_ident2($$, $4);
+ tree_set_class($$, C_ENTITY);
copy_params($6, tree_add_param, $$);
copy_params($5, tree_add_genmap, $$);
}
@@ -835,6 +838,7 @@ comp_instance_stmt
tree_set_loc($$, &@$);
tree_set_ident($$, $1);
tree_set_ident2($$, ident_prefix($4, $6, '-'));
+ tree_set_class($$, C_ENTITY);
copy_params($9, tree_add_param, $$);
copy_params($8, tree_add_genmap, $$);
}
@@ -844,6 +848,7 @@ comp_instance_stmt
tree_set_loc($$, &@$);
tree_set_ident($$, $1);
tree_set_ident2($$, $4);
+ tree_set_class($$, C_CONFIGURATION);
copy_params($6, tree_add_param, $$);
copy_params($5, tree_add_genmap, $$);
}
View
4 src/tree.c
@@ -25,7 +25,7 @@
#define MAX_CONTEXTS 16
#define MAX_ATTRS 16
-#define FILE_FMT_VER 0x1008
+#define FILE_FMT_VER 0x1009
//#define EXTRA_READ_CHECKS
@@ -228,7 +228,7 @@ struct tree_rd_ctx {
(IS(t, T_SIGNAL_ASSIGN) || IS(t, T_COND))
#define HAS_RANGE(t) \
(IS(t, T_ARRAY_SLICE) || IS(t, T_FOR) || IS(t, T_FOR_GENERATE))
-#define HAS_CLASS(t) (IS(t, T_PORT_DECL))
+#define HAS_CLASS(t) (IS(t, T_PORT_DECL) || IS(t, T_INSTANCE))
#define HAS_ASSOCS(t) \
(IS(t, T_AGGREGATE) || IS(t, T_CASE)|| IS(t, T_SELECT))
#define HAS_CONDS(t) (IS(t, T_CASSIGN))
View
5 src/tree.h
@@ -38,7 +38,10 @@ typedef enum class {
C_SIGNAL,
C_VARIABLE,
C_CONSTANT,
- C_FILE
+ C_FILE,
+ C_ENTITY,
+ C_COMPONENT,
+ C_CONFIGURATION
} class_t;
typedef enum tree_kind {
View
17 test/test_parse.c
@@ -1154,22 +1154,38 @@ START_TEST(test_instance)
s = tree_stmt(a, 0);
fail_unless(tree_kind(s) == T_INSTANCE);
+ fail_unless(tree_class(s) == C_COMPONENT);
fail_unless(tree_ident(s) == ident_new("A"));
fail_unless(tree_ident2(s) == ident_new("FOO"));
s = tree_stmt(a, 2);
fail_unless(tree_kind(s) == T_INSTANCE);
+ fail_unless(tree_class(s) == C_ENTITY);
fail_unless(tree_ident(s) == ident_new("B1"));
fail_unless(tree_ident2(s) == ident_new("WORK.FOO-GOO"));
+ s = tree_stmt(a, 3);
+ fail_unless(tree_kind(s) == T_INSTANCE);
+ fail_unless(tree_class(s) == C_CONFIGURATION);
+ fail_unless(tree_ident(s) == ident_new("C"));
+ fail_unless(tree_ident2(s) == ident_new("WORK.BAR"));
+
+ s = tree_stmt(a, 4);
+ fail_unless(tree_kind(s) == T_INSTANCE);
+ fail_unless(tree_class(s) == C_COMPONENT);
+ fail_unless(tree_ident(s) == ident_new("D"));
+ fail_unless(tree_ident2(s) == ident_new("FOO"));
+
s = tree_stmt(a, 5);
fail_unless(tree_kind(s) == T_INSTANCE);
+ fail_unless(tree_class(s) == C_ENTITY);
fail_unless(tree_ident(s) == ident_new("E"));
fail_unless(tree_ident2(s) == ident_new("WORK.FOO"));
fail_unless(tree_params(s) == 3);
s = tree_stmt(a, 7);
fail_unless(tree_kind(s) == T_INSTANCE);
+ fail_unless(tree_class(s) == C_ENTITY);
fail_unless(tree_ident(s) == ident_new("G"));
fail_unless(tree_ident2(s) == ident_new("WORK.FOO"));
fail_unless(tree_params(s) == 2);
@@ -1177,6 +1193,7 @@ START_TEST(test_instance)
s = tree_stmt(a, 8);
fail_unless(tree_kind(s) == T_INSTANCE);
+ fail_unless(tree_class(s) == C_ENTITY);
fail_unless(tree_param(s, 0).kind == P_NAMED);
fail_unless(tree_kind(tree_param(s, 0).value) == T_OPEN);
Please sign in to comment.
Something went wrong with that request. Please try again.