• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2014 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 _INTEL_ASM_ANNOTATION_H
25 #define _INTEL_ASM_ANNOTATION_H
26 
27 #include "compiler/glsl/list.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct cfg_t;
34 struct backend_instruction;
35 struct gen_device_info;
36 
37 struct inst_group {
38    struct exec_node link;
39 
40    int offset;
41 
42    size_t error_length;
43    char *error;
44 
45    /* Pointers to the basic block in the CFG if the instruction group starts
46     * or ends a basic block.
47     */
48    struct bblock_t *block_start;
49    struct bblock_t *block_end;
50 
51    /* Annotation for the generated IR.  One of the two can be set. */
52    const void *ir;
53    const char *annotation;
54 };
55 
56 struct disasm_info {
57    struct exec_list group_list;
58 
59    const struct gen_device_info *devinfo;
60    const struct cfg_t *cfg;
61 
62    /** Block index in the cfg. */
63    int cur_block;
64    bool use_tail;
65 };
66 
67 void
68 dump_assembly(void *assembly, int start_offset, int end_offset,
69               struct disasm_info *disasm, const unsigned *block_latency);
70 
71 struct disasm_info *
72 disasm_initialize(const struct gen_device_info *devinfo,
73                   const struct cfg_t *cfg);
74 
75 struct inst_group *
76 disasm_new_inst_group(struct disasm_info *disasm, unsigned offset);
77 
78 void
79 disasm_annotate(struct disasm_info *disasm,
80                 struct backend_instruction *inst, unsigned offset);
81 
82 void
83 disasm_insert_error(struct disasm_info *disasm, unsigned offset,
84                     const char *error);
85 
86 #ifdef __cplusplus
87 } /* extern "C" */
88 #endif
89 
90 #endif /* _INTEL_ASM_ANNOTATION_H */
91