1214571Sdim/* spu.h -- Assembler for spu
2214571Sdim
3214571Sdim   Copyright 2006, 2007 Free Software Foundation, Inc.
4214571Sdim
5214571Sdim   This file is part of GAS, the GNU Assembler.
6214571Sdim
7214571Sdim   GAS is free software; you can redistribute it and/or modify
8214571Sdim   it under the terms of the GNU General Public License as published by
9214571Sdim   the Free Software Foundation; either version 2, or (at your option)
10214571Sdim   any later version.
11214571Sdim
12214571Sdim   GAS is distributed in the hope that it will be useful,
13214571Sdim   but WITHOUT ANY WARRANTY; without even the implied warranty of
14214571Sdim   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15214571Sdim   GNU General Public License for more details.
16214571Sdim
17214571Sdim   You should have received a copy of the GNU General Public License
18214571Sdim   along with GAS; see the file COPYING.  If not, write to the Free
19214571Sdim   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20214571Sdim   02110-1301, USA.  */
21214571Sdim
22214571Sdim#ifndef TC_SPU
23214571Sdim#define TC_SPU 1
24214571Sdim
25214571Sdim#include "opcode/spu.h"
26214571Sdim
27214571Sdim#define TARGET_FORMAT "elf32-spu"
28214571Sdim#define TARGET_ARCH bfd_arch_spu
29214571Sdim#define TARGET_NAME "elf32-spu"
30214571Sdim
31214571Sdim#define TARGET_BYTES_BIG_ENDIAN 1
32214571Sdim
33214571Sdimstruct tc_fix_info {
34214571Sdim  unsigned short arg_format;
35214571Sdim  unsigned short insn_tag;
36214571Sdim};
37214571Sdim
38214571Sdim/* fixS will have a member named tc_fix_data of this type.  */
39214571Sdim#define TC_FIX_TYPE struct tc_fix_info
40214571Sdim#define TC_INIT_FIX_DATA(FIXP) \
41214571Sdim  do						\
42214571Sdim    {						\
43214571Sdim      (FIXP)->tc_fix_data.arg_format = 0;	\
44214571Sdim      (FIXP)->tc_fix_data.insn_tag = 0;		\
45214571Sdim    }						\
46214571Sdim  while (0)
47214571Sdim
48214571Sdim/* Don't reduce function symbols to section symbols, and don't adjust
49214571Sdim   references to PPU symbols.  */
50214571Sdim#define tc_fix_adjustable(FIXP) \
51214571Sdim  (!(S_IS_FUNCTION ((FIXP)->fx_addsy)			\
52214571Sdim     || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU32	\
53214571Sdim     || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU64))
54214571Sdim
55214571Sdim/* Keep relocs on calls.  Branches to function symbols are tail or
56214571Sdim   sibling calls.  */
57214571Sdim#define TC_FORCE_RELOCATION(FIXP) \
58214571Sdim  ((FIXP)->tc_fix_data.insn_tag == M_BRSL		\
59214571Sdim   || (FIXP)->tc_fix_data.insn_tag == M_BRASL		\
60214571Sdim   || (((FIXP)->tc_fix_data.insn_tag == M_BR		\
61214571Sdim	|| (FIXP)->tc_fix_data.insn_tag == M_BRA)	\
62214571Sdim       && (FIXP)->fx_addsy != NULL			\
63214571Sdim       && S_IS_FUNCTION ((FIXP)->fx_addsy))		\
64214571Sdim   || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU32		\
65214571Sdim   || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU64		\
66214571Sdim   || generic_force_reloc (FIXP))
67214571Sdim
68214571Sdim/* Values passed to md_apply_fix don't include symbol values.  */
69214571Sdim#define MD_APPLY_SYM_VALUE(FIX) 0
70214571Sdim
71214571Sdim/* The spu uses pseudo-ops with no leading period.  */
72214571Sdim#define NO_PSEUDO_DOT 1
73214571Sdim
74214571Sdim/* Don't warn on word overflow; it happens on %hi relocs.  */
75214571Sdim#undef WARN_SIGNED_OVERFLOW_WORD
76214571Sdim
77214571Sdim#define DIFF_EXPR_OK
78214571Sdim
79214571Sdim#define WORKING_DOT_WORD
80214571Sdim
81214571Sdim#define md_number_to_chars number_to_chars_bigendian
82214571Sdim
83214571Sdim#define md_convert_frag(b,s,f)		{as_fatal (_("spu convert_frag\n"));}
84214571Sdim
85214571Sdim/* We don't need to do anything special for undefined symbols.  */
86214571Sdim#define md_undefined_symbol(s) 0
87214571Sdim
88214571Sdimextern symbolS *section_symbol (asection *);
89214571Sdim#define md_operand(e) \
90214571Sdim  do {								\
91214571Sdim    if (strncasecmp (input_line_pointer, "@ppu", 4) == 0)	\
92214571Sdim      {								\
93214571Sdim	e->X_op = O_symbol;					\
94214571Sdim	if (abs_section_sym == NULL)				\
95214571Sdim	  abs_section_sym = section_symbol (absolute_section);	\
96214571Sdim	e->X_add_symbol = abs_section_sym;			\
97214571Sdim	e->X_add_number = 0;					\
98214571Sdim      }								\
99214571Sdim  } while (0)
100214571Sdim
101214571Sdim/* Fill in rs_align_code fragments.  */
102214571Sdimextern void spu_handle_align PARAMS ((fragS *));
103214571Sdim#define HANDLE_ALIGN(frag)  spu_handle_align (frag)
104214571Sdim
105214571Sdim#define MAX_MEM_FOR_RS_ALIGN_CODE  (7 + 8)
106214571Sdim
107214571Sdim#endif /* TC_SPU */
108