ncc: support (expr, expr) expression
[neatcc/cc.git] / gen.h
blobaf2889fcd1eb9e6a3d765e51a1003bca82589a3b
1 #define SECSIZE (1 << 18)
2 #define MAXTMP (1 << 12)
3 #define LONGSZ 4
5 /* basic types */
6 #define BT_SZMASK 0x00ff
7 #define BT_SIGNED 0x0100
8 #define BT_SZ(bt) ((bt) & BT_SZMASK)
10 #define O_SIGNED 0x100
11 /* binary operations for o_bop() */
12 #define O_ADD 0x00
13 #define O_SUB 0x01
14 #define O_AND 0x02
15 #define O_OR 0x03
16 #define O_XOR 0x04
17 #define O_SHL 0x10
18 #define O_SHR 0x11
19 #define O_MUL 0x20
20 #define O_DIV 0x21
21 #define O_MOD 0x22
22 #define O_LT 0x30
23 #define O_GT 0x31
24 #define O_LE 0x32
25 #define O_GE 0x33
26 #define O_EQ 0x34
27 #define O_NEQ 0x35
28 /* unary operations for o_uop() */
29 #define O_NEG 0x40
30 #define O_NOT 0x41
31 #define O_LNOT 0x42
33 /* operations */
34 void o_bop(int op);
35 void o_uop(int op);
36 void o_cast(unsigned bt);
37 void o_memcpy(void);
38 void o_memset(void);
39 void o_call(int argc, int ret);
40 void o_ret(int ret);
41 void o_assign(unsigned bt);
42 void o_deref(unsigned bt);
43 void o_load(void);
44 int o_popnum(long *c);
45 /* pushing values */
46 void o_num(long n);
47 void o_local(long addr);
48 void o_sym(char *sym);
49 void o_tmpdrop(int n);
50 void o_tmpswap(void);
51 void o_tmpcopy(void);
52 /* handling locals */
53 long o_mklocal(int size);
54 void o_rmlocal(long addr, int sz);
55 long o_arg2loc(int i);
56 /* branches */
57 long o_mklabel(void);
58 long o_jz(long addr);
59 long o_jnz(long addr);
60 long o_jmp(long addr);
61 void o_filljmp(long addr);
62 void o_filljmp2(long addr, long jmpdst);
63 /* conditional instructions */
64 void o_fork(void);
65 void o_forkpush(void);
66 void o_forkjoin(void);
67 /* data/bss sections */
68 void o_mkbss(char *name, int size, int global);
69 void *o_mkdat(char *name, int size, int global);
70 void o_datset(char *name, int off, unsigned bt);
71 /* functions */
72 void o_func_beg(char *name, int argc, int global, int vararg);
73 void o_func_end(void);
74 /* output */
75 void o_write(int fd);