namespace aco {
-static void aco_log(Program *program, const char *prefix,
- const char *file, unsigned line,
+static void aco_log(Program *program, enum radv_compiler_debug_level level,
+ const char *prefix, const char *file, unsigned line,
const char *fmt, va_list args)
{
char *msg;
ralloc_asprintf_append(&msg, " ");
ralloc_vasprintf_append(&msg, fmt, args);
- /* TODO: log messages via callback if available too. */
+ if (program->debug.func)
+ program->debug.func(program->debug.private_data, level, msg);
fprintf(stderr, "%s\n", msg);
va_list args;
va_start(args, fmt);
- aco_log(program, "ACO PERFWARN:\n", file, line, fmt, args);
+ aco_log(program, RADV_COMPILER_DEBUG_LEVEL_PERFWARN,
+ "ACO PERFWARN:\n", file, line, fmt, args);
va_end(args);
}
va_list args;
va_start(args, fmt);
- aco_log(program, "ACO ERROR:\n", file, line, fmt, args);
+ aco_log(program, RADV_COMPILER_DEBUG_LEVEL_ERROR,
+ "ACO ERROR:\n", file, line, fmt, args);
va_end(args);
}
}
case Format::SMEM: {
if (instr->operands.size() >= 1)
- check(instr->operands[0].isTemp() && instr->operands[0].regClass().type() == RegType::sgpr, "SMEM operands must be sgpr", instr.get());
+ check((instr->operands[0].isFixed() && !instr->operands[0].isConstant()) ||
+ (instr->operands[0].isTemp() && instr->operands[0].regClass().type() == RegType::sgpr), "SMEM operands must be sgpr", instr.get());
if (instr->operands.size() >= 2)
check(instr->operands[1].isConstant() || (instr->operands[1].isTemp() && instr->operands[1].regClass().type() == RegType::sgpr),
"SMEM offset must be constant or sgpr", instr.get());
aco_print_instr(loc2.instr, memf);
}
fprintf(memf, "\n\n");
+ fclose(memf);
aco_err(program, out);
free(out);