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, struct disasm_info *disasm); 69 70 struct disasm_info * 71 disasm_initialize(const struct gen_device_info *devinfo, 72 const struct cfg_t *cfg); 73 74 struct inst_group * 75 disasm_new_inst_group(struct disasm_info *disasm, unsigned offset); 76 77 void 78 disasm_annotate(struct disasm_info *disasm, 79 struct backend_instruction *inst, unsigned offset); 80 81 void 82 disasm_insert_error(struct disasm_info *disasm, unsigned offset, 83 const char *error); 84 85 #ifdef __cplusplus 86 } /* extern "C" */ 87 #endif 88 89 #endif /* _INTEL_ASM_ANNOTATION_H */ 90