📄 tc-hppa.c
字号:
static int pa_get_absolute_expression PARAMS ((struct pa_it *, char **));static int evaluate_absolute PARAMS ((struct pa_it *));static unsigned int pa_build_arg_reloc PARAMS ((char *));static unsigned int pa_align_arg_reloc PARAMS ((unsigned int, unsigned int));static int pa_parse_nullif PARAMS ((char **));static int pa_parse_nonneg_cmpsub_cmpltr PARAMS ((char **, int));static int pa_parse_neg_cmpsub_cmpltr PARAMS ((char **, int));static int pa_parse_neg_add_cmpltr PARAMS ((char **, int));static int pa_parse_nonneg_add_cmpltr PARAMS ((char **, int));static int pa_parse_cmpb_64_cmpltr PARAMS ((char **));static int pa_parse_cmpib_64_cmpltr PARAMS ((char **));static int pa_parse_addb_64_cmpltr PARAMS ((char **));static void pa_block PARAMS ((int));static void pa_brtab PARAMS ((int));static void pa_try PARAMS ((int));static void pa_call PARAMS ((int));static void pa_call_args PARAMS ((struct call_desc *));static void pa_callinfo PARAMS ((int));static void pa_copyright PARAMS ((int));static void pa_end PARAMS ((int));static void pa_enter PARAMS ((int));static void pa_entry PARAMS ((int));static void pa_equ PARAMS ((int));static void pa_exit PARAMS ((int));static void pa_export PARAMS ((int));static void pa_type_args PARAMS ((symbolS *, int));static void pa_import PARAMS ((int));static void pa_label PARAMS ((int));static void pa_leave PARAMS ((int));static void pa_level PARAMS ((int));static void pa_origin PARAMS ((int));static void pa_proc PARAMS ((int));static void pa_procend PARAMS ((int));static void pa_param PARAMS ((int));static void pa_undefine_label PARAMS ((void));static int need_pa11_opcode PARAMS ((void));static int pa_parse_number PARAMS ((char **, int));static label_symbol_struct *pa_get_label PARAMS ((void));#ifdef OBJ_SOMstatic int log2 PARAMS ((int));static void pa_compiler PARAMS ((int));static void pa_align PARAMS ((int));static void pa_space PARAMS ((int));static void pa_spnum PARAMS ((int));static void pa_subspace PARAMS ((int));static sd_chain_struct *create_new_space PARAMS ((char *, int, int, int, int, int, asection *, int));static ssd_chain_struct *create_new_subspace PARAMS ((sd_chain_struct *, char *, int, int, int, int, int, int, int, int, int, int, asection *));static ssd_chain_struct *update_subspace PARAMS ((sd_chain_struct *, char *, int, int, int, int, int, int, int, int, int, int, asection *));static sd_chain_struct *is_defined_space PARAMS ((char *));static ssd_chain_struct *is_defined_subspace PARAMS ((char *));static sd_chain_struct *pa_segment_to_space PARAMS ((asection *));static ssd_chain_struct *pa_subsegment_to_subspace PARAMS ((asection *, subsegT));static sd_chain_struct *pa_find_space_by_number PARAMS ((int));static unsigned int pa_subspace_start PARAMS ((sd_chain_struct *, int));static sd_chain_struct *pa_parse_space_stmt PARAMS ((char *, int));static int pa_next_subseg PARAMS ((sd_chain_struct *));static void pa_spaces_begin PARAMS ((void));#endifstatic void pa_ip PARAMS ((char *));static void fix_new_hppa PARAMS ((fragS *, int, int, symbolS *, offsetT, expressionS *, int, bfd_reloc_code_real_type, enum hppa_reloc_field_selector_type_alt, int, unsigned int, int));static int is_end_of_statement PARAMS ((void));static int reg_name_search PARAMS ((char *));static int pa_chk_field_selector PARAMS ((char **));static int is_same_frag PARAMS ((fragS *, fragS *));static void process_exit PARAMS ((void));static unsigned int pa_stringer_aux PARAMS ((char *));static fp_operand_format pa_parse_fp_cnv_format PARAMS ((char **s));static int pa_parse_ftest_gfx_completer PARAMS ((char **));#ifdef OBJ_ELFstatic void hppa_elf_mark_end_of_function PARAMS ((void));static void pa_build_unwind_subspace PARAMS ((struct call_info *));static void pa_vtable_entry PARAMS ((int));static void pa_vtable_inherit PARAMS ((int));#endif/* File and gloally scoped variable declarations. */#ifdef OBJ_SOM/* Root and final entry in the space chain. */static sd_chain_struct *space_dict_root;static sd_chain_struct *space_dict_last;/* The current space and subspace. */static sd_chain_struct *current_space;static ssd_chain_struct *current_subspace;#endif/* Root of the call_info chain. */static struct call_info *call_info_root;/* The last call_info (for functions) structure seen so it can be associated with fixups and function labels. */static struct call_info *last_call_info;/* The last call description (for actual calls). */static struct call_desc last_call_desc;/* handle of the OPCODE hash table */static struct hash_control *op_hash = NULL;/* Table of pseudo ops for the PA. FIXME -- how many of these are now redundant with the overall GAS and the object file dependent tables? */const pseudo_typeS md_pseudo_table[] ={ /* align pseudo-ops on the PA specify the actual alignment requested, not the log2 of the requested alignment. */#ifdef OBJ_SOM {"align", pa_align, 8},#endif#ifdef OBJ_ELF {"align", s_align_bytes, 8},#endif {"begin_brtab", pa_brtab, 1}, {"begin_try", pa_try, 1}, {"block", pa_block, 1}, {"blockz", pa_block, 0}, {"byte", pa_cons, 1}, {"call", pa_call, 0}, {"callinfo", pa_callinfo, 0},#if defined (OBJ_ELF) && defined (TE_LINUX) {"code", obj_elf_text, 0},#else {"code", pa_text, 0}, {"comm", pa_comm, 0},#endif#ifdef OBJ_SOM {"compiler", pa_compiler, 0},#endif {"copyright", pa_copyright, 0},#if !(defined (OBJ_ELF) && defined (TE_LINUX)) {"data", pa_data, 0},#endif {"double", pa_float_cons, 'd'}, {"dword", pa_cons, 8}, {"end", pa_end, 0}, {"end_brtab", pa_brtab, 0},#if !(defined (OBJ_ELF) && defined (TE_LINUX)) {"end_try", pa_try, 0},#endif {"enter", pa_enter, 0}, {"entry", pa_entry, 0}, {"equ", pa_equ, 0}, {"exit", pa_exit, 0}, {"export", pa_export, 0},#ifdef OBJ_ELF {"file", dwarf2_directive_file, 0 },#endif {"fill", pa_fill, 0}, {"float", pa_float_cons, 'f'}, {"half", pa_cons, 2}, {"import", pa_import, 0}, {"int", pa_cons, 4}, {"label", pa_label, 0}, {"lcomm", pa_lcomm, 0}, {"leave", pa_leave, 0}, {"level", pa_level, 0},#ifdef OBJ_ELF {"loc", dwarf2_directive_loc, 0 },#endif {"long", pa_cons, 4}, {"lsym", pa_lsym, 0},#ifdef OBJ_SOM {"nsubspa", pa_subspace, 1},#endif {"octa", pa_cons, 16}, {"org", pa_origin, 0}, {"origin", pa_origin, 0}, {"param", pa_param, 0}, {"proc", pa_proc, 0}, {"procend", pa_procend, 0}, {"quad", pa_cons, 8}, {"reg", pa_equ, 1}, {"short", pa_cons, 2}, {"single", pa_float_cons, 'f'},#ifdef OBJ_SOM {"space", pa_space, 0}, {"spnum", pa_spnum, 0},#endif {"string", pa_stringer, 0}, {"stringz", pa_stringer, 1},#ifdef OBJ_SOM {"subspa", pa_subspace, 0},#endif#if !(defined (OBJ_ELF) && defined (TE_LINUX)) {"text", pa_text, 0},#endif {"version", pa_version, 0},#ifdef OBJ_ELF {"vtable_entry", pa_vtable_entry, 0}, {"vtable_inherit", pa_vtable_inherit, 0},#endif {"word", pa_cons, 4}, {NULL, 0, 0}};/* This array holds the chars that only start a comment at the beginning of a line. If the line seems to have the form '# 123 filename' .line and .file directives will appear in the pre-processed output. Note that input_file.c hand checks for '#' at the beginning of the first line of the input file. This is because the compiler outputs #NO_APP at the beginning of its output. Also note that C style comments will always work. */const char line_comment_chars[] = "#";/* This array holds the chars that always start a comment. If the pre-processor is disabled, these aren't very useful. */const char comment_chars[] = ";";/* This array holds the characters which act as line separators. */const char line_separator_chars[] = "!";/* Chars that can be used to separate mant from exp in floating point nums. */const char EXP_CHARS[] = "eE";/* Chars that mean this number is a floating point constant. As in 0f12.456 or 0d1.2345e12. Be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be changed in read.c. Ideally it shouldn't hae to know abou it at all, but nothing is ideal around here. */const char FLT_CHARS[] = "rRsSfFdDxXpP";static struct pa_it the_insn;/* Points to the end of an expression just parsed by get_expressoin and friends. FIXME. This shouldn't be handled with a file-global variable. */static char *expr_end;/* Nonzero if a .callinfo appeared within the current procedure. */static int callinfo_found;/* Nonzero if the assembler is currently within a .entry/.exit pair. */static int within_entry_exit;/* Nonzero if the assembler is currently within a procedure definition. */static int within_procedure;/* Handle on structure which keep track of the last symbol seen in each subspace. */static label_symbol_struct *label_symbols_rootp = NULL;/* Holds the last field selector. */static int hppa_field_selector;/* Nonzero when strict syntax checking is enabled. Zero otherwise. Each opcode in the table has a flag which indicates whether or not strict syntax checking should be enabled for that instruction. */static int strict = 0;/* pa_parse_number returns values in `pa_number'. Mostly pa_parse_number is used to return a register number, with floating point registers being numbered from FP_REG_BASE upwards. The bit specified with FP_REG_RSEL is set if the floating point register has a `r' suffix. */#define FP_REG_BASE 64#define FP_REG_RSEL 128static int pa_number;#ifdef OBJ_SOM/* A dummy bfd symbol so that all relocations have symbols of some kind. */static symbolS *dummy_symbol;#endif/* Nonzero if errors are to be printed. */static int print_errors = 1;/* List of registers that are pre-defined: Each general register has one predefined name of the form %r<REGNUM> which has the value <REGNUM>. Space and control registers are handled in a similar manner, but use %sr<REGNUM> and %cr<REGNUM> as their predefined names. Likewise for the floating point registers, but of the form %fr<REGNUM>. Floating point registers have additional predefined names with 'L' and 'R' suffixes (e.g. %fr19L, %fr19R) which again have the value <REGNUM>. Many registers also have synonyms: %r26 - %r23 have %arg0 - %arg3 as synonyms %r28 - %r29 have %ret0 - %ret1 as synonyms %r30 has %sp as a synonym %r27 has %dp as a synonym %r2 has %rp as a synonym Almost every control register has a synonym; they are not listed here for brevity. The table is sorted. Suitable for searching by a binary search. */static const struct pd_reg pre_defined_registers[] ={ {"%arg0", 26}, {"%arg1", 25}, {"%arg2", 24}, {"%arg3", 23}, {"%cr0", 0}, {"%cr10", 10}, {"%cr11", 11}, {"%cr12", 12}, {"%cr13", 13}, {"%cr14", 14}, {"%cr15", 15}, {"%cr16", 16}, {"%cr17", 17}, {"%cr18", 18}, {"%cr19", 19}, {"%cr20", 20}, {"%cr21", 21}, {"%cr22", 22}, {"%cr23", 23}, {"%cr24", 24}, {"%cr25", 25}, {"%cr26", 26}, {"%cr27", 27}, {"%cr28", 28}, {"%cr29", 29}, {"%cr30", 30}, {"%cr31", 31}, {"%cr8", 8}, {"%cr9", 9}, {"%dp", 27}, {"%eiem", 15}, {"%eirr", 23}, {"%fr0", 0 + FP_REG_BASE}, {"%fr0l", 0 + FP_REG_BASE}, {"%fr0r", 0 + FP_REG_BASE + FP_REG_RSEL}, {"%fr1", 1 + FP_REG_BASE}, {"%fr10", 10 + FP_REG_BASE}, {"%fr10l", 10 + FP_REG_BASE}, {"%fr10r", 10 + FP_REG_BASE + FP_REG_RSEL}, {"%fr11", 11 + FP_REG_BASE}, {"%fr11l", 11 + FP_REG_BASE}, {"%fr11r", 11 + FP_REG_BASE + FP_REG_RSEL}, {"%fr12", 12 + FP_REG_BASE}, {"%fr12l", 12 + FP_REG_BASE}, {"%fr12r", 12 + FP_REG_BASE + FP_REG_RSEL}, {"%fr13", 13 + FP_REG_BASE}, {"%fr13l", 13 + FP_REG_BASE}, {"%fr13r", 13 + FP_REG_BASE + FP_REG_RSEL}, {"%fr14", 14 + FP_REG_BASE}, {"%fr14l", 14 + FP_REG_BASE}, {"%fr14r", 14 + FP_REG_BASE + FP_REG_RSEL}, {"%fr15", 15 + FP_REG_BASE}, {"%fr15l", 15 + FP_REG_BASE}, {"%fr15r", 15 + FP_REG_BASE + FP_REG_RSEL}, {"%fr16", 16 + FP_REG_BASE}, {"%fr16l", 16 + FP_REG_BASE}, {"%fr16r", 16 + FP_REG_BASE + FP_REG_RSEL}, {"%fr17", 17 + FP_REG_BASE}, {"%fr17l", 17 + FP_REG_BASE}, {"%fr17r", 17 + FP_REG_BASE + FP_REG_RSEL}, {"%fr18", 18 + FP_REG_BASE}, {"%fr18l", 18 + FP_REG_BASE}, {"%fr18r", 18 + FP_REG_BASE + FP_REG_RSEL}, {"%fr19", 19 + FP_REG_BASE}, {"%fr19l", 19 + FP_REG_BASE}, {"%fr19r", 19 + FP_REG_BASE + FP_REG_RSEL}, {"%fr1l", 1 + FP_REG_BASE}, {"%fr1r", 1 + FP_REG_BASE + FP_REG_RSEL}, {"%fr2", 2 + FP_REG_BASE}, {"%fr20", 20 + FP_REG_BASE}, {"%fr20l", 20 + FP_REG_BASE}, {"%fr20r", 20 + FP_REG_BASE + FP_REG_RSEL}, {"%fr21", 21 + FP_REG_BASE}, {"%fr21l", 21 + FP_REG_BASE}, {"%fr21r", 21 + FP_REG_BASE + FP_REG_RSEL}, {"%fr22", 22 + FP_REG_BASE}, {"%fr22l", 22 + FP_REG_BASE}, {"%fr22r", 22 + FP_REG_BASE + FP_REG_RSEL}, {"%fr23", 23 + FP_REG_BASE}, {"%fr23l", 23 + FP_REG_BASE}, {"%fr23r", 23 + FP_REG_BASE + FP_REG_RSEL}, {"%fr24", 24 + FP_REG_BASE}, {"%fr24l", 24 + FP_REG_BASE}, {"%fr24r", 24 + FP_REG_BASE + FP_REG_RSEL}, {"%fr25", 25 + FP_REG_BASE}, {"%fr25l", 25 + FP_REG_BASE}, {"%fr25r", 25 + FP_REG_BASE + FP_REG_RSEL}, {"%fr26", 26 + FP_REG_BASE}, {"%fr26l", 26 + FP_REG_BASE}, {"%fr26r", 26 + FP_REG_BASE + FP_REG_RSEL}, {"%fr27", 27 + FP_REG_BASE}, {"%fr27l", 27 + FP_REG_BASE}, {"%fr27r", 27 + FP_REG_BASE + FP_REG_RSEL}, {"%fr28", 28 + FP_REG_BASE}, {"%fr28l", 28 + FP_REG_BASE}, {"%fr28r", 28 + FP_REG_BASE + FP_REG_RSEL}, {"%fr29", 29 + FP_REG_BASE}, {"%fr29l", 29 + FP_REG_BASE}, {"%fr29r", 29 + FP_REG_BASE + FP_REG_RSEL}, {"%fr2l", 2 + FP_REG_BASE}, {"%fr2r", 2 + FP_REG_BASE + FP_REG_RSEL}, {"%fr3", 3 + FP_REG_BASE}, {"%fr30", 30 + FP_REG_BASE}, {"%fr30l", 30 + FP_REG_BASE}, {"%fr30r", 30 + FP_REG_BASE + FP_REG_RSEL}, {"%fr31", 31 + FP_REG_BASE}, {"%fr31l", 31 + FP_REG_BASE}, {"%fr31r", 31 + FP_REG_BASE + FP_REG_RSEL}, {"%fr3l", 3 + FP_REG_BASE}, {"%fr3r", 3 + FP_REG_BASE + FP_REG_RSEL}, {"%fr4", 4 + FP_REG_BASE}, {"%fr4l", 4 + FP_REG_BASE}, {"%fr4r", 4 + FP_REG_BASE + FP_REG_RSEL}, {"%fr5", 5 + FP_REG_BASE}, {"%fr5l", 5 + FP_REG_BASE}, {"%fr5r", 5 + FP_REG_BASE + FP_REG_RSEL}, {"%fr6", 6 + FP_REG_BASE}, {"%fr6l", 6 + FP_REG_BASE}, {"%fr6r", 6 + FP_REG_BASE + FP_REG_RSEL}, {"%fr7", 7 + FP_REG_BASE}, {"%fr7l", 7 + FP_REG_BASE}, {"%fr7r", 7 + FP_REG_BASE + FP_REG_RSEL}, {"%fr8", 8 + FP_REG_BASE}, {"%fr8l", 8 + FP_REG_BASE}, {"%fr8r", 8 + FP_REG_BASE + FP_REG_RSEL}, {"%fr9", 9 + FP_REG_BASE}, {"%fr9l", 9 + FP_REG_BASE}, {"%fr9r", 9 + FP_REG_BASE + FP_REG_RSEL}, {"%hta", 25}, {"%iir", 19}, {"%ior", 21}, {"%ipsw", 22}, {"%isr", 20}, {"%itmr", 16}, {"%iva", 14}, {"%pcoq", 18}, {"%pcsq", 17}, {"%pidr1", 8}, {"%pidr2", 9}, {"%pidr3", 12}, {"%pidr4", 13}, {"%ppda", 24}, {"%r0", 0}, {"%r1", 1}, {"%r10", 10}, {"%r11", 11}, {"%r12", 12}, {"%r13", 13}, {"%r14", 14}, {"%r15", 15}, {"%r16", 16}, {"%r17", 17}, {"%r18", 18}, {"%r19", 19}, {"%r2", 2}, {"%r20", 20}, {"%r21", 21}, {"%r22", 22}, {"%r23", 23}, {"%r24", 24}, {"%r25", 25}, {"%r26", 26}, {"%r27", 27}, {"%r28", 28}, {"%r29", 29}, {"%r3", 3}, {"%r30", 30}, {"%r31", 31}, {"%r4", 4}, {"%r5", 5}, {"%r6", 6}, {"%r7", 7}, {"%r8", 8}, {"%r9", 9}, {"%rctr", 0}, {"%ret0", 28}, {"%ret1", 29}, {"%rp", 2}, {"%sar", 11}, {"%sp", 30}, {"%sr0", 0}, {"%sr1", 1}, {"%sr2", 2}, {"%sr3", 3}, {"%sr4", 4}, {"%sr5", 5}, {"%sr6", 6}, {"%sr7", 7}, {"%tr0", 24},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -