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
;
36 struct rc_src_register
;
37 struct rc_pair_instruction_arg
;
41 * Help analyze and modify the register accesses of instructions.
44 typedef void (*rc_read_write_chan_fn
)(void * userdata
, struct rc_instruction
* inst
,
45 rc_register_file file
, unsigned int index
, unsigned int chan
);
46 void rc_for_all_reads_chan(struct rc_instruction
* inst
, rc_read_write_chan_fn cb
, void * userdata
);
47 void rc_for_all_writes_chan(struct rc_instruction
* inst
, rc_read_write_chan_fn cb
, void * userdata
);
49 typedef void (*rc_read_write_mask_fn
)(void * userdata
, struct rc_instruction
* inst
,
50 rc_register_file file
, unsigned int index
, unsigned int mask
);
51 void rc_for_all_reads_mask(struct rc_instruction
* inst
, rc_read_write_mask_fn cb
, void * userdata
);
52 void rc_for_all_writes_mask(struct rc_instruction
* inst
, rc_read_write_mask_fn cb
, void * userdata
);
54 typedef void (*rc_read_src_fn
)(void * userdata
, struct rc_instruction
* inst
,
55 struct rc_src_register
* src
);
56 void rc_for_all_reads_src(struct rc_instruction
* inst
, rc_read_src_fn cb
,
59 typedef void (*rc_pair_read_arg_fn
)(void * userdata
,
60 struct rc_instruction
* inst
, struct rc_pair_instruction_arg
* arg
);
61 void rc_pair_for_all_reads_arg(struct rc_instruction
* inst
,
62 rc_pair_read_arg_fn cb
, void * userdata
);
64 typedef void (*rc_remap_register_fn
)(void * userdata
, struct rc_instruction
* inst
,
65 rc_register_file
* pfile
, unsigned int * pindex
);
66 void rc_remap_registers(struct rc_instruction
* inst
, rc_remap_register_fn cb
, void * userdata
);
71 * Compiler passes based on dataflow analysis.
74 typedef void (*rc_dataflow_mark_outputs_fn
)(void * userdata
, void * data
,
75 void (*mark_fn
)(void * data
, unsigned int index
, unsigned int mask
));
76 void rc_dataflow_deadcode(struct radeon_compiler
* c
, void *user
);
77 void rc_dataflow_swizzles(struct radeon_compiler
* c
, void *user
);
80 void rc_optimize(struct radeon_compiler
* c
, void *user
);
82 #endif /* RADEON_DATAFLOW_H */