#include "glsl/ir.h"
enum register_file {
- ARF = BRW_ARCHITECTURE_REGISTER_FILE,
- GRF = BRW_GENERAL_REGISTER_FILE,
- MRF = BRW_MESSAGE_REGISTER_FILE,
- IMM = BRW_IMMEDIATE_VALUE,
+ BAD_FILE,
+ ARF,
+ GRF,
+ MRF,
+ IMM,
FIXED_HW_REG, /* a struct brw_reg */
UNIFORM, /* prog_data->params[reg] */
- BAD_FILE
};
class fs_reg {
struct brw_reg fixed_hw_reg;
int smear; /* -1, or a channel of the reg to smear to all channels. */
- /** Value for file == BRW_IMMMEDIATE_FILE */
+ /** Value for file == IMM */
union {
int32_t i;
uint32_t u;
}
}
+static uint32_t brw_file_from_reg(fs_reg *reg)
+{
+ switch (reg->file) {
+ case ARF:
+ return BRW_ARCHITECTURE_REGISTER_FILE;
+ case GRF:
+ return BRW_GENERAL_REGISTER_FILE;
+ case MRF:
+ return BRW_MESSAGE_REGISTER_FILE;
+ case IMM:
+ return BRW_IMMEDIATE_VALUE;
+ default:
+ assert(!"not reached");
+ return BRW_GENERAL_REGISTER_FILE;
+ }
+}
+
static struct brw_reg
brw_reg_from_fs_reg(fs_reg *reg)
{
case ARF:
case MRF:
if (reg->smear == -1) {
- brw_reg = brw_vec8_reg(reg->file, reg->reg, 0);
+ brw_reg = brw_vec8_reg(brw_file_from_reg(reg), reg->reg, 0);
} else {
- brw_reg = brw_vec1_reg(reg->file, reg->reg, reg->smear);
+ brw_reg = brw_vec1_reg(brw_file_from_reg(reg), reg->reg, reg->smear);
}
brw_reg = retype(brw_reg, reg->type);
if (reg->sechalf)