Support empty statements for hanging labels.

This commit is contained in:
steve 2001-04-01 06:40:44 +00:00
parent 5769bbe15e
commit ae1d5227de
5 changed files with 43 additions and 7 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: codes.cc,v 1.5 2001/03/22 05:28:41 steve Exp $"
#ident "$Id: codes.cc,v 1.6 2001/04/01 06:40:44 steve Exp $"
#endif
# include "codes.h"
@ -74,6 +74,11 @@ vvp_cpoint_t codespace_allocate(void)
return res;
}
vvp_cpoint_t codespace_next(void)
{
return code_count;
}
vvp_code_t codespace_index(vvp_cpoint_t point)
{
assert(point < code_count);
@ -121,6 +126,9 @@ void codespace_dump(FILE*fd)
/*
* $Log: codes.cc,v $
* Revision 1.6 2001/04/01 06:40:44 steve
* Support empty statements for hanging labels.
*
* Revision 1.5 2001/03/22 05:28:41 steve
* Add code label forward references.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: codes.h,v 1.12 2001/04/01 06:12:13 steve Exp $"
#ident "$Id: codes.h,v 1.13 2001/04/01 06:40:44 steve Exp $"
#endif
@ -87,6 +87,9 @@ extern void codespace_init(void);
*/
extern vvp_cpoint_t codespace_allocate(void);
extern vvp_cpoint_t codespace_next(void);
/*
* Return a pointer to the indexed instruction in the codespace. The
* ptr must be a value returned from codespace_allocate. The compiler
@ -100,6 +103,9 @@ extern void codespace_dump(FILE*fd);
/*
* $Log: codes.h,v $
* Revision 1.13 2001/04/01 06:40:44 steve
* Support empty statements for hanging labels.
*
* Revision 1.12 2001/04/01 06:12:13 steve
* Add the bitwise %and instruction.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.cc,v 1.24 2001/04/01 06:12:13 steve Exp $"
#ident "$Id: compile.cc,v 1.25 2001/04/01 06:40:45 steve Exp $"
#endif
# include "compile.h"
@ -482,6 +482,17 @@ void compile_code(char*label, char*mnem, comp_operands_t opa)
free(mnem);
}
void compile_codelabel(char*label)
{
symbol_value_t val;
vvp_cpoint_t ptr = codespace_next();
val.num = ptr;
sym_set_value(sym_codespace, label, val);
free(label);
}
void compile_vpi_call(char*label, char*name, unsigned argc, vpiHandle*argv)
{
vvp_cpoint_t ptr = codespace_allocate();
@ -696,6 +707,9 @@ void compile_dump(FILE*fd)
/*
* $Log: compile.cc,v $
* Revision 1.25 2001/04/01 06:40:45 steve
* Support empty statements for hanging labels.
*
* Revision 1.24 2001/04/01 06:12:13 steve
* Add the bitwise %and instruction.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.h,v 1.12 2001/03/29 03:46:36 steve Exp $"
#ident "$Id: compile.h,v 1.13 2001/04/01 06:40:45 steve Exp $"
#endif
# include <stdio.h>
@ -104,6 +104,7 @@ typedef struct comp_operands_s*comp_operands_t;
extern void compile_code(char*label, char*mnem, comp_operands_t opa);
extern void compile_vpi_call(char*label, char*name,
unsigned argc, vpiHandle*argv);
extern void compile_codelabel(char*label);
/*
* The parser uses these functions to compile .scope statements.
@ -134,6 +135,9 @@ extern void compile_dump(FILE*fd);
/*
* $Log: compile.h,v $
* Revision 1.13 2001/04/01 06:40:45 steve
* Support empty statements for hanging labels.
*
* Revision 1.12 2001/03/29 03:46:36 steve
* Support named events as mode 2 functors.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: parse.y,v 1.14 2001/03/29 03:46:36 steve Exp $"
#ident "$Id: parse.y,v 1.15 2001/04/01 06:40:45 steve Exp $"
#endif
# include "parse_misc.h"
@ -123,9 +123,10 @@ statement
on the specific instruction. */
| label_opt T_INSTR operands_opt ';'
{ compile_code($1, $2, $3);
}
{ compile_code($1, $2, $3); }
| T_LABEL ';'
{ compile_codelabel($1); }
/* %vpi_call statements are instructions that have unusual operand
requirements so are handled by their own rules. */
@ -307,6 +308,9 @@ int compile_design(const char*path)
/*
* $Log: parse.y,v $
* Revision 1.15 2001/04/01 06:40:45 steve
* Support empty statements for hanging labels.
*
* Revision 1.14 2001/03/29 03:46:36 steve
* Support named events as mode 2 functors.
*