aubinator: Add a new tool called Aubinator to the src/intel/tools folder.
[mesa.git] / src / intel / tools / decoder.h
1 /*
2 * Copyright © 2016 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 #pragma once
25
26 #include <stdint.h>
27 #include <stdbool.h>
28
29 struct gen_spec;
30 struct gen_group;
31 struct gen_field;
32
33 static inline uint32_t gen_make_gen(uint32_t major, uint32_t minor)
34 {
35 return (major << 8) | minor;
36 }
37
38 struct gen_group *gen_spec_find_struct(struct gen_spec *spec, const char *name);
39 struct gen_spec *gen_spec_load(const char *filename);
40 uint32_t gen_spec_get_gen(struct gen_spec *spec);
41 struct gen_group *gen_spec_find_instruction(struct gen_spec *spec, const uint32_t *p);
42 int gen_group_get_length(struct gen_group *group, const uint32_t *p);
43 const char *gen_group_get_name(struct gen_group *group);
44 uint32_t gen_group_get_opcode(struct gen_group *group);
45
46 struct gen_field_iterator {
47 struct gen_group *group;
48 const char *name;
49 char value[128];
50 uint32_t *p;
51 int i;
52 };
53
54 void gen_field_iterator_init(struct gen_field_iterator *iter,
55 struct gen_group *group, const uint32_t *p);
56
57 bool gen_field_iterator_next(struct gen_field_iterator *iter);