ra_ctx(Program* program) : program(program) {}
};
+class RegisterFile {
+public:
+ RegisterFile() {regs.fill(0);}
+
+ std::array<uint32_t, 512> regs;
+
+ const uint32_t& operator [] (unsigned index) const {
+ return regs[index];
+ }
+
+ uint32_t& operator [] (unsigned index) {
+ return regs[index];
+ }
+};
+
/* helper function for debugging */
#if 0
-void print_regs(ra_ctx& ctx, bool vgprs, std::array<uint32_t, 512>& reg_file)
+void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& reg_file)
{
unsigned max = vgprs ? ctx.program->max_reg_demand.vgpr : ctx.program->max_reg_demand.sgpr;
unsigned lb = vgprs ? 256 : 0;
}
-void update_renames(ra_ctx& ctx, std::array<uint32_t, 512>& reg_file,
+void update_renames(ra_ctx& ctx, RegisterFile& reg_file,
std::vector<std::pair<Operand, Definition>>& parallelcopies,
aco_ptr<Instruction>& instr)
{
}
std::pair<PhysReg, bool> get_reg_simple(ra_ctx& ctx,
- std::array<uint32_t, 512>& reg_file,
+ RegisterFile& reg_file,
uint32_t lb, uint32_t ub,
uint32_t size, uint32_t stride,
RegClass rc)
}
bool get_regs_for_copies(ra_ctx& ctx,
- std::array<uint32_t, 512>& reg_file,
+ RegisterFile& reg_file,
std::vector<std::pair<Operand, Definition>>& parallelcopies,
std::set<std::pair<unsigned, unsigned>> vars,
uint32_t lb, uint32_t ub,
std::pair<PhysReg, bool> get_reg_impl(ra_ctx& ctx,
- std::array<uint32_t, 512>& reg_file,
+ RegisterFile& reg_file,
std::vector<std::pair<Operand, Definition>>& parallelcopies,
uint32_t lb, uint32_t ub,
uint32_t size, uint32_t stride,
return {{}, false};
}
- std::array<uint32_t, 512> register_file = reg_file;
+ RegisterFile register_file = reg_file;
/* now, we figured the placement for our definition */
std::set<std::pair<unsigned, unsigned>> vars;
}
PhysReg get_reg(ra_ctx& ctx,
- std::array<uint32_t, 512>& reg_file,
+ RegisterFile& reg_file,
RegClass rc,
std::vector<std::pair<Operand, Definition>>& parallelcopies,
aco_ptr<Instruction>& instr)
std::pair<PhysReg, bool> get_reg_vec(ra_ctx& ctx,
- std::array<uint32_t, 512>& reg_file,
+ RegisterFile& reg_file,
RegClass rc)
{
uint32_t size = rc.size();
PhysReg get_reg_create_vector(ra_ctx& ctx,
- std::array<uint32_t, 512>& reg_file,
+ RegisterFile& reg_file,
RegClass rc,
std::vector<std::pair<Operand, Definition>>& parallelcopies,
aco_ptr<Instruction>& instr)
}
bool get_reg_specified(ra_ctx& ctx,
- std::array<uint32_t, 512>& reg_file,
+ RegisterFile& reg_file,
RegClass rc,
std::vector<std::pair<Operand, Definition>>& parallelcopies,
aco_ptr<Instruction>& instr,
}
void handle_pseudo(ra_ctx& ctx,
- const std::array<uint32_t, 512>& reg_file,
+ const RegisterFile& reg_file,
Instruction* instr)
{
if (instr->format != Format::PSEUDO)
std::set<Temp>& live = live_out_per_block[block.index];
/* initialize register file */
assert(block.index != 0 || live.empty());
- std::array<uint32_t, 512> register_file = {0};
+ RegisterFile register_file;
ctx.war_hint.reset();
for (Temp t : live) {