Started PIC port (based on mcs51 port)
[fw/sdcc] / src / pic / 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              PIC port   - T. Scott Dattalo scott@dattalo.com (2000)
6
7    This program is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published by the
9    Free Software Foundation; either version 2, or (at your option) any
10    later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20    
21    In other words, you are welcome to use, share and improve this program.
22    You are forbidden to forbid anyone else to use, share and improve
23    what you give them.   Help stamp out software-hoarding!  
24 -------------------------------------------------------------------------*/
25
26 #ifndef SDCCGENPIC14_H
27 #define SDCCGENPIC14_H
28
29 enum {
30     AOP_LIT = 1,
31     AOP_REG, AOP_DIR, 
32     AOP_DPTR, AOP_DPTR2, AOP_R0,AOP_R1,
33     AOP_STK ,AOP_IMMD, AOP_STR,
34     AOP_CRY, AOP_ACC };
35
36 /* type asmop : a homogenised type for 
37    all the different spaces an operand can be
38    in */
39 typedef struct asmop {
40     
41     short type ;  /* can have values
42                      AOP_LIT    -  operand is a literal value
43                      AOP_REG    -  is in registers
44                      AOP_DIR    -  direct just a name
45                      AOP_DPTR   -  dptr contains address of operand
46                      AOP_DPTR2  -  dptr2 contains address of operand (DS80C390 only).
47                      AOP_R0/R1  -  r0/r1 contains address of operand               
48                      AOP_STK    -  should be pushed on stack this
49                                    can happen only for the result
50                      AOP_IMMD   -  immediate value for eg. remateriazable 
51                      AOP_CRY    -  carry contains the value of this
52                      AOP_STR    -  array of strings
53                      AOP_ACC    -  result is in the acc:b pair
54                   */
55     short coff ;  /* current offset */
56     short size ;  /* total size */
57     unsigned code :1 ;         /* is in Code space */
58     unsigned paged:1 ;         /* in paged memory  */
59     unsigned freed:1 ;         /* already freed    */
60     union {
61         value *aop_lit ;       /* if literal */
62         regs  *aop_reg[4];     /* array of registers */
63         char  *aop_dir ;       /* if direct  */
64         regs  *aop_ptr ;       /* either -> to r0 or r1 */
65         char  *aop_immd;       /* if immediate others are implied */    
66         int    aop_stk ;       /* stack offset when AOP_STK */
67         char  *aop_str[4];     /* just a string array containing the location */
68     } aopu;
69 } asmop;
70
71 void genpic14Code (iCode *);
72
73 extern char *fReturnpic14[];
74 extern char *fReturn390[];
75 extern unsigned fReturnSize;
76 extern char **fReturn;
77
78 #endif