OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [cpu/] [xc16x.opc] - Blame information for rev 156

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* XC16X opcode support.  -*- C -*-
2
 
3
   Copyright 2006, 2007 Free Software Foundation, Inc.
4
 
5
   Contributed by KPIT Cummins Infosystems Ltd.; developed under contract
6
   from Infineon Systems, GMBH , Germany.
7
 
8
   This file is part of the GNU Binutils.
9
 
10
   This program is free software; you can redistribute it and/or modify
11
   it under the terms of the GNU General Public License as published by
12
   the Free Software Foundation; either version 3 of the License, or
13
   (at your option) any later version.
14
 
15
   This program is distributed in the hope that it will be useful,
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
17
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
   GNU General Public License for more details.
19
 
20
   You should have received a copy of the GNU General Public License
21
   along with this program; if not, write to the Free Software
22
   Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
23
   02110-1301, USA.  */
24
 
25
 
26
/* This file is an addendum to xc16x.cpu.  Heavy use of C code isn't
27
   appropriate in .cpu files, so it resides here.  This especially applies
28
   to assembly/disassembly where parsing/printing can be quite involved.
29
   Such things aren't really part of the specification of the cpu, per se,
30
   so .cpu files provide the general framework and .opc files handle the
31
   nitty-gritty details as necessary.
32
 
33
   Each section is delimited with start and end markers.
34
 
35
   -opc.h additions use: "-- opc.h"
36
   -opc.c additions use: "-- opc.c"
37
   -asm.c additions use: "-- asm.c"
38
   -dis.c additions use: "-- dis.c"
39
   -ibd.h additions use: "-- ibd.h"  */
40
 
41
/* -- opc.h */
42
 
43
#define CGEN_DIS_HASH_SIZE 8
44
#define CGEN_DIS_HASH(buf,value) (((* (unsigned char*) (buf)) >> 3) % CGEN_DIS_HASH_SIZE)
45
 
46
/* -- */
47
 
48
/* -- opc.c */
49
 
50
/* -- */
51
 
52
/* -- asm.c */
53
/* Handle '#' prefixes (i.e. skip over them).  */
54
 
55
static const char *
56
parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
57
            const char **strp,
58
            int opindex ATTRIBUTE_UNUSED,
59
            long *valuep ATTRIBUTE_UNUSED)
60
{
61
  if (**strp == '#')
62
    {
63
      ++*strp;
64
      return NULL;
65
    }
66
  return _("Missing '#' prefix");
67
}
68
 
69
/* Handle '.' prefixes (i.e. skip over them).  */
70
 
71
static const char *
72
parse_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
73
           const char **strp,
74
           int opindex ATTRIBUTE_UNUSED,
75
           long *valuep ATTRIBUTE_UNUSED)
76
{
77
  if (**strp == '.')
78
    {
79
      ++*strp;
80
      return NULL;
81
    }
82
  return _("Missing '.' prefix");
83
}
84
 
85
/* Handle 'pof:' prefixes (i.e. skip over them).  */
86
 
87
static const char *
88
parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
89
           const char **strp,
90
           int opindex ATTRIBUTE_UNUSED,
91
           long *valuep ATTRIBUTE_UNUSED)
92
{
93
  if (strncasecmp (*strp, "pof:", 4) == 0)
94
    {
95
      *strp += 4;
96
      return NULL;
97
    }
98
  return _("Missing 'pof:' prefix");
99
}
100
 
101
/* Handle 'pag:' prefixes (i.e. skip over them).  */
102
 
103
static const char *
104
parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
105
           const char **strp,
106
           int opindex ATTRIBUTE_UNUSED,
107
           long *valuep ATTRIBUTE_UNUSED)
108
{
109
  if (strncasecmp (*strp, "pag:", 4) == 0)
110
    {
111
      *strp += 4;
112
      return NULL;
113
    }
114
  return _("Missing 'pag:' prefix");
115
}
116
 
117
/* Handle 'sof' prefixes (i.e. skip over them).  */
118
 
119
static const char *
120
parse_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
121
           const char **strp,
122
           int opindex ATTRIBUTE_UNUSED,
123
           long *valuep ATTRIBUTE_UNUSED)
