1 /* 2 * Copyright 2011 Tom Stellard <tstellar@gmail.com> 3 * SPDX-License-Identifier: MIT 4 */ 5 6 #ifndef RADEON_VARIABLE_H 7 #define RADEON_VARIABLE_H 8 9 #include "radeon_compiler.h" 10 11 struct radeon_compiler; 12 struct rc_list; 13 struct rc_reader_data; 14 struct rc_readers; 15 16 struct live_intervals { 17 int Start; 18 int End; 19 int Used; 20 }; 21 22 struct rc_variable { 23 struct radeon_compiler *C; 24 struct rc_dst_register Dst; 25 26 struct rc_instruction *Inst; 27 unsigned int ReaderCount; 28 struct rc_reader *Readers; 29 struct live_intervals Live[4]; 30 31 /* A friend is a variable that shares a reader with another variable. 32 */ 33 struct rc_variable *Friend; 34 }; 35 36 void rc_variable_change_dst(struct rc_variable *var, unsigned int new_index, 37 unsigned int new_writemask); 38 39 void rc_variable_compute_live_intervals(struct rc_variable *var); 40 41 void rc_variable_add_friend(struct rc_variable *var, struct rc_variable *friend); 42 43 struct rc_variable *rc_variable(struct radeon_compiler *c, unsigned int DstFile, 44 unsigned int DstIndex, unsigned int DstWriteMask, 45 struct rc_reader_data *reader_data); 46 47 struct rc_list *rc_get_variables(struct radeon_compiler *c); 48 49 unsigned int rc_variable_writemask_sum(struct rc_variable *var); 50 51 struct rc_list *rc_variable_readers_union(struct rc_variable *var); 52 53 struct rc_list *rc_variable_list_get_writers(struct rc_list *var_list, unsigned int src_type, 54 void *src); 55 56 struct rc_list *rc_variable_list_get_writers_one_reader(struct rc_list *var_list, 57 unsigned int src_type, void *src); 58 59 void rc_variable_print(struct rc_variable *var); 60 61 #endif /* RADEON_VARIABLE_H */ 62