1 /*-------------------------------------------------------------------------
2   SDCCgen51.h - header file for code generation for 8051
3 
4              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
5 
6    This program is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 -------------------------------------------------------------------------*/
20 
21 #ifndef Z80GEN_H
22 #define Z80GEN_H
23 
24 typedef enum
25 {
26   AOP_INVALID,
27   /* Is a literal */
28   AOP_LIT = 1,
29   /* Is in a register */
30   AOP_REG,
31   /* Is in direct space */
32   AOP_DIR,
33   /* SFR space ($FF00 and above) */
34   AOP_SFR,
35   /* Is on the stack */
36   AOP_STK,
37   /* Is an immediate value */
38   AOP_IMMD,
39   /* Is a string (?) */
40   AOP_STR,
41   /* Is in the carry register */
42   AOP_CRY,
43   /* Is pointed to by IY */
44   AOP_IY,
45   /* Is pointed to by HL */
46   AOP_HL,
47   /* Is in the extended stack pointer (IY on the Z80) */
48   AOP_EXSTK,
49   /* Is referenced by a pointer in a register pair. */
50   AOP_PAIRPTR,
51   /* Read undefined, discard writes */
52   AOP_DUMMY
53 }
54 AOP_TYPE;
55 
56 /* type asmop : a homogenised type for
57    all the different spaces an operand can be
58    in */
59 typedef struct asmop
60 {
61   AOP_TYPE type;
62   short coff;                   /* current offset */
63   short size;                   /* total size */
64   unsigned code:1;              /* is in Code space */
65   unsigned paged:1;             /* in paged memory  */
66   unsigned freed:1;             /* already freed    */
67   unsigned bcInUse:1;           /* for banked I/O, which uses bc for the I/O address */
68   union
69   {
70     value *aop_lit;             /* if literal */
71     reg_info *aop_reg[4];       /* array of registers */
72     char *aop_dir;              /* if direct  */
73     char *aop_immd;             /* if immediate others are implied */
74     int aop_stk;                /* stack offset when AOP_STK */
75     const char *aop_str[4];     /* just a string array containing the location */
76     int aop_pairId;             /* The pair ID */
77   }
78   aopu;
79   signed char regs[9]; // Byte of this aop that is in the register. -1 if no byte of this aop is in the reg.
80 }
81 asmop;
82 
83 void genZ80Code (iCode *);
84 void z80_emitDebuggerSymbol (const char *);
85 
86 extern bool z80_assignment_optimal;
87 extern bool should_omit_frame_ptr;
88 
89 #endif
90 
91