Path: blob/21.2-virgl/src/gallium/drivers/r300/compiler/radeon_dataflow.h
4574 views
/*1* Copyright (C) 2009 Nicolai Haehnle.2* Copyright 2010 Tom Stellard <[email protected]>3*4* All Rights Reserved.5*6* Permission is hereby granted, free of charge, to any person obtaining7* a copy of this software and associated documentation files (the8* "Software"), to deal in the Software without restriction, including9* without limitation the rights to use, copy, modify, merge, publish,10* distribute, sublicense, and/or sell copies of the Software, and to11* permit persons to whom the Software is furnished to do so, subject to12* the following conditions:13*14* The above copyright notice and this permission notice (including the15* next paragraph) shall be included in all copies or substantial16* portions of the Software.17*18* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,19* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF20* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.21* IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE22* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION23* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION24* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.25*26*/2728#ifndef RADEON_DATAFLOW_H29#define RADEON_DATAFLOW_H3031#include "radeon_program_constants.h"3233struct radeon_compiler;34struct rc_instruction;35struct rc_swizzle_caps;36struct rc_src_register;37struct rc_pair_instruction_arg;38struct rc_pair_instruction_source;39struct rc_pair_sub_instruction;40struct rc_compiler;414243/**44* Help analyze and modify the register accesses of instructions.45*/46/*@{*/47typedef void (*rc_read_write_chan_fn)(void * userdata, struct rc_instruction * inst,48rc_register_file file, unsigned int index, unsigned int chan);49void rc_for_all_reads_chan(struct rc_instruction * inst, rc_read_write_chan_fn cb, void * userdata);50void rc_for_all_writes_chan(struct rc_instruction * inst, rc_read_write_chan_fn cb, void * userdata);5152typedef void (*rc_read_write_mask_fn)(void * userdata, struct rc_instruction * inst,53rc_register_file file, unsigned int index, unsigned int mask);54void rc_for_all_reads_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata);55void rc_for_all_writes_mask(struct rc_instruction * inst, rc_read_write_mask_fn cb, void * userdata);5657typedef void (*rc_read_src_fn)(void * userdata, struct rc_instruction * inst,58struct rc_src_register * src);59void rc_for_all_reads_src(struct rc_instruction * inst, rc_read_src_fn cb,60void * userdata);6162typedef void (*rc_pair_read_arg_fn)(void * userdata,63struct rc_instruction * inst, struct rc_pair_instruction_arg * arg,64struct rc_pair_instruction_source * src);65void rc_pair_for_all_reads_arg(struct rc_instruction * inst,66rc_pair_read_arg_fn cb, void * userdata);6768typedef void (*rc_remap_register_fn)(void * userdata, struct rc_instruction * inst,69rc_register_file * pfile, unsigned int * pindex);70void rc_remap_registers(struct rc_instruction * inst, rc_remap_register_fn cb, void * userdata);71/*@}*/7273struct rc_reader {74struct rc_instruction * Inst;75unsigned int WriteMask;76union {77struct {78struct rc_src_register * Src;79} I;80struct {81struct rc_pair_instruction_arg * Arg;82struct rc_pair_instruction_source * Src;83} P;84} U;85};8687struct rc_reader_data {88unsigned int Abort;89unsigned int AbortOnRead;90unsigned int AbortOnWrite;91unsigned int LoopDepth;92unsigned int InElse;93struct rc_instruction * Writer;9495unsigned int ReaderCount;96unsigned int ReadersReserved;97struct rc_reader * Readers;9899/* If this flag is enabled, rc_get_readers will exit as soon possbile100* after the Abort flag is set.*/101unsigned int ExitOnAbort;102void * CbData;103};104105void rc_get_readers(106struct radeon_compiler * c,107struct rc_instruction * writer,108struct rc_reader_data * data,109rc_read_src_fn read_normal_cb,110rc_pair_read_arg_fn read_pair_cb,111rc_read_write_mask_fn write_cb);112113void rc_get_readers_sub(114struct radeon_compiler * c,115struct rc_instruction * writer,116struct rc_pair_sub_instruction * sub_writer,117struct rc_reader_data * data,118rc_read_src_fn read_normal_cb,119rc_pair_read_arg_fn read_pair_cb,120rc_read_write_mask_fn write_cb);121/**122* Compiler passes based on dataflow analysis.123*/124/*@{*/125typedef void (*rc_dataflow_mark_outputs_fn)(void * userdata, void * data,126void (*mark_fn)(void * data, unsigned int index, unsigned int mask));127void rc_dataflow_deadcode(struct radeon_compiler * c, void *user);128void rc_dataflow_swizzles(struct radeon_compiler * c, void *user);129/*@}*/130131void rc_optimize(struct radeon_compiler * c, void *user);132void rc_inline_literals(struct radeon_compiler *c, void *user);133134#endif /* RADEON_DATAFLOW_H */135136137