Skip to content
Browse files

Fix regression caused by earlier procedure changes

  • Loading branch information...
1 parent b074323 commit 03783521920c41ac45497ed09ad8503365ac3c68 @nickg committed Dec 26, 2012
Showing with 24 additions and 18 deletions.
  1. +18 −18 src/cgen.c
  2. +6 −0 test/regress/proc3.vhd
View
36 src/cgen.c
@@ -3102,6 +3102,24 @@ static void cgen_proc_body(tree_t t)
LLVMBasicBlockRef entry_bb = LLVMAppendBasicBlock(fn, "entry");
LLVMPositionBuilderAtEnd(builder, entry_bb);
+ for (int i = 0; i < nports; i++) {
+ tree_t p = tree_port(t, i);
+ switch (tree_class(p)) {
+ case C_SIGNAL:
+ tree_add_attr_ptr(p, sig_struct_i, LLVMGetParam(fn, i));
+ break;
+
+ case C_VARIABLE:
+ case C_DEFAULT:
+ case C_CONSTANT:
+ tree_add_attr_ptr(p, local_var_i, LLVMGetParam(fn, i));
+ break;
+
+ default:
+ assert(false);
+ }
+ }
+
// Generate a jump table to handle resuming from a wait statement
struct cgen_ctx ctx = {
@@ -3183,24 +3201,6 @@ static void cgen_proc_body(tree_t t)
else
tree_visit_only(t, cgen_func_vars, &ctx, T_VAR_DECL);
- for (unsigned i = 0; i < tree_ports(t); i++) {
- tree_t p = tree_port(t, i);
- switch (tree_class(p)) {
- case C_SIGNAL:
- tree_add_attr_ptr(p, sig_struct_i, LLVMGetParam(fn, i));
- break;
-
- case C_VARIABLE:
- case C_DEFAULT:
- case C_CONSTANT:
- tree_add_attr_ptr(p, local_var_i, LLVMGetParam(fn, i));
- break;
-
- default:
- assert(false);
- }
- }
-
for (unsigned i = 0; i < tree_stmts(t); i++)
cgen_stmt(tree_stmt(t, i), &ctx);
View
6 test/regress/proc3.vhd
@@ -36,6 +36,12 @@ architecture test of proc3 is
y := k;
end procedure;
+ procedure p5(x : in integer; y : out integer) is
+ variable k : integer := x + 1;
+ begin
+ y := k;
+ end procedure;
+
begin
process is

0 comments on commit 0378352

Please sign in to comment.
Something went wrong with that request. Please try again.