Imported Upstream version 2.9.0
[debian/cc1111] / src / pic16 / genutils.h
1
2 /*
3 ** $Id: genutils.h 4051 2006-03-06 08:27:52Z vrokas $
4 */
5
6 #ifndef __GENUTILS_H__
7 #define __GENUTILS_H__
8
9
10 #include "common.h"
11
12
13 #if !defined(__BORLANDC__) && !defined(_MSC_VER)
14 #define DEBUGpc(fmt,...)  DEBUGpic16_emitcode("; =:=", "%s:%s:%d: " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
15 #else
16 #define DEBUGpc           1 ? (void)0 : printf
17 #endif
18 #define isAOP_LIT(x)      (AOP_TYPE(x) == AOP_LIT)
19 #define isAOP_REGlike(x)  (AOP_TYPE(x) == AOP_REG || AOP_TYPE(x) == AOP_DIR || AOP_TYPE(x) == AOP_PCODE || AOP_TYPE(x) == AOP_STA)
20
21
22 /* Resolved ifx structure. This structure stores information
23  * about an iCode ifx that makes it easier to generate code.
24  */
25 typedef struct resolvedIfx {
26   symbol *lbl;     /* pointer to a label */
27   int condition;   /* true or false ifx */
28   int generated;   /* set true when the code associated with the ifx
29                     * is generated */
30 } resolvedIfx;
31
32
33 /*
34  * The various GEN_xxxxx macros handle which functions
35  * should be included in the gen.c source. We are going to use
36  * our own functions here so, they must be commented out from
37  * gen.c
38  */
39
40 #define GEN_Not
41 void pic16_genNot(iCode *ic);
42
43 #define GEN_Cpl
44 void pic16_genCpl(iCode *ic);
45
46
47 /*
48  * global function definitions
49  */
50 void pic16_DumpValue(char *prefix, value *val);
51 void pic16_DumpPcodeOp(char *prefix, pCodeOp *pcop);
52 void pic16_DumpAop(char *prefix, asmop *aop);
53 void pic16_DumpSymbol(char *prefix, symbol *sym);
54 void pic16_DumpOp(char *prefix, operand *op);
55 void pic16_DumpOpX(FILE *fp, char *prefix, operand *op);
56
57 pCodeOp *pic16_popGetWithString(char *str);
58 void pic16_callGenericPointerRW(int rw, int size);
59
60
61
62 void gpsimio2_pcop(pCodeOp *pcop);
63 void gpsimio2_lit(unsigned char lit);
64
65 void gpsimDebug_StackDump(char *fname, int line, char *info);
66
67 int pic16_genCmp_special(operand *left, operand *right, operand *result,
68                     iCode *ifx, resolvedIfx *rIfx, int sign);
69
70 #ifndef debugf
71 #define debugf(frm, rest)       _debugf(__FILE__, __LINE__, frm, rest)
72 #endif
73 void _debugf(char *f, int l, char *frm, ...);
74
75 #endif  /* __GENUTILS_H__ */