Signed-off-by: Ben Widawsky <b...@bwidawsk.net>
---
 src/disasm-main.c |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/disasm-main.c b/src/disasm-main.c
index f41cd75..7b41c71 100644
--- a/src/disasm-main.c
+++ b/src/disasm-main.c
@@ -28,10 +28,24 @@
 
 #include "gen4asm.h"
 
+static long int gen_level = 5;
+
 static const struct option longopts[] = {
+       {"binary", no_argument, 0, 'b'},
+       {"output", required_argument, 0, 'o'},
+       {"gen", required_argument, 0, 'g'},
        { NULL, 0, NULL, 0 }
 };
 
+static void usage(void)
+{
+       fprintf(stderr, "usage: intel-gen4disasm [options] inputfile\n");
+       fprintf(stderr, "OPTIONS:\n");
+       fprintf(stderr, "\t-b, --binary                         C style binary 
output\n");
+       fprintf(stderr, "\t-o, --output {outputfile}            Specify output 
file\n");
+       fprintf(stderr, "\t-g, --gen <4|5|6>                    Specify GPU 
generation\n");
+}
+
 static struct brw_program *
 read_program (FILE *input)
 {
@@ -93,11 +107,6 @@ read_program_binary (FILE *input)
     return program;
 }
 
-static void usage(void)
-{
-    fprintf(stderr, "usage: intel-gen4disasm [-o outputfile] [-b] 
inputfile\n");
-}
-
 int main(int argc, char **argv)
 {
     struct brw_program *program;
@@ -109,7 +118,7 @@ int main(int argc, char **argv)
     int                        o;
     struct brw_program_instruction  *inst;
 
-    while ((o = getopt_long(argc, argv, "o:b", longopts, NULL)) != -1) {
+    while ((o = getopt_long(argc, argv, "o:bg:", longopts, NULL)) != -1) {
        switch (o) {
        case 'o':
            if (strcmp(optarg, "-") != 0)
@@ -118,6 +127,15 @@ int main(int argc, char **argv)
        case 'b':
            byte_array_input = 1;
            break;
+       case 'g':
+           gen_level = strtol(optarg, NULL, 0);
+
+           if (gen_level < 4 || gen_level > 6) {
+               usage();
+               exit(1);
+           }
+
+           break;
        default:
            usage();
            exit(1);
@@ -153,6 +171,6 @@ int main(int argc, char **argv)
     }
            
     for (inst = program->first; inst; inst = inst->next)
-       brw_disasm (output, &inst->instruction, 5);
+       brw_disasm (output, &inst->instruction, gen_level);
     exit (0);
 }
-- 
1.7.3.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to