r300g: Init regalloc state during context creation
[mesa.git] / src / gallium / drivers / r300 / compiler / radeon_compiler_util.h
1 #include "radeon_program_constants.h"
2
3 #ifndef RADEON_PROGRAM_UTIL_H
4 #define RADEON_PROGRAM_UTIL_H
5
6 #include "radeon_opcodes.h"
7
8 struct radeon_compiler;
9 struct rc_instruction;
10 struct rc_pair_instruction;
11 struct rc_pair_sub_instruction;
12 struct rc_src_register;
13
14 unsigned int rc_swizzle_to_writemask(unsigned int swz);
15
16 rc_swizzle get_swz(unsigned int swz, rc_swizzle idx);
17
18 unsigned int rc_init_swizzle(unsigned int initial_value, unsigned int channels);
19
20 unsigned int combine_swizzles4(unsigned int src,
21 rc_swizzle swz_x, rc_swizzle swz_y,
22 rc_swizzle swz_z, rc_swizzle swz_w);
23
24 unsigned int combine_swizzles(unsigned int src, unsigned int swz);
25
26 rc_swizzle rc_mask_to_swizzle(unsigned int mask);
27
28 unsigned swizzle_mask(unsigned swizzle, unsigned mask);
29
30 unsigned int rc_adjust_channels(
31 unsigned int old_swizzle,
32 unsigned int conversion_swizzle);
33
34 void rc_pair_rewrite_writemask(
35 struct rc_pair_sub_instruction * sub,
36 unsigned int conversion_swizzle);
37
38 void rc_normal_rewrite_writemask(
39 struct rc_instruction * inst,
40 unsigned int conversion_swizzle);
41
42 unsigned int rc_rewrite_swizzle(
43 unsigned int swizzle,
44 unsigned int new_mask);
45
46 struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg);
47
48 void reset_srcreg(struct rc_src_register* reg);
49
50 unsigned int rc_src_reads_dst_mask(
51 rc_register_file src_file,
52 unsigned int src_idx,
53 unsigned int src_swz,
54 rc_register_file dst_file,
55 unsigned int dst_idx,
56 unsigned int dst_mask);
57
58 unsigned int rc_source_type_swz(unsigned int swizzle);
59
60 unsigned int rc_source_type_mask(unsigned int mask);
61
62 unsigned int rc_inst_can_use_presub(
63 struct rc_instruction * inst,
64 rc_presubtract_op presub_op,
65 unsigned int presub_writemask,
66 const struct rc_src_register * replace_reg,
67 const struct rc_src_register * presub_src0,
68 const struct rc_src_register * presub_src1);
69
70 int rc_get_max_index(
71 struct radeon_compiler * c,
72 rc_register_file file);
73
74 unsigned int rc_pair_remove_src(
75 struct rc_instruction * inst,
76 unsigned int src_type,
77 unsigned int source,
78 unsigned int new_readmask);
79
80 rc_opcode rc_get_flow_control_inst(struct rc_instruction * inst);
81
82 struct rc_instruction * rc_match_endloop(struct rc_instruction * endloop);
83 struct rc_instruction * rc_match_bgnloop(struct rc_instruction * bgnloop);
84
85 unsigned int rc_make_conversion_swizzle(
86 unsigned int old_mask,
87 unsigned int new_mask);
88
89 unsigned int rc_src_reg_is_immediate(
90 struct radeon_compiler * c,
91 unsigned int file,
92 unsigned int index);
93
94 float rc_get_constant_value(
95 struct radeon_compiler * c,
96 unsigned int index,
97 unsigned int swizzle,
98 unsigned int negate,
99 unsigned int chan);
100
101 unsigned int rc_get_scalar_src_swz(unsigned int swizzle);
102
103 #endif /* RADEON_PROGRAM_UTIL_H */