binutils-gdb/gas/config/tc-cris.h

168 lines
6.2 KiB
C
Raw Normal View History

/* tc-cris.h -- Header file for tc-cris.c, the CRIS GAS port.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Contributed by Axis Communications AB, Lund, Sweden.
Originally written for GAS 1.38.1 by Mikael Asker.
Updates, BFDizing, GNUifying and ELF by Hans-Peter Nilsson.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
2007-07-03 19:01:12 +08:00
the Free Software Foundation; either version 3, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to the
Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* See the GAS "internal" document for general documentation on this.
It is called internals.texi (internals.info when makeinfo:d), but is
not installed or makeinfo:d by "make info". */
/* Functions and variables that aren't declared in tc.h are declared here,
with the type/prototype that is used in the local extern-declaration of
their usage. */
#ifndef TC_CRIS
#define TC_CRIS
/* Multi-target support is always on. */
extern const char *cris_target_format (void);
#define TARGET_FORMAT cris_target_format ()
#define TARGET_ARCH bfd_arch_cris
extern unsigned int cris_mach (void);
* configure.in (crisv32): Recognize. AC_DEFINE_UNQUOTED DEFAULT_CRIS_ARCH. Handle crisv32-*-linux-gnu* like cris-*-linux-gnu* and crisv32-*-* like cris-*-*. * configure: Regenerate. * config/tc-cris.c (enum cris_archs): New. (cris_mach, cris_arch_from_string, s_cris_arch, get_sup_reg) (cris_insn_ver_valid_for_arch): New functions. (DEFAULT_CRIS_ARCH): New macro, default to cris_any_v0_v10. (cris_arch): New variable. (md_pseudo_table): New pseudo .arch. (err_for_dangerous_mul_placement): Initialize according to DEFAULT_CRIS_ARCH. (STATE_COND_BRANCH): Renamed from STATE_CONDITIONAL_BRANCH. All users changed. (STATE_COND_BRANCH_V32, STATE_COND_BRANCH_COMMON) (STATE_ABS_BRANCH_V32, STATE_LAPC, BRANCH_BF_V32, BRANCH_BB_V32) (BRANCH_WF_V32, BRANCH_WB_V32): New. (BRANCH_BF, BRANCH_BB, BRANCH_WF, BRANCH_WB): Don't undef after use in md_cris_relax_table. (md_cris_relax_table): Add entries for STATE_COND_BRANCH_V32, STATE_COND_BRANCH_COMMON, STATE_ABS_BRANCH_V32, STATE_LAPC. Update and improve head comment. (OPTION_PIC): Define in terms of previous option, OPTION_US. (OPTION_MULBUG_ABORT_ON, OPTION_MULBUG_ABORT_OFF): Similar. (OPTION_ARCH): New. (md_longopts): New option --march=... (cris_any_v0_v10_long_jump_size, crisv32_long_jump_size): New macros. (md_long_jump_size): Initialize in terms of DEFAULT_CRIS_ARCH. (HANDLE_RELAXABLE): New macro. (md_estimate_size_before_relax): Use HANDLE_RELAXABLE for common cases. Check for weak symbols and assume not relaxable. Handle STATE_COND_BRANCH_V32, STATE_COND_BRANCH_COMMON, STATE_ABS_BRANCH_V32, STATE_LAPC. Use new variable symbolP, not fragP->fr_symbol. (md_convert_frag): Handle STATE_COND_BRANCH_V32, STATE_COND_BRANCH_COMMON, STATE_ABS_BRANCH_V32, STATE_LAPC. (cris_create_short_jump): Adjust for CRISv32. (md_create_long_jump): Ditto. Emit error for common_v10_v32. (md_begin): Define symbols "..asm.arch.cris.v32", "..asm.arch.cris.v10", "..asm.arch.cris.common_v10_v32" and "..asm.arch.cris.any_v0_v10". Use cris_insn_ver_valid_for_arch when entering opcode table entry points. (md_assemble): Adjust branch handling for CRISv32. Handle LAPC relaxation. In fix_new_exp call for main insn, pass 1 for pcrel parameter for 8, 16 and 32-bit pc-relative insns and LAPC. (cris_process_instruction): Initialize out_insnp->insn_type to CRIS_INSN_NONE, not CRIS_INSN_NORMAL. <case ']', '[', 'A', 'd', 'Q', 'N', 'n', 'Y', 'U', 'u', 'T'>: New cases. <case 'm'>: Check that modified_char == '.'. <invalid operands>: Consume the rest of the line. When operands don't match, skip over subsequent insns with non-matching version specifier but same mnemonic. <immediate constant, case SIZE_SPEC_REG>: Immediate operands for special registers in CRISv32 are always 32 bit long. <immediate constant, case SIZE_FIELD_SIGNED, SIZE_FIELD_UNSIGNED>: New cases. (get_gen_reg): Only recognize "PC" when followed by "+]" for v32 and compatible. Recognize "ACR" for v32, unless followed by "+". (get_spec_reg): Consider cris_arch when looking up register. (get_autoinc_prefix_or_indir_op): Don't recognize assignment for v32 or compatible. (get_3op_or_dip_prefix_op): Check for ']' after seeing '[rN+'. (cris_get_expression): Restore input_line_pointer if failing "early". (get_flags): Consider cris_arch and recognize flags accordingly. (branch_disp): Adjust for CRISv32. (gen_cond_branch_32): Similar. Emit error for common_v10_v32. (cris_number_to_imm): Use as_bad_where, not as_bad. Remove related FIXME. Don't insist on BFD_RELOC_32_PCREL fixup to be resolved. Don't enter zeros in object file for BFD_RELOC_32_PCREL. <case BFD_RELOC_CRIS_LAPCQ_OFFSET, BFD_RELOC_CRIS_SIGNED_16> <case BFD_RELOC_CRIS_SIGNED_8>: New case. (md_parse_option): Break out "return 1". <OPTION_ARCH> New case. (tc_gen_reloc): <case BFD_RELOC_CRIS_LAPCQ_OFFSET> <case BFD_RELOC_CRIS_SIGNED_16, BFD_RELOC_CRIS_SIGNED_8> <case BFD_RELOC_CRIS_UNSIGNED_8, BFD_RELOC_CRIS_UNSIGNED_16> <case BFD_RELOC_32_PCREL>: New cases. Addends for non-zero fx_pcrel are too in fx_offset. (md_show_usage): Show --march=<arch>. (md_apply_fix3): Adjust val for BFD_RELOC_CRIS_LAPCQ_OFFSET. (md_pcrel_from): BFD_RELOC_CRIS_LAPCQ_OFFSET is PC-relative too. (s_syntax) <struct syntaxes>: Properly constify member operand. * config/tc-cris.h (TARGET_MACH): Define. (cris_mach): Declare. * doc/as.texinfo (Overview) <CRIS>: Add --march=... * doc/c-cris.texi (CRIS-Symbols): New node for built-in symbols. (CRIS-Opts): Document --march=... (CRIS-Pseudos): Document .arch.
2004-11-04 23:00:37 +08:00
#define TARGET_MACH (cris_mach ())
#define TARGET_BYTES_BIG_ENDIAN 0
extern const char *md_shortopts;
extern struct option md_longopts[];
extern size_t md_longopts_size;
extern const pseudo_typeS md_pseudo_table[];
#define tc_comment_chars cris_comment_chars
extern const char cris_comment_chars[];
extern const char line_comment_chars[];
extern const char line_separator_chars[];
/* This should be optional, since it is ignored as an escape (assumed to
be itself) if it is not recognized. */
#define ONLY_STANDARD_ESCAPES
/* Note that we do not define TC_EQUAL_IN_INSN, since its current use is
in the instruction rather than the operand, and thus does not come to
use for side-effect assignments such as "and.d [r0 = r1 + 42], r3". */
#define md_operand(x)
#define md_number_to_chars number_to_chars_littleendian
extern const struct relax_type md_cris_relax_table[];
#define TC_GENERIC_RELAX_TABLE md_cris_relax_table
long cris_relax_frag (segT, fragS *, long);
/* GAS only handles relaxations for pc-relative data targeting addresses
in the same segment, so we have to handle the rest on our own. */
#define md_relax_frag(SEG, FRAGP, STRETCH) \
((FRAGP)->fr_symbol != NULL \
&& S_GET_SEGMENT ((FRAGP)->fr_symbol) == (SEG) \
? relax_frag (SEG, FRAGP, STRETCH) \
: cris_relax_frag (SEG, FRAGP, STRETCH))
2002-09-05 08:01:18 +08:00
#define TC_FORCE_RELOCATION(FIX) md_cris_force_relocation (FIX)
extern int md_cris_force_relocation (struct fix *);
2002-09-05 08:01:18 +08:00
#define IS_CRIS_PIC_RELOC(RTYPE) \
((RTYPE) == BFD_RELOC_CRIS_16_GOT \
|| (RTYPE) == BFD_RELOC_CRIS_32_GOT \
|| (RTYPE) == BFD_RELOC_CRIS_16_GOTPLT \
|| (RTYPE) == BFD_RELOC_CRIS_32_GOTPLT \
|| (RTYPE) == BFD_RELOC_CRIS_32_GOTREL \
|| (RTYPE) == BFD_RELOC_CRIS_32_PLT_GOTREL \
|| (RTYPE) == BFD_RELOC_CRIS_32_PLT_PCREL)
/* Make sure we don't resolve fixups for which we want to emit dynamic
relocations. */
2002-09-05 08:01:18 +08:00
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
(GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| IS_CRIS_PIC_RELOC ((FIX)->fx_r_type))
2002-09-05 08:01:18 +08:00
/* For some reloc types, don't adjust fixups by reducing to a section
symbol. */
#define tc_fix_adjustable(FIX) \
((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
&& (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
&& (! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type) \
|| (FIX)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL))
/* FIXME: This *should* be a redundant definition, as the
TC_FORCE_RELOCATION* definitions already told about the cases where
we *don't* want the symbol value calculated. Here we seem to answer
the "are you sure" question. It certainly has very little to do with
whether the symbol value is passed to md_apply_fix. */
#define MD_APPLY_SYM_VALUE(FIX) 0
/* When we have fixups against constant expressions, we get a GAS-specific
section symbol at no extra charge for obscure reasons in
adjust_reloc_syms. Since ELF outputs section symbols, it gladly
outputs this "*ABS*" symbol in every object. Avoid that.
Also, don't emit undefined symbols (that aren't used in relocations).
They pop up when tentatively parsing register names as symbols. */
#define tc_frob_symbol(symp, punt) \
do { \
if ((OUTPUT_FLAVOR == bfd_target_elf_flavour \
&& (symp) == section_symbol (absolute_section)) \
|| ! S_IS_DEFINED (symp)) \
(punt) = 1; \
} while (0)
#define LISTING_HEADER "GAS for CRIS"
#if 0
/* The testsuite does not let me define these, although they IMHO should
be preferred over the default. */
#define LISTING_WORD_SIZE 2
#define LISTING_LHS_WIDTH 4
#define LISTING_LHS_WIDTH_SECOND 4
#endif
/* END of declaration and definitions described in the "internals"
document. */
/* Do this, or we will never know what hit us when the
broken-word-fixes break. Do _not_ use WARN_SIGNED_OVERFLOW_WORD,
it is only for use with WORKING_DOT_WORD and warns about most stuff.
(still in 2.9.1). */
struct broken_word;
extern void tc_cris_check_adjusted_broken_word (offsetT,
struct broken_word *);
#define TC_CHECK_ADJUSTED_BROKEN_DOT_WORD(new_offset, brokw) \
tc_cris_check_adjusted_broken_word ((offsetT) (new_offset), brokw)
/* We don't want any implicit alignment, so we do nothing. */
* tc.h (struct relax_type, relax_typeS): Move from here.. * as.h: ..to here. Make rlx_forward and rlx_backward an offsetT. * ecoff.c (ecoff_new_file): Add appfile param. * ecoff.h (ecoff_new_file): Likewise. * itbl-lex.h: New file. * itbl-lex.l: Include itbl-lex.h. * itbl-parse.y: Likewise. (insntbl_line, yyparse, yylex): Move to itbl-lex.h. * read.c (s_app_file_string): Mark appfile possibly unused. * subsegs.c (seg_not_empty_p): Make sec possibly unused. * subsegs.h (struct seg_info_trash): Delete. (seg_info): Use segment_info_type instead. * config/obj-coff.c (struct filename_list): Make filename const char *. * config/obj-ecoff.h (obj_app_file): Pass app to ecoff_new_file. * config/obj-elf.c (elf_file_symbol): Similarly. * config/tc-a29k.c (md_apply_fix3): Make val a valueT. Don't use signed right shift. * config/tc-arc.c (md_operand): Warning fix. * config/tc-arm.c (arm_parse_reloc): Only define when OBJ_ELF. (md_begin): Rearrange #if defined OBJ_COFF || defined OBJ_ELF. * config/tc-cris.h (TC_IMPLICIT_LCOMM_ALIGNMENT): Use do while. * config/tc-frv.c (frv_force_relocation): Warning fix. * config/tc-m68k.c (md_parse_option): Delete unused var. * config/tc-mcore.c (mylog2): Rename from log2 throughout. * config/tc-sparc.c: Likewise. (s_common): Warning fix. * config/tc-mips.c (append_insn): Use unsigned long long expressions. * config/tc-mmix.c (PUSHJSTUB_MAX, PUSHJSTUB_MIN): Define from addressT. * config/tc-s390.c (s390_insn): Delete test of unsigned >= 0. * config/tc-sh.c (sh_cfi_frame_initial_instructions, sh_regname_to_dw2regnum): Only define for OBJ_ELF. * config/tc-tic4x.c (tic4x_insert_reg): Use ISLOWER. (tic4x_do_align): Use TIC_NOP_OPCODE. * config/tc-tic4x.h (TIC_NOP_OPCODE): Rename from NOP_OPCODE. * config/tc-vax.c: Include netinet/in.h. (tc_headers_hook): Formatting. * config/tc-xstormy16.c (md_pcrel_from_section): Correct parens.
2005-02-17 21:46:05 +08:00
#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) do { } while (0)
/* CRIS instructions, with operands and prefixes included, are a multiple
of two bytes long. */
#define DWARF2_LINE_MIN_INSN_LENGTH 2
/* Make port immune to unwanted difference in te-generic.h vs. te-linux.h. */
#define LOCAL_LABELS_DOLLAR 1
#endif /* TC_CRIS */
/*
* Local variables:
* eval: (c-set-style "gnu")
* indent-tabs-mode: t
* End:
*/