[Mesa-dev] [PATCH 1/5] r300g/compiler: Add an option to specify a FILE* when printing a program
Tom Stellard
tom at stellard.net
Sun Jan 5 18:51:17 PST 2014
From: Tom Stellard <thomas.stellard at amd.com>
---
src/gallium/drivers/r300/compiler/radeon_program.h | 2 ++
src/gallium/drivers/r300/compiler/radeon_program_print.c | 13 +++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/r300/compiler/radeon_program.h b/src/gallium/drivers/r300/compiler/radeon_program.h
index 67be1b9..0bcf5d6 100644
--- a/src/gallium/drivers/r300/compiler/radeon_program.h
+++ b/src/gallium/drivers/r300/compiler/radeon_program.h
@@ -29,6 +29,7 @@
#define __RADEON_PROGRAM_H_
#include <stdint.h>
+#include <stdio.h>
#include <string.h>
#include "radeon_opcodes.h"
@@ -208,6 +209,7 @@ void rc_remove_instruction(struct rc_instruction * inst);
unsigned int rc_recompute_ips(struct radeon_compiler * c);
void rc_print_program(const struct rc_program *prog);
+void rc_print_program_file(const struct rc_program *prog, FILE *file);
rc_swizzle rc_mask_to_swizzle(unsigned int mask);
#endif
diff --git a/src/gallium/drivers/r300/compiler/radeon_program_print.c b/src/gallium/drivers/r300/compiler/radeon_program_print.c
index 29a349e..8b4c2b0 100644
--- a/src/gallium/drivers/r300/compiler/radeon_program_print.c
+++ b/src/gallium/drivers/r300/compiler/radeon_program_print.c
@@ -465,19 +465,24 @@ static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst
*/
void rc_print_program(const struct rc_program *prog)
{
+ rc_print_program_file(prog, stderr);
+}
+
+void rc_print_program_file(const struct rc_program *prog, FILE *file)
+{
unsigned int linenum = 0;
unsigned branch_depth = 0;
struct rc_instruction *inst;
- fprintf(stderr, "# Radeon Compiler Program\n");
+ fprintf(file, "# Radeon Compiler Program\n");
for(inst = prog->Instructions.Next; inst != &prog->Instructions; inst = inst->Next) {
- fprintf(stderr, "%3d: ", linenum);
+ fprintf(file, "%3d: ", linenum);
if (inst->Type == RC_INSTRUCTION_PAIR)
- rc_print_pair_instruction(stderr, inst, &branch_depth);
+ rc_print_pair_instruction(file, inst, &branch_depth);
else
- rc_print_normal_instruction(stderr, inst, &branch_depth);
+ rc_print_normal_instruction(file, inst, &branch_depth);
linenum++;
}
--
1.8.1.5
More information about the mesa-dev
mailing list