experimental risc-like x86_64 port of neatcc
[neatcc.git] / gen.h
blob606163350604aa46db14655bdb772800d13a1663
1 #define SECSIZE (1 << 18)
2 #define MAXTMP (1 << 12)
3 #define LONGSZ 8
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 void o_label(int id);
58 void o_jmp(int id);
59 void o_jz(int id);
60 void o_jnz(int id);
61 /* conditional instructions */
62 void o_fork(void);
63 void o_forkpush(void);
64 void o_forkjoin(void);
65 /* data/bss sections */
66 void o_mkbss(char *name, int size, int global);
67 void *o_mkdat(char *name, int size, int global);
68 void o_datset(char *name, int off, unsigned bt);
69 /* functions */
70 void o_func_beg(char *name, int argc, int global, int vararg);
71 void o_func_end(void);
72 /* output */
73 void o_write(int fd);