1 /* 2 * Copyright 2011 Tom Stellard <tstellar (at) gmail.com> 3 * 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining 7 * a copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sublicense, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial 16 * portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 */ 27 28 #ifndef RADEON_VARIABLE_H 29 #define RADEON_VARIABLE_H 30 31 #include "radeon_compiler.h" 32 33 struct radeon_compiler; 34 struct rc_list; 35 struct rc_reader_data; 36 struct rc_readers; 37 38 struct live_intervals { 39 int Start; 40 int End; 41 int Used; 42 }; 43 44 struct rc_variable { 45 struct radeon_compiler * C; 46 struct rc_dst_register Dst; 47 48 struct rc_instruction * Inst; 49 unsigned int ReaderCount; 50 struct rc_reader * Readers; 51 struct live_intervals Live[4]; 52 53 /* A friend is a variable that shares a reader with another variable. 54 */ 55 struct rc_variable * Friend; 56 }; 57 58 void rc_variable_change_dst( 59 struct rc_variable * var, 60 unsigned int new_index, 61 unsigned int new_writemask); 62 63 void rc_variable_compute_live_intervals(struct rc_variable * var); 64 65 void rc_variable_add_friend( 66 struct rc_variable * var, 67 struct rc_variable * friend); 68 69 struct rc_variable * rc_variable( 70 struct radeon_compiler * c, 71 unsigned int DstFile, 72 unsigned int DstIndex, 73 unsigned int DstWriteMask, 74 struct rc_reader_data * reader_data); 75 76 struct rc_list * rc_get_variables(struct radeon_compiler * c); 77 78 unsigned int rc_variable_writemask_sum(struct rc_variable * var); 79 80 struct rc_list * rc_variable_readers_union(struct rc_variable * var); 81 82 struct rc_list * rc_variable_list_get_writers( 83 struct rc_list * var_list, 84 unsigned int src_type, 85 void * src); 86 87 struct rc_list * rc_variable_list_get_writers_one_reader( 88 struct rc_list * var_list, 89 unsigned int src_type, 90 void * src); 91 92 void rc_variable_print(struct rc_variable * var); 93 94 #endif /* RADEON_VARIABLE_H */ 95