2 * Copyright 2011 Tom Stellard <tstellar@gmail.com>
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:
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.
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.
28 #ifndef RADEON_VARIABLE_H
29 #define RADEON_VARIABLE_H
31 #include "radeon_compiler.h"
33 struct radeon_compiler
;
35 struct rc_reader_data
;
38 struct live_intervals
{
45 struct radeon_compiler
* C
;
46 struct rc_dst_register Dst
;
48 struct rc_instruction
* Inst
;
49 unsigned int ReaderCount
;
50 struct rc_reader
* Readers
;
51 struct live_intervals Live
[4];
53 /* A friend is a variable that shares a reader with another variable.
55 struct rc_variable
* Friend
;
58 void rc_variable_change_dst(
59 struct rc_variable
* var
,
60 unsigned int new_index
,
61 unsigned int new_writemask
);
63 void rc_variable_compute_live_intervals(struct rc_variable
* var
);
65 void rc_variable_add_friend(
66 struct rc_variable
* var
,
67 struct rc_variable
* friend);
69 struct rc_variable
* rc_variable(
70 struct radeon_compiler
* c
,
72 unsigned int DstIndex
,
73 unsigned int DstWriteMask
,
74 struct rc_reader_data
* reader_data
);
76 struct rc_list
* rc_get_variables(struct radeon_compiler
* c
);
78 unsigned int rc_variable_writemask_sum(struct rc_variable
* var
);
80 struct rc_list
* rc_variable_readers_union(struct rc_variable
* var
);
82 struct rc_list
* rc_variable_list_get_writers(
83 struct rc_list
* var_list
,
84 unsigned int src_type
,
87 struct rc_list
* rc_variable_list_get_writers_one_reader(
88 struct rc_list
* var_list
,
89 unsigned int src_type
,
92 void rc_variable_print(struct rc_variable
* var
);
94 #endif /* RADEON_VARIABLE_H */