int dead_mask; /**< Used in dead code elimination */
class function_entry *function; /* Set on TGSI_OPCODE_CAL or TGSI_OPCODE_BGNSUB */
+ const struct tgsi_opcode_info *info;
};
class variable_storage : public exec_node {
return size_swizzles[size - 1];
}
-static bool
-is_tex_instruction(unsigned opcode)
-{
- const tgsi_opcode_info* info = tgsi_get_opcode_info(opcode);
- return info->is_tex;
-}
-
static unsigned
-num_inst_dst_regs(unsigned opcode)
+num_inst_dst_regs(const glsl_to_tgsi_instruction *op)
{
- const tgsi_opcode_info* info = tgsi_get_opcode_info(opcode);
- return info->num_dst;
+ return op->info->num_dst;
}
static unsigned
-num_inst_src_regs(unsigned opcode)
+num_inst_src_regs(const glsl_to_tgsi_instruction *op)
{
- const tgsi_opcode_info* info = tgsi_get_opcode_info(opcode);
- return info->is_tex ? info->num_src - 1 : info->num_src;
+ return op->info->is_tex ? op->info->num_src - 1 : op->info->num_src;
}
glsl_to_tgsi_instruction *
assert(num_reladdr == 0);
inst->op = op;
+ inst->info = tgsi_get_opcode_info(op);
inst->dst[0] = dst;
inst->dst[1] = dst1;
inst->src[0] = src0;
v->samplers_used = 0;
foreach_in_list(glsl_to_tgsi_instruction, inst, &v->instructions) {
- if (is_tex_instruction(inst->op)) {
+ if (inst->info->is_tex) {
for (int i = 0; i < inst->sampler_array_size; i++) {
unsigned idx = inst->sampler.index + i;
v->samplers_used |= 1 << idx;
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
unsigned j;
- for (j = 0; j < num_inst_src_regs(inst->op); j++) {
+ for (j = 0; j < num_inst_src_regs(inst); j++) {
if (inst->src[j].file == PROGRAM_TEMPORARY &&
inst->src[j].index == index) {
inst->src[j].index = new_index;
}
}
- for (j = 0; j < num_inst_dst_regs(inst->op); j++) {
+ for (j = 0; j < num_inst_dst_regs(inst); j++) {
if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == index) {
inst->dst[j].index = new_index;
}
unsigned i = 0, j;
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
- for (j = 0; j < num_inst_src_regs(inst->op); j++) {
+ for (j = 0; j < num_inst_src_regs(inst); j++) {
if (inst->src[j].file == PROGRAM_TEMPORARY &&
inst->src[j].index == index) {
return (depth == 0) ? i : loop_start;
unsigned j;
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
- for (j = 0; j < num_inst_dst_regs(inst->op); j++) {
+ for (j = 0; j < num_inst_dst_regs(inst); j++) {
if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == index) {
return (depth == 0) ? i : loop_start;
}
unsigned i = 0, j;
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
- for (j = 0; j < num_inst_src_regs(inst->op); j++) {
+ for (j = 0; j < num_inst_src_regs(inst); j++) {
if (inst->src[j].file == PROGRAM_TEMPORARY &&
inst->src[j].index == index) {
last = (depth == 0) ? i : -2;
unsigned j;
foreach_in_list(glsl_to_tgsi_instruction, inst, &this->instructions) {
- for (j = 0; j < num_inst_dst_regs(inst->op); j++) {
+ for (j = 0; j < num_inst_dst_regs(inst); j++) {
if (inst->dst[j].file == PROGRAM_TEMPORARY && inst->dst[j].index == index)
last = (depth == 0) ? i : -2;
}
foreach_in_list_safe(glsl_to_tgsi_instruction, inst, &this->instructions) {
glsl_to_tgsi_instruction *inst2;
bool merged;
- if (num_inst_dst_regs(inst->op) != 2)
+ if (num_inst_dst_regs(inst) != 2)
continue;
if (inst->dst[0].file != PROGRAM_UNDEFINED &&
unsigned num_src;
unsigned tex_target;
- num_dst = num_inst_dst_regs(inst->op);
- num_src = num_inst_src_regs(inst->op);
+ num_dst = num_inst_dst_regs(inst);
+ num_src = num_inst_src_regs(inst);
for (i = 0; i < num_dst; i++)
dst[i] = translate_dst(t,