ARM: Error out for attempt to compile with hard-float ABI.
[luajit-2.0.git] / dynasm / dasm_proto.h
blob3cc3af24a6bb3d6b111c2aeea8343c86bee53313
1 /*
2 ** DynASM encoding engine prototypes.
3 ** Copyright (C) 2005-2011 Mike Pall. All rights reserved.
4 ** Released under the MIT license. See dynasm.lua for full copyright notice.
5 */
7 #ifndef _DASM_PROTO_H
8 #define _DASM_PROTO_H
10 #include <stddef.h>
11 #include <stdarg.h>
13 #define DASM_IDENT "DynASM 1.3.0"
14 #define DASM_VERSION 10300 /* 1.3.0 */
16 #ifndef Dst_DECL
17 #define Dst_DECL dasm_State **Dst
18 #endif
20 #ifndef Dst_REF
21 #define Dst_REF (*Dst)
22 #endif
24 #ifndef DASM_FDEF
25 #define DASM_FDEF extern
26 #endif
28 #ifndef DASM_M_GROW
29 #define DASM_M_GROW(ctx, t, p, sz, need) \
30 do { \
31 size_t _sz = (sz), _need = (need); \
32 if (_sz < _need) { \
33 if (_sz < 16) _sz = 16; \
34 while (_sz < _need) _sz += _sz; \
35 (p) = (t *)realloc((p), _sz); \
36 if ((p) == NULL) exit(1); \
37 (sz) = _sz; \
38 } \
39 } while(0)
40 #endif
42 #ifndef DASM_M_FREE
43 #define DASM_M_FREE(ctx, p, sz) free(p)
44 #endif
46 /* Internal DynASM encoder state. */
47 typedef struct dasm_State dasm_State;
50 /* Initialize and free DynASM state. */
51 DASM_FDEF void dasm_init(Dst_DECL, int maxsection);
52 DASM_FDEF void dasm_free(Dst_DECL);
54 /* Setup global array. Must be called before dasm_setup(). */
55 DASM_FDEF void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl);
57 /* Grow PC label array. Can be called after dasm_setup(), too. */
58 DASM_FDEF void dasm_growpc(Dst_DECL, unsigned int maxpc);
60 /* Setup encoder. */
61 DASM_FDEF void dasm_setup(Dst_DECL, const void *actionlist);
63 /* Feed encoder with actions. Calls are generated by pre-processor. */
64 DASM_FDEF void dasm_put(Dst_DECL, int start, ...);
66 /* Link sections and return the resulting size. */
67 DASM_FDEF int dasm_link(Dst_DECL, size_t *szp);
69 /* Encode sections into buffer. */
70 DASM_FDEF int dasm_encode(Dst_DECL, void *buffer);
72 /* Get PC label offset. */
73 DASM_FDEF int dasm_getpclabel(Dst_DECL, unsigned int pc);
75 #ifdef DASM_CHECKS
76 /* Optional sanity checker to call between isolated encoding steps. */
77 DASM_FDEF int dasm_checkstep(Dst_DECL, int secmatch);
78 #else
79 #define dasm_checkstep(a, b) 0
80 #endif
83 #endif /* _DASM_PROTO_H */