xref: /openbsd-src/gnu/usr.bin/binutils-2.17/cpu/sh.opc (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod/* SHmedia opcode support.  -*- C -*-
2*3d8817e4Smiod
3*3d8817e4Smiod   Copyright 2000, 2005 Free Software Foundation, Inc.
4*3d8817e4Smiod
5*3d8817e4Smiod   Contributed by Red Hat Inc; developed under contract from Hitachi
6*3d8817e4Smiod   Semiconductor (America) Inc.
7*3d8817e4Smiod
8*3d8817e4Smiod   This file is part of the GNU Binutils.
9*3d8817e4Smiod
10*3d8817e4Smiod   This program is free software; you can redistribute it and/or modify
11*3d8817e4Smiod   it under the terms of the GNU General Public License as published by
12*3d8817e4Smiod   the Free Software Foundation; either version 2 of the License, or
13*3d8817e4Smiod   (at your option) any later version.
14*3d8817e4Smiod
15*3d8817e4Smiod   This program is distributed in the hope that it will be useful,
16*3d8817e4Smiod   but WITHOUT ANY WARRANTY; without even the implied warranty of
17*3d8817e4Smiod   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*3d8817e4Smiod   GNU General Public License for more details.
19*3d8817e4Smiod
20*3d8817e4Smiod   You should have received a copy of the GNU General Public License
21*3d8817e4Smiod   along with this program; if not, write to the Free Software
22*3d8817e4Smiod   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23*3d8817e4Smiod   MA 02110-1301, USA.  */
24*3d8817e4Smiod
25*3d8817e4Smiod/* This file is an addendum to sh-media.cpu.  Heavy use of C code isn't
26*3d8817e4Smiod   appropriate in .cpu files, so it resides here.  This especially applies
27*3d8817e4Smiod   to assembly/disassembly where parsing/printing can be quite involved.
28*3d8817e4Smiod   Such things aren't really part of the specification of the cpu, per se,
29*3d8817e4Smiod   so .cpu files provide the general framework and .opc files handle the
30*3d8817e4Smiod   nitty-gritty details as necessary.
31*3d8817e4Smiod
32*3d8817e4Smiod   Each section is delimited with start and end markers.
33*3d8817e4Smiod
34*3d8817e4Smiod   <arch>-opc.h additions use: "-- opc.h"
35*3d8817e4Smiod   <arch>-opc.c additions use: "-- opc.c"
36*3d8817e4Smiod   <arch>-asm.c additions use: "-- asm.c"
37*3d8817e4Smiod   <arch>-dis.c additions use: "-- dis.c"
38*3d8817e4Smiod   <arch>-ibd.h additions use: "-- ibd.h"  */
39*3d8817e4Smiod
40*3d8817e4Smiod/* -- opc.h */
41*3d8817e4Smiod
42*3d8817e4Smiod/* Allows reason codes to be output when assembler errors occur.  */
43*3d8817e4Smiod#define CGEN_VERBOSE_ASSEMBLER_ERRORS
44*3d8817e4Smiod
45*3d8817e4Smiod/* Override disassembly hashing - there are variable bits in the top
46*3d8817e4Smiod   byte of these instructions.  */
47*3d8817e4Smiod#define CGEN_DIS_HASH_SIZE 8
48*3d8817e4Smiod#define CGEN_DIS_HASH(buf,value) (((* (unsigned char*) (buf)) >> 6) % CGEN_DIS_HASH_SIZE)
49*3d8817e4Smiod
50*3d8817e4Smiod/* -- asm.c */
51*3d8817e4Smiod
52*3d8817e4Smiodstatic const char *
53*3d8817e4Smiodparse_fsd (CGEN_CPU_DESC cd,
54*3d8817e4Smiod	   const char ** strp,
55*3d8817e4Smiod	   int opindex,
56*3d8817e4Smiod	   long * valuep)
57*3d8817e4Smiod{
58*3d8817e4Smiod  abort ();
59*3d8817e4Smiod}
60*3d8817e4Smiod
61*3d8817e4Smiod/* -- dis.c */
62*3d8817e4Smiod
63*3d8817e4Smiodstatic void
64*3d8817e4Smiodprint_likely (CGEN_CPU_DESC cd,
65*3d8817e4Smiod	      void * dis_info,
66*3d8817e4Smiod	      long value,
67*3d8817e4Smiod	      unsigned int attrs,
68*3d8817e4Smiod	      bfd_vma pc,
69*3d8817e4Smiod	      int length)
70*3d8817e4Smiod{
71*3d8817e4Smiod  disassemble_info *info = (disassemble_info *) dis_info;
72*3d8817e4Smiod
73*3d8817e4Smiod  (*info->fprintf_func) (info->stream, (value) ? "/l" : "/u");
74*3d8817e4Smiod}
75*3d8817e4Smiod
76*3d8817e4Smiod/* -- */
77