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 30extern "C" { 31#endif 32 33struct cfg_t; 34struct backend_instruction; 35struct intel_device_info; 36 37struct 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 56struct disasm_info { 57 struct exec_list group_list; 58 59 const struct intel_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 67void 68dump_assembly(void *assembly, int start_offset, int end_offset, 69 struct disasm_info *disasm, const unsigned *block_latency); 70 71struct disasm_info * 72disasm_initialize(const struct intel_device_info *devinfo, 73 const struct cfg_t *cfg); 74 75struct inst_group * 76disasm_new_inst_group(struct disasm_info *disasm, unsigned offset); 77 78void 79disasm_annotate(struct disasm_info *disasm, 80 struct backend_instruction *inst, unsigned offset); 81 82void 83disasm_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