summaryrefslogtreecommitdiff
path: root/assembler/disasm-main.c
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-01-19 00:30:18 +0000
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:37 +0000
commit4ca1a04b859ed039a41d46891a3019d953ab1dc2 (patch)
tree4013ae130469b58d203d7abd4c082c137b0217e0 /assembler/disasm-main.c
parent66fdc85d5bdab9d38d3d5fe255ec6481829ae2d9 (diff)
assembler: Update the disassembler code
From Mesa. This imports a bit more the of brw_eu* infrastructure (which is going towards the right direction!) from mesa and the update is quite a significant improvement over what we had. I also verified that the changes that were done on the assembler old version of brw_disasm.c were already supported by the Mesa version, and indeed they were. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler/disasm-main.c')
-rw-r--r--assembler/disasm-main.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/assembler/disasm-main.c b/assembler/disasm-main.c
index 5cc1e7d1..b900e91d 100644
--- a/assembler/disasm-main.c
+++ b/assembler/disasm-main.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include "gen4asm.h"
+#include "brw_eu.h"
static const struct option longopts[] = {
{ NULL, 0, NULL, 0 }
@@ -95,7 +96,10 @@ read_program_binary (FILE *input)
static void usage(void)
{
- fprintf(stderr, "usage: intel-gen4disasm [-o outputfile] [-b] inputfile\n");
+ fprintf(stderr, "usage: intel-gen4disasm [options] inputfile\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|7> Specify GPU generation\n");
}
int main(int argc, char **argv)
@@ -107,9 +111,10 @@ int main(int argc, char **argv)
char *output_file = NULL;
int byte_array_input = 0;
int o;
+ int gen = 4;
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 +123,15 @@ int main(int argc, char **argv)
case 'b':
byte_array_input = 1;
break;
+ case 'g':
+ gen = strtol(optarg, NULL, 10);
+
+ if (gen < 4 || gen > 7) {
+ usage();
+ exit(1);
+ }
+
+ break;
default:
usage();
exit(1);
@@ -153,6 +167,6 @@ int main(int argc, char **argv)
}
for (inst = program->first; inst; inst = inst->next)
- disasm (output, &inst->instruction);
+ brw_disasm (output, &inst->instruction, gen);
exit (0);
}