[aco::statistic_vgpr_presched] = {"Pre-Sched VGPRs", "VGPR usage before scheduling"},
};
+static void validate(aco::Program *program)
+{
+ if (!(aco::debug_flags & aco::DEBUG_VALIDATE))
+ return;
+
+ bool is_valid = aco::validate(program, stderr);
+ assert(is_valid);
+}
+
void aco_compile_shader(unsigned shader_count,
struct nir_shader *const *shaders,
struct radv_shader_binary **binary,
/* Phi lowering */
aco::lower_phis(program.get());
aco::dominator_tree(program.get());
- aco::validate(program.get(), stderr);
+ validate(program.get());
/* Optimization */
aco::value_numbering(program.get());
/* cleanup and exec mask handling */
aco::setup_reduce_temp(program.get());
aco::insert_exec_mask(program.get());
- aco::validate(program.get(), stderr);
+ validate(program.get());
/* spilling and scheduling */
aco::live live_vars = aco::live_var_analysis(program.get(), args->options);
if (program->collect_statistics)
aco::collect_presched_stats(program.get());
aco::schedule_program(program.get(), live_vars);
- aco::validate(program.get(), stderr);
+ validate(program.get());
std::string llvm_ir;
if (args->options->record_ir) {
abort();
}
- aco::validate(program.get(), stderr);
+ validate(program.get());
/* Lower to HW Instructions */
aco::ssa_elimination(program.get());
unsigned emit_program(Program* program, std::vector<uint32_t>& code);
void print_asm(Program *program, std::vector<uint32_t>& binary,
unsigned exec_size, std::ostream& out);
-void validate(Program* program, FILE *output);
+bool validate(Program* program, FILE *output);
bool validate_ra(Program* program, const struct radv_nir_compiler_options *options, FILE *output);
#ifndef NDEBUG
void perfwarn(bool cond, const char *msg, Instruction *instr=NULL);
}
#endif
-void validate(Program* program, FILE * output)
+bool validate(Program* program, FILE *output)
{
- if (!(debug_flags & DEBUG_VALIDATE))
- return;
-
bool is_valid = true;
auto check = [&output, &is_valid](bool check, const char * msg, aco::Instruction * instr) -> void {
if (!check) {
}
}
- assert(is_valid);
+ return is_valid;
}
/* RA validation */