Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / intel / compiler / brw_reg_type.h
1 /*
2 * Copyright © 2017 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #ifndef BRW_REG_TYPE_H
25 #define BRW_REG_TYPE_H
26
27 #include <stdbool.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #ifdef HAVE_FUNC_ATTRIBUTE_PURE
34 #define ATTRIBUTE_PURE __attribute__((__pure__))
35 #else
36 #define ATTRIBUTE_PURE
37 #endif
38
39 enum brw_reg_file;
40 struct gen_device_info;
41
42 /*
43 * The ordering has been chosen so that no enum value is the same as a
44 * compatible hardware encoding.
45 */
46 enum PACKED brw_reg_type {
47 /** Floating-point types: @{ */
48 BRW_REGISTER_TYPE_NF,
49 BRW_REGISTER_TYPE_DF,
50 BRW_REGISTER_TYPE_F,
51 BRW_REGISTER_TYPE_HF,
52 BRW_REGISTER_TYPE_VF,
53 /** @} */
54
55 /** Integer types: @{ */
56 BRW_REGISTER_TYPE_Q,
57 BRW_REGISTER_TYPE_UQ,
58 BRW_REGISTER_TYPE_D,
59 BRW_REGISTER_TYPE_UD,
60 BRW_REGISTER_TYPE_W,
61 BRW_REGISTER_TYPE_UW,
62 BRW_REGISTER_TYPE_B,
63 BRW_REGISTER_TYPE_UB,
64 BRW_REGISTER_TYPE_V,
65 BRW_REGISTER_TYPE_UV,
66 /** @} */
67
68 BRW_REGISTER_TYPE_LAST = BRW_REGISTER_TYPE_UV
69 };
70
71 static inline bool
72 brw_reg_type_is_floating_point(enum brw_reg_type type)
73 {
74 switch (type) {
75 case BRW_REGISTER_TYPE_NF:
76 case BRW_REGISTER_TYPE_DF:
77 case BRW_REGISTER_TYPE_F:
78 case BRW_REGISTER_TYPE_HF:
79 return true;
80 default:
81 return false;
82 }
83 }
84
85 static inline bool
86 brw_reg_type_is_integer(enum brw_reg_type type)
87 {
88 switch (type) {
89 case BRW_REGISTER_TYPE_Q:
90 case BRW_REGISTER_TYPE_UQ:
91 case BRW_REGISTER_TYPE_D:
92 case BRW_REGISTER_TYPE_UD:
93 case BRW_REGISTER_TYPE_W:
94 case BRW_REGISTER_TYPE_UW:
95 case BRW_REGISTER_TYPE_B:
96 case BRW_REGISTER_TYPE_UB:
97 return true;
98 default:
99 return false;
100 }
101 }
102
103 #define INVALID_REG_TYPE ((enum brw_reg_type)-1)
104 #define INVALID_HW_REG_TYPE ((unsigned)-1)
105
106 unsigned
107 brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
108 enum brw_reg_file file, enum brw_reg_type type);
109
110 enum brw_reg_type ATTRIBUTE_PURE
111 brw_hw_type_to_reg_type(const struct gen_device_info *devinfo,
112 enum brw_reg_file file, unsigned hw_type);
113
114 unsigned
115 brw_reg_type_to_a16_hw_3src_type(const struct gen_device_info *devinfo,
116 enum brw_reg_type type);
117
118 unsigned
119 brw_reg_type_to_a1_hw_3src_type(const struct gen_device_info *devinfo,
120 enum brw_reg_type type);
121
122 enum brw_reg_type
123 brw_a16_hw_3src_type_to_reg_type(const struct gen_device_info *devinfo,
124 unsigned hw_type);
125
126 enum brw_reg_type
127 brw_a1_hw_3src_type_to_reg_type(const struct gen_device_info *devinfo,
128 unsigned hw_type, unsigned exec_type);
129
130 unsigned
131 brw_reg_type_to_size(enum brw_reg_type type);
132
133 const char *
134 brw_reg_type_to_letters(enum brw_reg_type type);
135
136 #ifdef __cplusplus
137 }
138 #endif
139
140 #endif