[Mesa-dev] [PATCH 14/22] intel/tools/disasm: add gen_disasm_assembly_length function

kevin.rogovin at intel.com kevin.rogovin at intel.com
Mon Sep 25 10:34:14 UTC 2017


From: Kevin Rogovin <kevin.rogovin at intel.com>

The length function is needed if one wishes to save GEN binary
shaders to file.

Signed-off-by: Kevin Rogovin <kevin.rogovin at intel.com>
---
 src/intel/tools/disasm.c     | 7 +++++++
 src/intel/tools/gen_disasm.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/src/intel/tools/disasm.c b/src/intel/tools/disasm.c
index 27f99e2..6109727 100644
--- a/src/intel/tools/disasm.c
+++ b/src/intel/tools/disasm.c
@@ -106,6 +106,13 @@ gen_disasm_disassemble(struct gen_disasm *disasm, const void *assembly,
    ralloc_free(annotation_info.mem_ctx);
 }
 
+int
+gen_disasm_assembly_length(struct gen_disasm *disasm,
+                           const void *assembly, int start)
+{
+   return gen_disasm_find_end(disasm, assembly, start) - start;
+}
+
 struct gen_disasm *
 gen_disasm_create(int pciid)
 {
diff --git a/src/intel/tools/gen_disasm.h b/src/intel/tools/gen_disasm.h
index 8d82a58..8b95a71 100644
--- a/src/intel/tools/gen_disasm.h
+++ b/src/intel/tools/gen_disasm.h
@@ -33,6 +33,8 @@ struct gen_disasm;
 struct gen_disasm *gen_disasm_create(int pciid);
 void gen_disasm_disassemble(struct gen_disasm *disasm,
                             const void *assembly, int start, FILE *out);
+int gen_disasm_assembly_length(struct gen_disasm *disasm,
+                               const void *assembly, int start);
 
 void gen_disasm_destroy(struct gen_disasm *disasm);
 
-- 
2.7.4



More information about the mesa-dev mailing list