i965: Move assembly annotation functions to intel_asm_annotation.c.
authorMatt Turner <mattst88@gmail.com>
Mon, 30 Jun 2014 01:11:29 +0000 (18:11 -0700)
committerMatt Turner <mattst88@gmail.com>
Sun, 6 Jul 2014 05:42:30 +0000 (22:42 -0700)
It's C. Compile it as such.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/intel_asm_annotation.c
src/mesa/drivers/dri/i965/intel_asm_annotation.h

index d7e127b965940f5a2fb44579f07bed55174045cf..318802b79e87ecd629548abfd51b79857e8f53d5 100644 (file)
@@ -822,58 +822,3 @@ backend_visitor::assign_common_binding_table_offsets(uint32_t next_binding_table
 
    /* prog_data->base.binding_table.size will be set by brw_mark_surface_used. */
 }
-
-void annotate(struct brw_context *brw,
-              struct annotation_info *annotation, cfg_t *cfg,
-              backend_instruction *inst, unsigned offset)
-{
-   if (annotation->ann_size <= annotation->ann_count) {
-      annotation->ann_size = MAX2(1024, annotation->ann_size * 2);
-      annotation->ann = reralloc(annotation->mem_ctx, annotation->ann,
-                                 struct annotation, annotation->ann_size);
-      if (!annotation->ann)
-         return;
-   }
-
-   struct annotation *ann = &annotation->ann[annotation->ann_count++];
-   ann->offset = offset;
-   if ((INTEL_DEBUG & DEBUG_NO_ANNOTATION) == 0) {
-      ann->ir = inst->ir;
-      ann->annotation = inst->annotation;
-   }
-
-   if (cfg->blocks[annotation->cur_block]->start == inst) {
-      ann->block_start = cfg->blocks[annotation->cur_block];
-   }
-
-   /* There is no hardware DO instruction on Gen6+, so since DO always
-    * starts a basic block, we need to set the .block_start of the next
-    * instruction's annotation with a pointer to the bblock started by
-    * the DO.
-    *
-    * There's also only complication from emitting an annotation without
-    * a corresponding hardware instruction to disassemble.
-    */
-   if (brw->gen >= 6 && inst->opcode == BRW_OPCODE_DO) {
-      annotation->ann_count--;
-   }
-
-   if (cfg->blocks[annotation->cur_block]->end == inst) {
-      ann->block_end = cfg->blocks[annotation->cur_block];
-      annotation->cur_block++;
-   }
-}
-
-void
-annotation_finalize(struct annotation_info *annotation,
-                    unsigned next_inst_offset)
-{
-   if (!annotation->ann_count)
-      return;
-
-   if (annotation->ann_count == annotation->ann_size) {
-      annotation->ann = reralloc(annotation->mem_ctx, annotation->ann,
-                                 struct annotation, annotation->ann_size + 1);
-   }
-   annotation->ann[annotation->ann_count].offset = next_inst_offset;
-}
index a9224878a4daa85b2d8a447399188f9f9d30c2c5..cfaea9e5b80b6358e0d169335411a3121e997308 100644 (file)
@@ -26,7 +26,6 @@
 #include "brw_defines.h"
 #include "main/compiler.h"
 #include "glsl/ir.h"
-#include "intel_asm_annotation.h"
 
 #pragma once
 
@@ -173,11 +172,6 @@ public:
 
 uint32_t brw_texture_offset(struct gl_context *ctx, ir_constant *offset);
 
-void annotate(struct brw_context *brw,
-              struct annotation_info *annotation, cfg_t *cfg,
-              backend_instruction *inst, unsigned offset);
-void annotation_finalize(struct annotation_info *annotation, unsigned offset);
-
 #endif /* __cplusplus */
 
 enum brw_reg_type brw_type_for_base_type(const struct glsl_type *type);
index a7bb2e170d08166d787d8c62cca7c04208fbaafa..4717bafd341c8bd45c8484bed64c23bd34493c46 100644 (file)
 
 #include "brw_cfg.h"
 #include "brw_eu.h"
+#include "brw_context.h"
+#include "intel_debug.h"
 #include "intel_asm_annotation.h"
 #include "program/prog_print.h"
 #include "program/prog_instruction.h"
+#include "main/macros.h"
 
 void
 dump_assembly(void *assembly, int num_annotations, struct annotation *annotation,
@@ -87,3 +90,58 @@ dump_assembly(void *assembly, int num_annotations, struct annotation *annotation
    }
    fprintf(stderr, "\n");
 }
+
+void annotate(struct brw_context *brw,
+              struct annotation_info *annotation, struct cfg_t *cfg,
+              struct backend_instruction *inst, unsigned offset)
+{
+   if (annotation->ann_size <= annotation->ann_count) {
+      annotation->ann_size = MAX2(1024, annotation->ann_size * 2);
+      annotation->ann = reralloc(annotation->mem_ctx, annotation->ann,
+                                 struct annotation, annotation->ann_size);
+      if (!annotation->ann)
+         return;
+   }
+
+   struct annotation *ann = &annotation->ann[annotation->ann_count++];
+   ann->offset = offset;
+   if ((INTEL_DEBUG & DEBUG_NO_ANNOTATION) == 0) {
+      ann->ir = inst->ir;
+      ann->annotation = inst->annotation;
+   }
+
+   if (cfg->blocks[annotation->cur_block]->start == inst) {
+      ann->block_start = cfg->blocks[annotation->cur_block];
+   }
+
+   /* There is no hardware DO instruction on Gen6+, so since DO always
+    * starts a basic block, we need to set the .block_start of the next
+    * instruction's annotation with a pointer to the bblock started by
+    * the DO.
+    *
+    * There's also only complication from emitting an annotation without
+    * a corresponding hardware instruction to disassemble.
+    */
+   if (brw->gen >= 6 && inst->opcode == BRW_OPCODE_DO) {
+      annotation->ann_count--;
+   }
+
+   if (cfg->blocks[annotation->cur_block]->end == inst) {
+      ann->block_end = cfg->blocks[annotation->cur_block];
+      annotation->cur_block++;
+   }
+}
+
+void
+annotation_finalize(struct annotation_info *annotation,
+                    unsigned next_inst_offset)
+{
+   if (!annotation->ann_count)
+      return;
+
+   if (annotation->ann_count == annotation->ann_size) {
+      annotation->ann = reralloc(annotation->mem_ctx, annotation->ann,
+                                 struct annotation, annotation->ann_size + 1);
+   }
+   annotation->ann[annotation->ann_count].offset = next_inst_offset;
+}
index 50ed21a3f7b385b325d42a9ebab50efc53fa5f1a..79f337211b10f884effc6ee6396a0b40c191d3d2 100644 (file)
@@ -31,6 +31,8 @@ extern "C" {
 struct bblock_t;
 struct brw_context;
 struct gl_program;
+struct backend_instruction;
+struct cfg_t;
 
 struct annotation {
    int offset;
@@ -60,6 +62,13 @@ void
 dump_assembly(void *assembly, int num_annotations, struct annotation *annotation,
               struct brw_context *brw, const struct gl_program *prog);
 
+void
+annotate(struct brw_context *brw,
+         struct annotation_info *annotation, struct cfg_t *cfg,
+         struct backend_instruction *inst, unsigned offset);
+void
+annotation_finalize(struct annotation_info *annotation, unsigned offset);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif