struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / src / z80 / gen.h
blobea22520e23d56c4a2cf47e532878f148a90a2040
1 /*-------------------------------------------------------------------------
2 SDCCgen51.h - header file for code generation for 8051
4 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
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.
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.
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 -------------------------------------------------------------------------*/
21 #ifndef Z80GEN_H
22 #define Z80GEN_H
24 typedef enum
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 an address on the stack */
40 AOP_STL,
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 on the extended stack (addressed via IY or HL) */
48 AOP_EXSTK,
49 /* Is referenced by a pointer in a register pair. */
50 AOP_PAIRPTR,
51 /* Read undefined, discard writes */
52 AOP_DUMMY
54 AOP_TYPE;
56 /* type asmop : a homogenised type for
57 all the different spaces an operand can be
58 in */
59 typedef struct asmop
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
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 or AOP_STL*/
75 int aop_pairId; /* The pair ID */
77 aopu;
78 signed char regs[9]; // Byte of this aop that is in the register. -1 if no byte of this aop is in the reg.
79 struct valinfo valinfo;
81 asmop;
83 void genZ80Code (iCode *);
84 void z80_emitDebuggerSymbol (const char *);
87 bool z80IsReturned(const char *what);
89 // Check if what is part of the ith argument (counting from 1) to a function of type ftype.
90 // If what is 0, just check if hte ith argument is in registers.
91 bool z80IsRegArg(struct sym_link *ftype, int i, const char *what);
93 // Check if what is part of the any argument (counting from 1) to a function of type ftype.
94 bool z80IsParmInCall(sym_link *ftype, const char *what);
96 extern bool z80_assignment_optimal;
97 extern bool should_omit_frame_ptr;
99 #endif