2 * Copyright (C) 2009 Nicolai Haehnle.
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_DATAFLOW_H
29 #define RADEON_DATAFLOW_H
31 #include "radeon_program_constants.h"
33 struct radeon_compiler
;
34 struct rc_instruction
;
35 struct rc_swizzle_caps
;
39 * Help analyze and modify the register accesses of instructions.
42 typedef void (*rc_read_write_chan_fn
)(void * userdata
, struct rc_instruction
* inst
,
43 rc_register_file file
, unsigned int index
, unsigned int chan
);
44 void rc_for_all_reads_chan(struct rc_instruction
* inst
, rc_read_write_chan_fn cb
, void * userdata
);
45 void rc_for_all_writes_chan(struct rc_instruction
* inst
, rc_read_write_chan_fn cb
, void * userdata
);
47 typedef void (*rc_read_write_mask_fn
)(void * userdata
, struct rc_instruction
* inst
,
48 rc_register_file file
, unsigned int index
, unsigned int mask
);
49 void rc_for_all_reads_mask(struct rc_instruction
* inst
, rc_read_write_mask_fn cb
, void * userdata
);
50 void rc_for_all_writes_mask(struct rc_instruction
* inst
, rc_read_write_mask_fn cb
, void * userdata
);
52 typedef void (*rc_remap_register_fn
)(void * userdata
, struct rc_instruction
* inst
,
53 rc_register_file
* pfile
, unsigned int * pindex
);
54 void rc_remap_registers(struct rc_instruction
* inst
, rc_remap_register_fn cb
, void * userdata
);
59 * Compiler passes based on dataflow analysis.
62 typedef void (*rc_dataflow_mark_outputs_fn
)(void * userdata
, void * data
,
63 void (*mark_fn
)(void * data
, unsigned int index
, unsigned int mask
));
64 void rc_dataflow_deadcode(struct radeon_compiler
* c
, void *user
);
65 void rc_dataflow_swizzles(struct radeon_compiler
* c
, void *user
);
68 void rc_optimize(struct radeon_compiler
* c
, void *user
);
70 #endif /* RADEON_DATAFLOW_H */