[Mesa-dev] [PATCH 10/18] intel/tools/disasm: add gen_disasm_assembly_length function

kevin.rogovin at intel.com kevin.rogovin at intel.com
Mon Nov 13 13:17:58 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 27f99e21f9..6109727d56 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 8d82a58617..8b95a710e2 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.14.2



More information about the mesa-dev mailing list