src/arm/emitter-inlines.h (view raw)
1#ifndef EMITTER_INLINES_H
2#define EMITTER_INLINES_H
3
4#define DO_4(DIRECTIVE) \
5 DIRECTIVE, \
6 DIRECTIVE, \
7 DIRECTIVE, \
8 DIRECTIVE
9
10#define DO_8(DIRECTIVE) \
11 DIRECTIVE, \
12 DIRECTIVE, \
13 DIRECTIVE, \
14 DIRECTIVE, \
15 DIRECTIVE, \
16 DIRECTIVE, \
17 DIRECTIVE, \
18 DIRECTIVE
19
20#define DO_256(DIRECTIVE) \
21 DO_4(DO_8(DO_8(DIRECTIVE)))
22
23#define DO_INTERLACE(LEFT, RIGHT) \
24 LEFT, \
25 RIGHT
26
27#define APPLY(F, ...) F(__VA_ARGS__)
28
29#define COUNT_1(EMITTER, PREFIX, ...) \
30 EMITTER(PREFIX ## 0, 0, __VA_ARGS__) \
31 EMITTER(PREFIX ## 1, 1, __VA_ARGS__)
32
33#define COUNT_2(EMITTER, PREFIX, ...) \
34 COUNT_1(EMITTER, PREFIX, __VA_ARGS__) \
35 EMITTER(PREFIX ## 2, 2, __VA_ARGS__) \
36 EMITTER(PREFIX ## 3, 3, __VA_ARGS__)
37
38#define COUNT_3(EMITTER, PREFIX, ...) \
39 COUNT_2(EMITTER, PREFIX, __VA_ARGS__) \
40 EMITTER(PREFIX ## 4, 4, __VA_ARGS__) \
41 EMITTER(PREFIX ## 5, 5, __VA_ARGS__) \
42 EMITTER(PREFIX ## 6, 6, __VA_ARGS__) \
43 EMITTER(PREFIX ## 7, 7, __VA_ARGS__)
44
45#define COUNT_4(EMITTER, PREFIX, ...) \
46 COUNT_3(EMITTER, PREFIX, __VA_ARGS__) \
47 EMITTER(PREFIX ## 8, 8, __VA_ARGS__) \
48 EMITTER(PREFIX ## 9, 9, __VA_ARGS__) \
49 EMITTER(PREFIX ## A, 10, __VA_ARGS__) \
50 EMITTER(PREFIX ## B, 11, __VA_ARGS__) \
51 EMITTER(PREFIX ## C, 12, __VA_ARGS__) \
52 EMITTER(PREFIX ## D, 13, __VA_ARGS__) \
53 EMITTER(PREFIX ## E, 14, __VA_ARGS__) \
54 EMITTER(PREFIX ## F, 15, __VA_ARGS__)
55
56#define COUNT_5(EMITTER, PREFIX, ...) \
57 COUNT_4(EMITTER, PREFIX ## 0, __VA_ARGS__) \
58 EMITTER(PREFIX ## 10, 16, __VA_ARGS__) \
59 EMITTER(PREFIX ## 11, 17, __VA_ARGS__) \
60 EMITTER(PREFIX ## 12, 18, __VA_ARGS__) \
61 EMITTER(PREFIX ## 13, 19, __VA_ARGS__) \
62 EMITTER(PREFIX ## 14, 20, __VA_ARGS__) \
63 EMITTER(PREFIX ## 15, 21, __VA_ARGS__) \
64 EMITTER(PREFIX ## 16, 22, __VA_ARGS__) \
65 EMITTER(PREFIX ## 17, 23, __VA_ARGS__) \
66 EMITTER(PREFIX ## 18, 24, __VA_ARGS__) \
67 EMITTER(PREFIX ## 19, 25, __VA_ARGS__) \
68 EMITTER(PREFIX ## 1A, 26, __VA_ARGS__) \
69 EMITTER(PREFIX ## 1B, 27, __VA_ARGS__) \
70 EMITTER(PREFIX ## 1C, 28, __VA_ARGS__) \
71 EMITTER(PREFIX ## 1D, 29, __VA_ARGS__) \
72 EMITTER(PREFIX ## 1E, 30, __VA_ARGS__) \
73 EMITTER(PREFIX ## 1F, 31, __VA_ARGS__) \
74
75#define DUMMY(X, ...) X,
76#define DUMMY_4(...) \
77 DUMMY(__VA_ARGS__) \
78 DUMMY(__VA_ARGS__) \
79 DUMMY(__VA_ARGS__) \
80 DUMMY(__VA_ARGS__)
81
82#endif