diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-11-12 16:45:32 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-11-12 16:45:32 +0000 |
commit | c46ec85da270994b50ccc5c8de0f1751cf3a0683 (patch) | |
tree | a5941765ceb8c03216c7a82f0a9f92c02b368a39 /sim/mn10200/gencode.c | |
parent | 4fab48b9c48377889af365990e148954c3343287 (diff) | |
download | gdb-c46ec85da270994b50ccc5c8de0f1751cf3a0683.zip gdb-c46ec85da270994b50ccc5c8de0f1751cf3a0683.tar.gz gdb-c46ec85da270994b50ccc5c8de0f1751cf3a0683.tar.bz2 |
2004-11-12 Andrew Cagney <cagney@gnu.org>
* d30v, fr30, mn10200, z8k: Delete directory.
Diffstat (limited to 'sim/mn10200/gencode.c')
-rw-r--r-- | sim/mn10200/gencode.c | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/sim/mn10200/gencode.c b/sim/mn10200/gencode.c deleted file mode 100644 index 8ba873e..0000000 --- a/sim/mn10200/gencode.c +++ /dev/null @@ -1,154 +0,0 @@ -#include "mn10200_sim.h" - -static void write_header PARAMS ((void)); -static void write_opcodes PARAMS ((void)); -static void write_template PARAMS ((void)); - -int -main (argc, argv) - int argc; - char *argv[]; -{ - if ((argc > 1) && (strcmp (argv[1], "-h") == 0)) - write_header(); - else if ((argc > 1) && (strcmp (argv[1], "-t") == 0)) - write_template (); - else - write_opcodes(); - return 0; -} - - -static void -write_header () -{ - struct mn10200_opcode *opcode; - - for (opcode = (struct mn10200_opcode *)mn10200_opcodes; opcode->name; opcode++) - printf("void OP_%X PARAMS ((unsigned long, unsigned long));\t\t/* %s */\n", - opcode->opcode, opcode->name); -} - - -/* write_template creates a file all required functions, ready */ -/* to be filled out */ - -static void -write_template () -{ - struct mn10200_opcode *opcode; - int i,j; - - printf ("#include \"mn10200_sim.h\"\n"); - printf ("#include \"simops.h\"\n"); - - for (opcode = (struct mn10200_opcode *)mn10200_opcodes; opcode->name; opcode++) - { - printf("/* %s */\nvoid\nOP_%X (insn, extension)\n unsigned long insn, extension;\n{\n", opcode->name, opcode->opcode); - - /* count operands */ - j = 0; - for (i = 0; i < 6; i++) - { - int flags = mn10200_operands[opcode->operands[i]].flags; - - if (flags) - j++; - } - switch (j) - { - case 0: - printf ("printf(\" %s\\n\");\n", opcode->name); - break; - case 1: - printf ("printf(\" %s\\t%%x\\n\", OP[0]);\n", opcode->name); - break; - case 2: - printf ("printf(\" %s\\t%%x,%%x\\n\",OP[0],OP[1]);\n", - opcode->name); - break; - case 3: - printf ("printf(\" %s\\t%%x,%%x,%%x\\n\",OP[0],OP[1],OP[2]);\n", - opcode->name); - break; - default: - fprintf (stderr,"Too many operands: %d\n", j); - } - printf ("}\n\n"); - } -} - -static void -write_opcodes () -{ - struct mn10200_opcode *opcode; - int i, j; - int numops; - - /* write out opcode table */ - printf ("#include \"mn10200_sim.h\"\n"); - printf ("#include \"simops.h\"\n\n"); - printf ("struct simops Simops[] = {\n"); - - for (opcode = (struct mn10200_opcode *)mn10200_opcodes; opcode->name; opcode++) - { - int size; - - if (opcode->format == FMT_1) - size = 1; - else if (opcode->format == FMT_2 || opcode->format == FMT_4) - size = 2; - else if (opcode->format == FMT_3 || opcode->format == FMT_5) - size = 3; - else if (opcode->format == FMT_6) - size = 4; - else if (opcode->format == FMT_7) - size = 5; - else - abort (); - - printf (" { 0x%x,0x%x,OP_%X,%d,%d,", - opcode->opcode, opcode->mask, opcode->opcode, - size, opcode->format); - - /* count operands */ - j = 0; - for (i = 0; i < 6; i++) - { - int flags = mn10200_operands[opcode->operands[i]].flags; - - if (flags) - j++; - } - printf ("%d,{",j); - - j = 0; - numops = 0; - for (i = 0; i < 6; i++) - { - int flags = mn10200_operands[opcode->operands[i]].flags; - int shift = mn10200_operands[opcode->operands[i]].shift; - - if (flags) - { - if (j) - printf (", "); - printf ("%d,%d,%d", shift, - mn10200_operands[opcode->operands[i]].bits,flags); - j = 1; - numops++; - } - } - - switch (numops) - { - case 0: - printf ("0,0,0"); - case 1: - printf (",0,0,0"); - } - - printf ("}},\n"); - } - printf ("{ 0,0,NULL,0,0,0,{0,0,0,0,0,0}},\n};\n"); -} |