2002-07-08 18:53:07 +00:00
|
|
|
/*
|
2002-10-22 14:53:18 +00:00
|
|
|
emit.h
|
2002-07-08 18:53:07 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
statement emittion
|
2002-07-08 18:53:07 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
Copyright (C) 2002 Bill Currie <bill@taniwha.org>
|
2002-07-08 18:53:07 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2002/07/08
|
2002-07-08 18:53:07 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __emit_h
|
|
|
|
#define __emit_h
|
|
|
|
|
2002-07-08 20:31:59 +00:00
|
|
|
typedef struct codespace_s {
|
|
|
|
struct statement_s *code;
|
|
|
|
int size;
|
|
|
|
int max_size;
|
|
|
|
} codespace_t;
|
|
|
|
|
|
|
|
codespace_t *codespace_new (void);
|
|
|
|
void codespace_delete (codespace_t *codespace);
|
|
|
|
void codespace_addcode (codespace_t *codespace, struct statement_s *code,
|
|
|
|
int size);
|
|
|
|
struct statement_s *codespace_newstatement (codespace_t *codespace);
|
|
|
|
|
2002-07-08 18:53:07 +00:00
|
|
|
struct expr_s;
|
|
|
|
struct def_s *emit_statement (struct expr_s *e, opcode_t *op, struct def_s *var_a, struct def_s *var_b, struct def_s *var_c);
|
2002-07-08 20:31:59 +00:00
|
|
|
struct def_s *emit_sub_expr (struct expr_s*e, struct def_s *dest);
|
2002-07-08 18:53:07 +00:00
|
|
|
void emit_expr (struct expr_s *e);
|
|
|
|
|
2002-07-13 06:09:03 +00:00
|
|
|
#define EMIT_STRING(dest,str) \
|
|
|
|
do { \
|
|
|
|
(dest) = ReuseString (str); \
|
|
|
|
reloc_def_string (POINTER_OFS (&(dest))); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define EMIT_DEF(dest,def) \
|
|
|
|
do { \
|
|
|
|
def_t *d = (def); \
|
|
|
|
(dest) = d ? d->ofs : 0; \
|
|
|
|
if (d) \
|
|
|
|
reloc_def_def (d, POINTER_OFS (&(dest))); \
|
|
|
|
} while (0)
|
|
|
|
|
2002-07-08 18:53:07 +00:00
|
|
|
#endif//__emit_h
|