#include "ir.h"
#include "ir_visitor.h"
-extern void _mesa_print_ir(exec_list *instructions,
- struct _mesa_glsl_parse_state *state);
+extern "C" {
+#include "program/symbol_table.h"
+}
/**
* Abstract base class of visitors of IR instruction trees
*/
class ir_print_visitor : public ir_visitor {
public:
- ir_print_visitor()
- : deref_depth(0)
- {
- /* empty */
- }
+ ir_print_visitor(FILE *f);
+ virtual ~ir_print_visitor();
- virtual ~ir_print_visitor()
- {
- /* empty */
- }
+ void indent(void);
/**
* \name Visit methods
* the hierarchy should not have \c visit methods.
*/
/*@{*/
+ virtual void visit(ir_rvalue *);
virtual void visit(ir_variable *);
virtual void visit(ir_function_signature *);
virtual void visit(ir_function *);
virtual void visit(ir_if *);
virtual void visit(ir_loop *);
virtual void visit(ir_loop_jump *);
+ virtual void visit(ir_emit_vertex *);
+ virtual void visit(ir_end_primitive *);
+ virtual void visit(ir_barrier *);
/*@}*/
private:
- int deref_depth;
+ /**
+ * Fetch/generate a unique name for ir_variable.
+ *
+ * GLSL IR permits multiple ir_variables to share the same name. This works
+ * fine until we try to print it, when we really need a unique one.
+ */
+ const char *unique_name(ir_variable *var);
+
+ /** A mapping from ir_variable * -> unique printable names. */
+ hash_table *printable_names;
+ _mesa_symbol_table *symbols;
+
+ void *mem_ctx;
+ FILE *f;
+
+ int indentation;
};
#endif /* IR_PRINT_VISITOR_H */