Imported Upstream version 2.9.0
[debian/cc1111] / src / z80 / gen.h
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    In other words, you are welcome to use, share and improve this program.
21    You are forbidden to forbid anyone else to use, share and improve
22    what you give them.   Help stamp out software-hoarding!  
23 -------------------------------------------------------------------------*/
24
25 #ifndef Z80GEN_H
26 #define Z80GEN_H
27
28 typedef enum
29   {
30     AOP_INVALID,
31     /* Is a literal */
32     AOP_LIT = 1,
33     /* Is in a register */
34     AOP_REG,
35     /* Is in direct space */
36     AOP_DIR,
37     /* SFR space ($FF00 and above) */
38     AOP_SFR,
39     /* Is on the stack */
40     AOP_STK,
41     /* Is an immediate value */
42     AOP_IMMD,
43     /* Is a string (?) */
44     AOP_STR,
45     /* Is in the carry register */
46     AOP_CRY,
47     /* Is pointed to by IY */
48     AOP_IY,
49     /* Is pointed to by HL */
50     AOP_HL,
51     /* Is in A */
52     AOP_ACC,
53     /* Is in H and L */
54     AOP_HLREG,
55     /* Simple literal. */
56     AOP_SIMPLELIT,
57     /* Is in the extended stack pointer (IY on the Z80) */
58     AOP_EXSTK,
59     /* Is referenced by a pointer in a register pair. */
60     AOP_PAIRPTR,
61     /* Read as 0, discard writes */
62     AOP_DUMMY
63   }
64 AOP_TYPE;
65
66 /* type asmop : a homogenised type for 
67    all the different spaces an operand can be
68    in */
69 typedef struct asmop
70   {
71     AOP_TYPE type;
72     short coff;                 /* current offset */
73     short size;                 /* total size */
74     unsigned  code:1;               /* is in Code space */
75     unsigned  paged:1;              /* in paged memory  */
76     unsigned  freed:1;              /* already freed    */
77     unsigned  bcInUse:1;
78     unsigned  deInUse:1;
79     union
80       {
81         value *aop_lit;         /* if literal */
82         regs *aop_reg[4];       /* array of registers */
83         char *aop_dir;          /* if direct  */
84         char *aop_immd;         /* if immediate others are implied */
85         int aop_stk;            /* stack offset when AOP_STK */
86         const char *aop_str[4]; /* just a string array containing the location */
87         unsigned long aop_simplelit; /* Just the value. */
88         int aop_pairId;         /* The pair ID */
89       }
90     aopu;
91   }
92 asmop;
93
94 void genZ80Code (iCode *);
95 void z80_emitDebuggerSymbol (char *);
96
97
98 #endif