124
{
125
  if (strncasecmp (*strp, "sof:", 4) == 0)
126
    {
127
      *strp += 4;
128
      return NULL;
129
    }
130
  return _("Missing 'sof:' prefix");
131
}
132
 
133
/* Handle 'seg' prefixes (i.e. skip over them).  */
134
 
135
static const char *
136
parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
137
           const char **strp,
138
           int opindex ATTRIBUTE_UNUSED,
139
           long *valuep ATTRIBUTE_UNUSED)
140
{
141
  if (strncasecmp (*strp, "seg:", 4) == 0)
142
    {
143
      *strp += 4;
144
      return NULL;
145
    }
146
  return _("Missing 'seg:' prefix");
147
}
148
/* -- */
149
 
150
/* -- dis.c */
151
 
152
#define CGEN_PRINT_NORMAL(cd, info, value, attrs, pc, length)   \
153
  do                                                            \
154
    {                                                           \
155
      if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_DOT_PREFIX))    \
156
        info->fprintf_func (info->stream, ".");                 \
157
      if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_POF_PREFIX))    \
158
        info->fprintf_func (info->stream, "#pof:");             \
159
      if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_PAG_PREFIX))    \
160
        info->fprintf_func (info->stream, "#pag:");             \
161
    }                                                           \
162
  while (0)
163
 
164
/* Print a 'pof:' prefix to an operand.  */
165
 
166
static void
167
print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
168
           void * dis_info ATTRIBUTE_UNUSED,
169
           long value ATTRIBUTE_UNUSED,
170
           unsigned int attrs ATTRIBUTE_UNUSED,
171
           bfd_vma pc ATTRIBUTE_UNUSED,
172
           int length ATTRIBUTE_UNUSED)
173
{
174
}
175
 
176
/* Print a 'pag:' prefix to an operand.  */
177
 
178
static void
179
print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
180
           void * dis_info ATTRIBUTE_UNUSED,
181
           long value ATTRIBUTE_UNUSED,
182
           unsigned int attrs ATTRIBUTE_UNUSED,
183
           bfd_vma pc ATTRIBUTE_UNUSED,
184
           int length ATTRIBUTE_UNUSED)
185
{
186
}
187
 
188
/* Print a 'sof:' prefix to an operand.  */
189
 
190
static void
191
print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
192
           void * dis_info,
193
           long value ATTRIBUTE_UNUSED,
194
           unsigned int attrs ATTRIBUTE_UNUSED,
195
           bfd_vma pc ATTRIBUTE_UNUSED,
196
           int length ATTRIBUTE_UNUSED)
197
{
198
  disassemble_info *info = (disassemble_info *) dis_info;
199
 
200
  info->fprintf_func (info->stream, "sof:");
201
}
202
 
203
/* Print a 'seg:' prefix to an operand.  */
204
 
205
static void
206
print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
207
           void * dis_info,
208
           long value ATTRIBUTE_UNUSED,
209
           unsigned int attrs ATTRIBUTE_UNUSED,
210
           bfd_vma pc ATTRIBUTE_UNUSED,
211
           int length ATTRIBUTE_UNUSED)
212
{
213
  disassemble_info *info = (disassemble_info *) dis_info;
214
 
215
  info->fprintf_func (info->stream, "seg:");
216
}
217
 
218
/* Print a '#' prefix to an operand.  */
219
 
220
static void
221
print_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
222
            void * dis_info,
223
            long value ATTRIBUTE_UNUSED,
224
            unsigned int attrs ATTRIBUTE_UNUSED,
225
            bfd_vma pc ATTRIBUTE_UNUSED,
226
            int length ATTRIBUTE_UNUSED)
227
{
228
  disassemble_info *info = (disassemble_info *) dis_info;
229
 
230
  info->fprintf_func (info->stream, "#");
231
}
232
 
233
/* Print a '.' prefix to an operand.  */
234
 
235
static void
236
print_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
237
           void * dis_info ATTRIBUTE_UNUSED,
238
           long value ATTRIBUTE_UNUSED,
239
           unsigned int attrs ATTRIBUTE_UNUSED,
240
           bfd_vma pc ATTRIBUTE_UNUSED,
241
           int length ATTRIBUTE_UNUSED)
242
{
243
}
244
 
245
/* -- */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.