xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/r300/compiler/radeon_variable.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2011 Tom Stellard <[email protected]>
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(
37 	struct rc_variable * var,
38 	unsigned int new_index,
39 	unsigned int new_writemask);
40 
41 void rc_variable_compute_live_intervals(struct rc_variable * var);
42 
43 void rc_variable_add_friend(
44 	struct rc_variable * var,
45 	struct rc_variable * friend);
46 
47 struct rc_variable * rc_variable(
48 	struct radeon_compiler * c,
49 	unsigned int DstFile,
50 	unsigned int DstIndex,
51 	unsigned int DstWriteMask,
52 	struct rc_reader_data * reader_data);
53 
54 struct rc_list * rc_get_variables(struct radeon_compiler * c);
55 
56 unsigned int rc_variable_writemask_sum(struct rc_variable * var);
57 
58 struct rc_list * rc_variable_readers_union(struct rc_variable * var);
59 
60 struct rc_list * rc_variable_list_get_writers(
61 	struct rc_list * var_list,
62 	unsigned int src_type,
63 	void * src);
64 
65 struct rc_list * rc_variable_list_get_writers_one_reader(
66 	struct rc_list * var_list,
67 	unsigned int src_type,
68 	void * src);
69 
70 void rc_variable_print(struct rc_variable * var);
71 
72 #endif /* RADEON_VARIABLE_H */
73