struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / src / mos6502 / gen.h
blob37c3a0017846ab1182588c2191d589c57464d1d3
1 /*-------------------------------------------------------------------------
2 gen.h - header file for code generation for mos6502
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 SDCCGENM6502_H
22 #define SDCCGENM6502_H
24 typedef enum
26 AOP_INVALID,
27 AOP_LIT = 1, /* operand is a literal value */
28 AOP_REG, /* is in registers */
29 AOP_DIR, /* operand using direct addressing mode */
30 AOP_STK, /* should be pushed on stack this
31 can happen only for the result */
32 AOP_IMMD, /* immediate value for eg. remateriazable */
33 AOP_STR, /* array of strings */
34 AOP_CRY, /* carry contains the value of this */
35 AOP_EXT, /* operand using extended addressing mode */
36 AOP_SOF, /* operand at an offset on the stack */
37 AOP_DUMMY, /* Read undefined, discard writes */
38 AOP_IDX /* operand using indexed addressing mode */
40 AOP_TYPE;
42 /* asmop: A homogenised type for all the different
43 spaces an operand can be in */
44 typedef struct asmop
46 AOP_TYPE type;
47 short coff; /* current offset */
48 short size; /* total size */
49 short regmask; /* register mask if AOP_REG */
50 operand *op; /* originating operand */
51 unsigned freed:1; /* already freed */
52 unsigned stacked:1; /* partial results stored on stack */
53 struct asmop *stk_aop[4]; /* asmops for the results on the stack */
54 union
56 value *aop_lit; /* if literal */
57 reg_info *aop_reg[4]; /* array of registers */
58 char *aop_dir; /* if direct */
59 char *aop_immd; /* if immediate */
60 int aop_stk; /* stack offset when AOP_STK */
61 } aopu;
63 asmop;
65 void genm6502Code (iCode *);
66 void m6502_emitDebuggerSymbol (const char *);
68 extern unsigned fReturnSizeM6502;
70 extern bool m6502_assignment_optimal;
72 #endif