Browse Source
(tmp-gencode, gencode.o, gencode): Delete targets. (simops.h): New file. ($(BUILT_SRC_FROM_IGEN)): Do not depend on simops.h. * gencode.c: Delete file.binutils-2_12-branch
4 changed files with 88 additions and 164 deletions
@ -1,149 +0,0 @@ |
|||||
#include <stdio.h> |
|
||||
#include <ctype.h> |
|
||||
#include "ansidecl.h" |
|
||||
#include "opcode/v850.h" |
|
||||
#include <limits.h> |
|
||||
|
|
||||
static void write_header PARAMS ((void)); |
|
||||
static void write_opcodes PARAMS ((void)); |
|
||||
static void write_template PARAMS ((void)); |
|
||||
|
|
||||
long Opcodes[512]; |
|
||||
static int curop=0; |
|
||||
|
|
||||
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 v850_opcode *opcode; |
|
||||
|
|
||||
for (opcode = (struct v850_opcode *)v850_opcodes; opcode->name; opcode++) |
|
||||
printf("int OP_%X PARAMS ((void));\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 v850_opcode *opcode; |
|
||||
int i,j; |
|
||||
|
|
||||
printf ("#include \"sim-main.h\"\n"); |
|
||||
printf ("#include \"v850_sim.h\"\n"); |
|
||||
printf ("#include \"simops.h\"\n"); |
|
||||
|
|
||||
for (opcode = (struct v850_opcode *)v850_opcodes; opcode->name; opcode++) |
|
||||
{ |
|
||||
printf("/* %s */\nvoid\nOP_%X (void)\n{\n", opcode->name, opcode->opcode); |
|
||||
|
|
||||
/* count operands */ |
|
||||
j = 0; |
|
||||
for (i = 0; i < 6; i++) |
|
||||
{ |
|
||||
int flags = v850_operands[opcode->operands[i]].flags; |
|
||||
|
|
||||
if (flags & (V850_OPERAND_REG | V850_OPERAND_SRG | V850_OPERAND_CC)) |
|
||||
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 v850_opcode *opcode; |
|
||||
int i, j; |
|
||||
int numops; |
|
||||
|
|
||||
/* write out opcode table */ |
|
||||
printf ("#include \"sim-main.h\"\n"); |
|
||||
printf ("#include \"v850_sim.h\"\n"); |
|
||||
printf ("#include \"simops.h\"\n\n"); |
|
||||
printf ("struct simops Simops[] = {\n"); |
|
||||
|
|
||||
for (opcode = (struct v850_opcode *)v850_opcodes; opcode->name; opcode++) |
|
||||
{ |
|
||||
printf (" { 0x%x,0x%x,OP_%X,", |
|
||||
opcode->opcode, opcode->mask, opcode->opcode); |
|
||||
|
|
||||
Opcodes[curop++] = opcode->opcode; |
|
||||
|
|
||||
/* count operands */ |
|
||||
j = 0; |
|
||||
for (i = 0; i < 6; i++) |
|
||||
{ |
|
||||
int flags = v850_operands[opcode->operands[i]].flags; |
|
||||
|
|
||||
if (flags & (V850_OPERAND_REG | V850_OPERAND_SRG | V850_OPERAND_CC)) |
|
||||
j++; |
|
||||
} |
|
||||
printf ("%d,{",j); |
|
||||
|
|
||||
j = 0; |
|
||||
numops = 0; |
|
||||
for (i = 0; i < 6; i++) |
|
||||
{ |
|
||||
int flags = v850_operands[opcode->operands[i]].flags; |
|
||||
int shift = v850_operands[opcode->operands[i]].shift; |
|
||||
|
|
||||
if (flags & (V850_OPERAND_REG | V850_OPERAND_SRG | V850_OPERAND_CC)) |
|
||||
{ |
|
||||
if (j) |
|
||||
printf (", "); |
|
||||
printf ("%d,%d,%d", shift, |
|
||||
v850_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}},\n};\n"); |
|
||||
} |
|
||||
@ -0,0 +1,79 @@ |
|||||
|
#ifndef SIMOPS_H |
||||
|
#define SIMOPS_H |
||||
|
int OP_380 (void); |
||||
|
int OP_480 (void); |
||||
|
int OP_501 (void); |
||||
|
int OP_700 (void); |
||||
|
int OP_720 (void); |
||||
|
int OP_10720 (void); |
||||
|
int OP_740 (void); |
||||
|
int OP_760 (void); |
||||
|
int OP_10760 (void); |
||||
|
int OP_1C0 (void); |
||||
|
int OP_240 (void); |
||||
|
int OP_600 (void); |
||||
|
int OP_1A0 (void); |
||||
|
int OP_180 (void); |
||||
|
int OP_E0 (void); |
||||
|
int OP_2E0 (void); |
||||
|
int OP_6E0 (void); |
||||
|
int OP_40 (void); |
||||
|
int OP_1E0 (void); |
||||
|
int OP_260 (void); |
||||
|
int OP_7E0 (void); |
||||
|
int OP_C0 (void); |
||||
|
int OP_220 (void); |
||||
|
int OP_A0 (void); |
||||
|
int OP_660 (void); |
||||
|
int OP_80 (void); |
||||
|
int OP_160 (void); |
||||
|
int OP_200 (void); |
||||
|
int OP_640 (void); |
||||
|
int OP_2A0 (void); |
||||
|
int OP_A007E0 (void); |
||||
|
int OP_2C0 (void); |
||||
|
int OP_C007E0 (void); |
||||
|
int OP_280 (void); |
||||
|
int OP_8007E0 (void); |
||||
|
int OP_100 (void); |
||||
|
int OP_680 (void); |
||||
|
int OP_140 (void); |
||||
|
int OP_6C0 (void); |
||||
|
int OP_120 (void); |
||||
|
int OP_6A0 (void); |
||||
|
int OP_20 (void); |
||||
|
int OP_7C0 (void); |
||||
|
int OP_47C0 (void); |
||||
|
int OP_87C0 (void); |
||||
|
int OP_C7C0 (void); |
||||
|
int OP_16007E0 (void); |
||||
|
int OP_16087E0 (void); |
||||
|
int OP_12007E0 (void); |
||||
|
int OP_10007E0 (void); |
||||
|
int OP_E607E0 (void); |
||||
|
int OP_22207E0 (void); |
||||
|
int OP_E407E0 (void); |
||||
|
int OP_E207E0 (void); |
||||
|
int OP_E007E0 (void); |
||||
|
int OP_20007E0 (void); |
||||
|
int OP_1C207E0 (void); |
||||
|
int OP_1C007E0 (void); |
||||
|
int OP_18207E0 (void); |
||||
|
int OP_18007E0 (void); |
||||
|
int OP_2C207E0 (void); |
||||
|
int OP_2C007E0 (void); |
||||
|
int OP_28207E0 (void); |
||||
|
int OP_28007E0 (void); |
||||
|
int OP_24207E0 (void); |
||||
|
int OP_24007E0 (void); |
||||
|
int OP_107E0 (void); |
||||
|
int OP_10780 (void); |
||||
|
int OP_1B0780 (void); |
||||
|
int OP_130780 (void); |
||||
|
int OP_B0780 (void); |
||||
|
int OP_30780 (void); |
||||
|
int OP_22007E0 (void); |
||||
|
int OP_307F0 (void); |
||||
|
int OP_107F0 (void); |
||||
|
int OP_307E0 (void); |
||||
|
#endif |
||||
Loading…
Reference in new issue