Debian Codegraph @

src/panfrost/genxml/gen_macros.h

raw
1 /*
2 * Copyright ©2021 Collabora Ltd.
3 * Copyright © 2015 Intel Corporation
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef GEN_MACROS_H
8 #define GEN_MACROS_H
9
10 /* Macros for handling per-gen compilation.
11 *
12 * The macro GENX() automatically suffixes whatever you give it with _vX
13 *
14 * You can do pseudo-runtime checks in your function such as
15 *
16 * if (PAN_ARCH == 4) {
17 * // Do something
18 * }
19 *
20 * The contents of the if statement must be valid regardless of gen, but
21 * the if will get compiled away on everything except first-generation Midgard.
22 *
23 * For places where you really do have a compile-time conflict, you can
24 * use preprocessor logic:
25 *
26 * #if (PAN_ARCH == 75)
27 * // Do something
28 * #endif
29 *
30 * However, it is strongly recommended that the former be used whenever
31 * possible.
32 */
33
34 /* Base macro defined on the command line. */
35 #ifndef PAN_ARCH
36 #include "genxml/common_pack.h"
37 #else
38
39 /* Suffixing macros */
40 #if (PAN_ARCH == 4)
41 #define GENX(X) X##_v4
42 #include "genxml/v4_pack.h"
43 #elif (PAN_ARCH == 5)
44 #define GENX(X) X##_v5
45 #include "genxml/v5_pack.h"
46 #elif (PAN_ARCH == 6)
47 #define GENX(X) X##_v6
48 #include "genxml/v6_pack.h"
49 #elif (PAN_ARCH == 7)
50 #define GENX(X) X##_v7
51 #include "genxml/v7_pack.h"
52 #elif (PAN_ARCH == 9)
53 #define GENX(X) X##_v9
54 #include "genxml/v9_pack.h"
55 #elif (PAN_ARCH == 10)
56 #define GENX(X) X##_v10
57 #include "genxml/v10_pack.h"
58 #elif (PAN_ARCH == 12)
59 #define GENX(X) X##_v12
60 #include "genxml/v12_pack.h"
61 #elif (PAN_ARCH == 13)
62 #define GENX(X) X##_v13
63 #include "genxml/v13_pack.h"
64 #else
65 #error "Need to add suffixing macro for this architecture"
66 #endif
67
68 #endif /* PAN_ARCH */
69 #endif /* GEN_MACROS_H */