]> git.gag.com Git - fw/sdcc/blob - src/pic16/genutils.h
* device/lib/pic16/startup/crt0i.c (_cinit): local variables where
[fw/sdcc] / src / pic16 / genutils.h
1
2 /*
3 ** $Id$
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 #endif
16 #define isAOP_LIT(x)      (AOP_TYPE(x) == AOP_LIT)
17 #define isAOP_REGlike(x)  (AOP_TYPE(x) == AOP_REG || AOP_TYPE(x) == AOP_DIR || AOP_TYPE(x) == AOP_PCODE || AOP_TYPE(x) == AOP_STA)
18
19
20 /* Resolved ifx structure. This structure stores information
21  * about an iCode ifx that makes it easier to generate code.
22  */
23 typedef struct resolvedIfx {
24   symbol *lbl;     /* pointer to a label */
25   int condition;   /* true or false ifx */
26   int generated;   /* set true when the code associated with the ifx
27                     * is generated */
28 } resolvedIfx;
29
30
31 /*
32  * The various GEN_xxxxx macros handle which functions
33  * should be included in the gen.c source. We are going to use
34  * our own functions here so, they must be commented out from
35  * gen.c
36  */
37
38 #define GEN_Not
39 void pic16_genNot(iCode *ic);
40
41 #define GEN_Cpl
42 void pic16_genCpl(iCode *ic);
43
44
45 /*
46  * global function definitions
47  */
48 void pic16_DumpValue(char *prefix, value *val);
49 void pic16_DumpPcodeOp(char *prefix, pCodeOp *pcop);
50 void pic16_DumpAop(char *prefix, asmop *aop);
51 void pic16_DumpSymbol(char *prefix, symbol *sym);
52 void pic16_DumpOp(char *prefix, operand *op);
53
54 void gpsimio2_pcop(pCodeOp *pcop);
55 void gpsimio2_lit(unsigned char lit);
56
57 void gpsimDebug_StackDump(char *fname, int line, char *info);
58
59 int pic16_genCmp_special(operand *left, operand *right, operand *result,
60                     iCode *ifx, resolvedIfx *rIfx, int sign);
61
62 #ifndef debugf
63 #define debugf(frm, rest)       _debugf(__FILE__, __LINE__, frm, rest)
64 #endif
65 void _debugf(char *f, int l, char *frm, ...);
66
67 #endif  /* __GENUTILS_H__ */