* itbl-ops.c: New file. Add support for dynamically read
[platform/upstream/binutils.git] / gas / itbl-ops.h
1
2 /* External functions, constants and defines for itbl support */
3
4 #include "itbl-cpu.h"
5
6 /* Defaults for definitions required by generic code */ 
7 #ifndef ITBL_NUMBER_OF_PROCESSORS
8 #define ITBL_NUMBER_OF_PROCESSORS 1
9 #endif
10
11 #ifndef ITBL_MAX_BITPOS 
12 #define ITBL_MAX_BITPOS 31
13 #endif
14
15 #ifndef ITBL_TYPE 
16 #define ITBL_TYPE unsigned long
17 #endif
18
19 #ifndef ITBL_IS_INSN
20 #define ITBL_IS_INSN(insn) 1
21 #endif
22
23 #ifndef ITBL_DECODE_PNUM
24 #define ITBL_DECODE_PNUM(insn) 0
25 #endif
26
27 #ifndef ITBL_ENCODE_PNUM
28 #define ITBL_ENCODE_PNUM(pnum) 0
29 #endif
30
31 typedef ITBL_TYPE t_insn;
32
33 /* types of entries */
34 typedef enum 
35 {
36     e_insn,
37     e_dreg,
38         e_regtype0 = e_dreg,
39     e_creg,
40     e_greg,
41     e_addr,
42         e_nregtypes = e_greg+1,
43     e_immed,
44     e_ntypes,
45     e_invtype   /* invalid type */
46 } e_type;
47
48 typedef enum 
49 {
50     e_p0,
51     e_nprocs=NUMBER_OF_PROCESSORS,
52     e_invproc   /* invalid processor */
53 } e_processor;
54
55 /* These routines are visible to the main part of the assembler */
56
57 int itbl_parse(char* insntbl);
58 void itbl_init(void);
59 char *itbl_get_field(char **s);
60 unsigned long itbl_assemble(char *name, char *operands);
61 int itbl_disassemble(char *str, unsigned long insn);
62 int itbl_parse(char *tbl); /* parses insn tbl */
63 unsigned long itbl_get_reg_val(char *name);
64 unsigned long itbl_get_val(e_processor processor, e_type type, char *name);
65 char *itbl_get_name(e_processor processor, e_type type, unsigned long val);
66
67 /* These routines are called by the table parser used to build the 
68  * dynamic list of new processor instructions and registers. */
69
70 struct itbl_entry *itbl_add_reg(int yyproc, int yytype, char *regname, int regnum);
71 struct itbl_entry *itbl_add_insn(int yyproc, char *name, unsigned long value, 
72         int sbit, int ebit, unsigned long flags);
73 struct itbl_field *itbl_add_operand(struct itbl_entry *e, int yytype, 
74         int sbit, int ebit, unsigned long flags);
75