LCOV - code coverage report
Current view: top level - gcc - final.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 83.6 % 1842 1539
Test Date: 2026-11-14 16:39:50 Functions: 93.3 % 89 83
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Convert RTL to assembler code and output it, for GNU compiler.
       2              :    Copyright (C) 1987-2026 Free Software Foundation, Inc.
       3              : 
       4              : This file is part of GCC.
       5              : 
       6              : GCC is free software; you can redistribute it and/or modify it under
       7              : the terms of the GNU General Public License as published by the Free
       8              : Software Foundation; either version 3, or (at your option) any later
       9              : version.
      10              : 
      11              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14              : for more details.
      15              : 
      16              : You should have received a copy of the GNU General Public License
      17              : along with GCC; see the file COPYING3.  If not see
      18              : <http://www.gnu.org/licenses/>.  */
      19              : 
      20              : /* This is the final pass of the compiler.
      21              :    It looks at the rtl code for a function and outputs assembler code.
      22              : 
      23              :    Call `final_start_function' to output the assembler code for function entry,
      24              :    `final' to output assembler code for some RTL code,
      25              :    `final_end_function' to output assembler code for function exit.
      26              :    If a function is compiled in several pieces, each piece is
      27              :    output separately with `final'.
      28              : 
      29              :    Some optimizations are also done at this level.
      30              :    Move instructions that were made unnecessary by good register allocation
      31              :    are detected and omitted from the output.  (Though most of these
      32              :    are removed by the last jump pass.)
      33              : 
      34              :    Instructions to set the condition codes are omitted when it can be
      35              :    seen that the condition codes already had the desired values.
      36              : 
      37              :    In some cases it is sufficient if the inherited condition codes
      38              :    have related values, but this may require the following insn
      39              :    (the one that tests the condition codes) to be modified.
      40              : 
      41              :    The code for the function prologue and epilogue are generated
      42              :    directly in assembler by the target functions function_prologue and
      43              :    function_epilogue.  Those instructions never exist as rtl.  */
      44              : 
      45              : #include "config.h"
      46              : #define INCLUDE_ALGORITHM /* reverse */
      47              : #include "system.h"
      48              : #include "coretypes.h"
      49              : #include "backend.h"
      50              : #include "target.h"
      51              : #include "rtl.h"
      52              : #include "tree.h"
      53              : #include "cfghooks.h"
      54              : #include "df.h"
      55              : #include "memmodel.h"
      56              : #include "tm_p.h"
      57              : #include "insn-config.h"
      58              : #include "regs.h"
      59              : #include "emit-rtl.h"
      60              : #include "recog.h"
      61              : #include "cgraph.h"
      62              : #include "tree-pretty-print.h" /* for dump_function_header */
      63              : #include "varasm.h"
      64              : #include "insn-attr.h"
      65              : #include "conditions.h"
      66              : #include "flags.h"
      67              : #include "output.h"
      68              : #include "except.h"
      69              : #include "rtl-error.h"
      70              : #include "toplev.h" /* exact_log2, floor_log2 */
      71              : #include "reload.h"
      72              : #include "intl.h"
      73              : #include "cfgrtl.h"
      74              : #include "debug.h"
      75              : #include "tree-pass.h"
      76              : #include "tree-ssa.h"
      77              : #include "cfgloop.h"
      78              : #include "stringpool.h"
      79              : #include "attribs.h"
      80              : #include "asan.h"
      81              : #include "rtl-iter.h"
      82              : #include "print-rtl.h"
      83              : #include "function-abi.h"
      84              : #include "common/common-target.h"
      85              : #include "diagnostic.h"
      86              : #include "diagnostics/file-cache.h"
      87              : #include "selftest.h"
      88              : 
      89              : #include "dwarf2out.h"
      90              : 
      91              : /* Most ports don't need to define CC_STATUS_INIT.
      92              :    So define a null default for it to save conditionalization later.  */
      93              : #ifndef CC_STATUS_INIT
      94              : #define CC_STATUS_INIT
      95              : #endif
      96              : 
      97              : /* Is the given character a logical line separator for the assembler?  */
      98              : #ifndef IS_ASM_LOGICAL_LINE_SEPARATOR
      99              : #define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == ';')
     100              : #endif
     101              : 
     102              : #ifndef JUMP_TABLES_IN_TEXT_SECTION
     103              : #define JUMP_TABLES_IN_TEXT_SECTION 0
     104              : #endif
     105              : 
     106              : /* Bitflags used by final_scan_insn.  */
     107              : #define SEEN_NOTE       1
     108              : #define SEEN_EMITTED    2
     109              : #define SEEN_NEXT_VIEW  4
     110              : 
     111              : /* Last insn processed by final_scan_insn.  */
     112              : static rtx_insn *debug_insn;
     113              : rtx_insn *current_output_insn;
     114              : 
     115              : /* Line number of last NOTE.  */
     116              : static int last_linenum;
     117              : 
     118              : /* Column number of last NOTE.  */
     119              : static int last_columnnum;
     120              : 
     121              : /* Discriminator written to assembly.  */
     122              : static int last_discriminator;
     123              : 
     124              : /* Compute discriminator to be written to assembly for current instruction.
     125              :    Note: actual usage depends on loc_discriminator_kind setting.  */
     126              : static inline int compute_discriminator (location_t loc);
     127              : 
     128              : /* Highest line number in current block.  */
     129              : static int high_block_linenum;
     130              : 
     131              : /* Likewise for function.  */
     132              : static int high_function_linenum;
     133              : 
     134              : /* Filename of last NOTE.  */
     135              : static const char *last_filename;
     136              : 
     137              : /* Whether to force emission of a line note before the next insn.  */
     138              : static bool force_source_line = false;
     139              : 
     140              : extern const int length_unit_log; /* Defined in generated attribute code.  */
     141              : 
     142              : /* Nonzero while outputting an `asm' with operands.
     143              :    This means that inconsistencies are the user's fault, so don't die.
     144              :    The precise value is the insn being output, to pass to error_for_asm.  */
     145              : const rtx_insn *this_is_asm_operands;
     146              : 
     147              : /* Number of operands of this insn, for an `asm' with operands.  */
     148              : unsigned int insn_noperands;
     149              : 
     150              : /* Compare optimization flag.  */
     151              : 
     152              : static rtx last_ignored_compare = 0;
     153              : 
     154              : /* Assign a unique number to each insn that is output.
     155              :    This can be used to generate unique local labels.  */
     156              : 
     157              : static int insn_counter = 0;
     158              : 
     159              : /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
     160              : 
     161              : static int block_depth;
     162              : 
     163              : /* True if have enabled APP processing of our assembler output.  */
     164              : 
     165              : static bool app_on;
     166              : 
     167              : /* If we are outputting an insn sequence, this contains the sequence rtx.
     168              :    Zero otherwise.  */
     169              : 
     170              : rtx_sequence *final_sequence;
     171              : 
     172              : #ifdef ASSEMBLER_DIALECT
     173              : 
     174              : /* Number of the assembler dialect to use, starting at 0.  */
     175              : static int dialect_number;
     176              : #endif
     177              : 
     178              : /* Nonnull if the insn currently being emitted was a COND_EXEC pattern.  */
     179              : rtx current_insn_predicate;
     180              : 
     181              : /* True if printing into -fdump-final-insns= dump.  */
     182              : bool final_insns_dump_p;
     183              : 
     184              : /* True if profile_function should be called, but hasn't been called yet.  */
     185              : static bool need_profile_function;
     186              : 
     187              : static int asm_insn_count (rtx);
     188              : static void profile_function (FILE *);
     189              : static void profile_after_prologue (FILE *);
     190              : static bool notice_source_line (rtx_insn *, bool *);
     191              : static rtx walk_alter_subreg (rtx *, bool *);
     192              : static void output_asm_name (void);
     193              : static void output_alternate_entry_point (FILE *, rtx_insn *);
     194              : static tree get_mem_expr_from_op (rtx, int *);
     195              : static void output_asm_operand_names (rtx *, int *, int);
     196              : #ifdef LEAF_REGISTERS
     197              : static void leaf_renumber_regs (rtx_insn *);
     198              : #endif
     199              : static int align_fuzz (rtx_insn *, rtx_insn *, int, unsigned);
     200              : static void collect_fn_hard_reg_usage (void);
     201              : 
     202              : /* Initialize data in final at the beginning of a compilation.  */
     203              : 
     204              : void
     205       289638 : init_final (const char *filename ATTRIBUTE_UNUSED)
     206              : {
     207       289638 :   app_on = 0;
     208       289638 :   final_sequence = 0;
     209              : 
     210              : #ifdef ASSEMBLER_DIALECT
     211       289638 :   dialect_number = ASSEMBLER_DIALECT;
     212              : #endif
     213       289638 : }
     214              : 
     215              : /* Default target function prologue and epilogue assembler output.
     216              : 
     217              :    If not overridden for epilogue code, then the function body itself
     218              :    contains return instructions wherever needed.  */
     219              : void
     220      1522701 : default_function_pro_epilogue (FILE *)
     221              : {
     222      1522701 : }
     223              : 
     224              : void
     225        65368 : default_function_switched_text_sections (FILE *file ATTRIBUTE_UNUSED,
     226              :                                          tree decl ATTRIBUTE_UNUSED,
     227              :                                          bool new_is_cold ATTRIBUTE_UNUSED)
     228              : {
     229        65368 : }
     230              : 
     231              : /* Default target hook that outputs nothing to a stream.  */
     232              : void
     233      3138346 : no_asm_to_stream (FILE *file ATTRIBUTE_UNUSED)
     234              : {
     235      3138346 : }
     236              : 
     237              : /* Enable APP processing of subsequent output.
     238              :    Used before the output from an `asm' statement.  */
     239              : 
     240              : void
     241        33789 : app_enable (void)
     242              : {
     243        33789 :   if (! app_on)
     244              :     {
     245        30524 :       fputs (ASM_APP_ON, asm_out_file);
     246        30524 :       app_on = 1;
     247              :     }
     248        33789 : }
     249              : 
     250              : /* Disable APP processing of subsequent output.
     251              :    Called from varasm.cc before most kinds of output.  */
     252              : 
     253              : void
     254    158251668 : app_disable (void)
     255              : {
     256    158251668 :   if (app_on)
     257              :     {
     258        29424 :       fputs (ASM_APP_OFF, asm_out_file);
     259        29424 :       app_on = 0;
     260              :     }
     261    158251668 : }
     262              : 
     263              : /* Return the number of slots filled in the current
     264              :    delayed branch sequence (we don't count the insn needing the
     265              :    delay slot).   Zero if not in a delayed branch sequence.  */
     266              : 
     267              : int
     268            0 : dbr_sequence_length (void)
     269              : {
     270            0 :   if (final_sequence != 0)
     271            0 :     return final_sequence->len () - 1;
     272              :   else
     273              :     return 0;
     274              : }
     275              : 
     276              : /* The next two pages contain routines used to compute the length of an insn
     277              :    and to shorten branches.  */
     278              : 
     279              : /* Arrays for insn lengths, and addresses.  The latter is referenced by
     280              :    `insn_current_length'.  */
     281              : 
     282              : static int *insn_lengths;
     283              : 
     284              : vec<int> insn_addresses_;
     285              : 
     286              : /* Max uid for which the above arrays are valid.  */
     287              : static int insn_lengths_max_uid;
     288              : 
     289              : /* Address of insn being processed.  Used by `insn_current_length'.  */
     290              : int insn_current_address;
     291              : 
     292              : /* Address of insn being processed in previous iteration.  */
     293              : int insn_last_address;
     294              : 
     295              : /* known invariant alignment of insn being processed.  */
     296              : int insn_current_align;
     297              : 
     298              : /* After shorten_branches, for any insn, uid_align[INSN_UID (insn)]
     299              :    gives the next following alignment insn that increases the known
     300              :    alignment, or NULL_RTX if there is no such insn.
     301              :    For any alignment obtained this way, we can again index uid_align with
     302              :    its uid to obtain the next following align that in turn increases the
     303              :    alignment, till we reach NULL_RTX; the sequence obtained this way
     304              :    for each insn we'll call the alignment chain of this insn in the following
     305              :    comments.  */
     306              : 
     307              : static rtx_insn **uid_align;
     308              : static int *uid_shuid;
     309              : static vec<align_flags> label_align;
     310              : 
     311              : /* Indicate that branch shortening hasn't yet been done.  */
     312              : 
     313              : void
     314      1523516 : init_insn_lengths (void)
     315              : {
     316      1523516 :   if (uid_shuid)
     317              :     {
     318      1519032 :       free (uid_shuid);
     319      1519032 :       uid_shuid = 0;
     320              :     }
     321      1523516 :   if (insn_lengths)
     322              :     {
     323      1519032 :       free (insn_lengths);
     324      1519032 :       insn_lengths = 0;
     325      1519032 :       insn_lengths_max_uid = 0;
     326              :     }
     327      1523516 :   if (HAVE_ATTR_length)
     328      1523516 :     INSN_ADDRESSES_FREE ();
     329      1523516 :   if (uid_align)
     330              :     {
     331      1519032 :       free (uid_align);
     332      1519032 :       uid_align = 0;
     333              :     }
     334      1523516 : }
     335              : 
     336              : /* Obtain the current length of an insn.  If branch shortening has been done,
     337              :    get its actual length.  Otherwise, use FALLBACK_FN to calculate the
     338              :    length.  */
     339              : static int
     340    409770433 : get_attr_length_1 (rtx_insn *insn, int (*fallback_fn) (rtx_insn *))
     341              : {
     342    409770433 :   rtx body;
     343    409770433 :   int i;
     344    409770433 :   int length = 0;
     345              : 
     346    409770433 :   if (!HAVE_ATTR_length)
     347              :     return 0;
     348              : 
     349    409770433 :   if (insn_lengths_max_uid > INSN_UID (insn))
     350         3382 :     return insn_lengths[INSN_UID (insn)];
     351              :   else
     352    409767051 :     switch (GET_CODE (insn))
     353              :       {
     354              :       case NOTE:
     355              :       case BARRIER:
     356              :       case CODE_LABEL:
     357              :       case DEBUG_INSN:
     358              :         return 0;
     359              : 
     360      9813257 :       case CALL_INSN:
     361      9813257 :       case JUMP_INSN:
     362      9813257 :         body = PATTERN (insn);
     363      9813257 :         if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
     364          173 :           length = asm_insn_count (body) * fallback_fn (insn);
     365              :         else
     366      9813084 :           length = fallback_fn (insn);
     367              :         break;
     368              : 
     369    388454022 :       case INSN:
     370    388454022 :         body = PATTERN (insn);
     371    388454022 :         if (GET_CODE (body) == USE || GET_CODE (body) == CLOBBER)
     372              :           return 0;
     373              : 
     374    388110172 :         else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
     375         7893 :           length = asm_insn_count (body) * fallback_fn (insn);
     376    388102279 :         else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (body))
     377            0 :           for (i = 0; i < seq->len (); i++)
     378            0 :             length += get_attr_length_1 (seq->insn (i), fallback_fn);
     379              :         else
     380    388102279 :           length = fallback_fn (insn);
     381              :         break;
     382              : 
     383              :       default:
     384              :         break;
     385              :       }
     386              : 
     387              : #ifdef ADJUST_INSN_LENGTH
     388              :   ADJUST_INSN_LENGTH (insn, length);
     389              : #endif
     390              :   return length;
     391              : }
     392              : 
     393              : /* Obtain the current length of an insn.  If branch shortening has been done,
     394              :    get its actual length.  Otherwise, get its maximum length.  */
     395              : int
     396    390603825 : get_attr_length (rtx_insn *insn)
     397              : {
     398    390603825 :   return get_attr_length_1 (insn, insn_default_length);
     399              : }
     400              : 
     401              : /* Obtain the current length of an insn.  If branch shortening has been done,
     402              :    get its actual length.  Otherwise, get its minimum length.  */
     403              : int
     404     19166608 : get_attr_min_length (rtx_insn *insn)
     405              : {
     406     19166608 :   return get_attr_length_1 (insn, insn_min_length);
     407              : }
     408              : 
     409              : /* Code to handle alignment inside shorten_branches.  */
     410              : 
     411              : /* Here is an explanation how the algorithm in align_fuzz can give
     412              :    proper results:
     413              : 
     414              :    Call a sequence of instructions beginning with alignment point X
     415              :    and continuing until the next alignment point `block X'.  When `X'
     416              :    is used in an expression, it means the alignment value of the
     417              :    alignment point.
     418              : 
     419              :    Call the distance between the start of the first insn of block X, and
     420              :    the end of the last insn of block X `IX', for the `inner size of X'.
     421              :    This is clearly the sum of the instruction lengths.
     422              : 
     423              :    Likewise with the next alignment-delimited block following X, which we
     424              :    shall call block Y.
     425              : 
     426              :    Call the distance between the start of the first insn of block X, and
     427              :    the start of the first insn of block Y `OX', for the `outer size of X'.
     428              : 
     429              :    The estimated padding is then OX - IX.
     430              : 
     431              :    OX can be safely estimated as
     432              : 
     433              :            if (X >= Y)
     434              :                    OX = round_up(IX, Y)
     435              :            else
     436              :                    OX = round_up(IX, X) + Y - X
     437              : 
     438              :    Clearly est(IX) >= real(IX), because that only depends on the
     439              :    instruction lengths, and those being overestimated is a given.
     440              : 
     441              :    Clearly round_up(foo, Z) >= round_up(bar, Z) if foo >= bar, so
     442              :    we needn't worry about that when thinking about OX.
     443              : 
     444              :    When X >= Y, the alignment provided by Y adds no uncertainty factor
     445              :    for branch ranges starting before X, so we can just round what we have.
     446              :    But when X < Y, we don't know anything about the, so to speak,
     447              :    `middle bits', so we have to assume the worst when aligning up from an
     448              :    address mod X to one mod Y, which is Y - X.  */
     449              : 
     450              : #ifndef LABEL_ALIGN
     451              : #define LABEL_ALIGN(LABEL) align_labels
     452              : #endif
     453              : 
     454              : #ifndef LOOP_ALIGN
     455              : #define LOOP_ALIGN(LABEL) align_loops
     456              : #endif
     457              : 
     458              : #ifndef LABEL_ALIGN_AFTER_BARRIER
     459              : #define LABEL_ALIGN_AFTER_BARRIER(LABEL) 0
     460              : #endif
     461              : 
     462              : #ifndef JUMP_ALIGN
     463              : #define JUMP_ALIGN(LABEL) align_jumps
     464              : #endif
     465              : 
     466              : #ifndef ADDR_VEC_ALIGN
     467              : static int
     468         7467 : final_addr_vec_align (rtx_jump_table_data *addr_vec)
     469              : {
     470         7467 :   int align = GET_MODE_SIZE (addr_vec->get_data_mode ());
     471              : 
     472        14839 :   if (align > BIGGEST_ALIGNMENT / BITS_PER_UNIT)
     473            0 :     align = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
     474         7467 :   return exact_log2 (align);
     475              : 
     476              : }
     477              : 
     478              : #define ADDR_VEC_ALIGN(ADDR_VEC) final_addr_vec_align (ADDR_VEC)
     479              : #endif
     480              : 
     481              : #ifndef INSN_LENGTH_ALIGNMENT
     482              : #define INSN_LENGTH_ALIGNMENT(INSN) length_unit_log
     483              : #endif
     484              : 
     485              : #define INSN_SHUID(INSN) (uid_shuid[INSN_UID (INSN)])
     486              : 
     487              : static int min_labelno, max_labelno;
     488              : 
     489              : #define LABEL_TO_ALIGNMENT(LABEL) \
     490              :   (label_align[CODE_LABEL_NUMBER (LABEL) - min_labelno])
     491              : 
     492              : /* For the benefit of port specific code do this also as a function.  */
     493              : 
     494              : align_flags
     495          942 : label_to_alignment (rtx_insn *label)
     496              : {
     497          942 :   if (CODE_LABEL_NUMBER (label) <= max_labelno)
     498          942 :     return LABEL_TO_ALIGNMENT (label);
     499            0 :   return align_flags ();
     500              : }
     501              : 
     502              : /* The differences in addresses
     503              :    between a branch and its target might grow or shrink depending on
     504              :    the alignment the start insn of the range (the branch for a forward
     505              :    branch or the label for a backward branch) starts out on; if these
     506              :    differences are used naively, they can even oscillate infinitely.
     507              :    We therefore want to compute a 'worst case' address difference that
     508              :    is independent of the alignment the start insn of the range end
     509              :    up on, and that is at least as large as the actual difference.
     510              :    The function align_fuzz calculates the amount we have to add to the
     511              :    naively computed difference, by traversing the part of the alignment
     512              :    chain of the start insn of the range that is in front of the end insn
     513              :    of the range, and considering for each alignment the maximum amount
     514              :    that it might contribute to a size increase.
     515              : 
     516              :    For casesi tables, we also want to know worst case minimum amounts of
     517              :    address difference, in case a machine description wants to introduce
     518              :    some common offset that is added to all offsets in a table.
     519              :    For this purpose, align_fuzz with a growth argument of 0 computes the
     520              :    appropriate adjustment.  */
     521              : 
     522              : /* Compute the maximum delta by which the difference of the addresses of
     523              :    START and END might grow / shrink due to a different address for start
     524              :    which changes the size of alignment insns between START and END.
     525              :    KNOWN_ALIGN_LOG is the alignment known for START.
     526              :    GROWTH should be ~0 if the objective is to compute potential code size
     527              :    increase, and 0 if the objective is to compute potential shrink.
     528              :    The return value is undefined for any other value of GROWTH.  */
     529              : 
     530              : static int
     531     28715523 : align_fuzz (rtx_insn *start, rtx_insn *end, int known_align_log,
     532              :             unsigned int growth)
     533              : {
     534     28715523 :   int uid = INSN_UID (start);
     535     28715523 :   rtx_insn *align_label;
     536     28715523 :   int known_align = 1 << known_align_log;
     537     28715523 :   int end_shuid = INSN_SHUID (end);
     538     28715523 :   int fuzz = 0;
     539              : 
     540     42163937 :   for (align_label = uid_align[uid]; align_label; align_label = uid_align[uid])
     541              :     {
     542     16287957 :       int align_addr, new_align;
     543              : 
     544     16287957 :       uid = INSN_UID (align_label);
     545     16287957 :       align_addr = INSN_ADDRESSES (uid) - insn_lengths[uid];
     546     16287957 :       if (uid_shuid[uid] > end_shuid)
     547              :         break;
     548     13448414 :       align_flags alignment = LABEL_TO_ALIGNMENT (align_label);
     549     13448414 :       new_align = 1 << alignment.levels[0].log;
     550     13448414 :       if (new_align < known_align)
     551            0 :         continue;
     552     13448414 :       fuzz += (-align_addr ^ growth) & (new_align - known_align);
     553     13448414 :       known_align = new_align;
     554              :     }
     555     28715523 :   return fuzz;
     556              : }
     557              : 
     558              : /* Compute a worst-case reference address of a branch so that it
     559              :    can be safely used in the presence of aligned labels.  Since the
     560              :    size of the branch itself is unknown, the size of the branch is
     561              :    not included in the range.  I.e. for a forward branch, the reference
     562              :    address is the end address of the branch as known from the previous
     563              :    branch shortening pass, minus a value to account for possible size
     564              :    increase due to alignment.  For a backward branch, it is the start
     565              :    address of the branch as known from the current pass, plus a value
     566              :    to account for possible size increase due to alignment.
     567              :    NB.: Therefore, the maximum offset allowed for backward branches needs
     568              :    to exclude the branch size.  */
     569              : 
     570              : int
     571     28715523 : insn_current_reference_address (rtx_insn *branch)
     572              : {
     573     28715523 :   int seq_uid;
     574              : 
     575     28715523 :   if (! INSN_ADDRESSES_SET_P ())
     576              :     return 0;
     577              : 
     578     28715523 :   rtx_insn *seq = NEXT_INSN (PREV_INSN (branch));
     579     28715523 :   seq_uid = INSN_UID (seq);
     580     28715523 :   if (!jump_to_label_p (branch))
     581              :     /* This can happen for example on the PA; the objective is to know the
     582              :        offset to address something in front of the start of the function.
     583              :        Thus, we can treat it like a backward branch.
     584              :        We assume here that FUNCTION_BOUNDARY / BITS_PER_UNIT is larger than
     585              :        any alignment we'd encounter, so we skip the call to align_fuzz.  */
     586            0 :     return insn_current_address;
     587     28715523 :   rtx_insn *dest = as_a<rtx_insn *> (JUMP_LABEL (branch));
     588              : 
     589              :   /* BRANCH has no proper alignment chain set, so use SEQ.
     590              :      BRANCH also has no INSN_SHUID.  */
     591     28715523 :   if (INSN_SHUID (seq) < INSN_SHUID (dest))
     592              :     {
     593              :       /* Forward branch.  */
     594     20721694 :       return (insn_last_address + insn_lengths[seq_uid]
     595     20721694 :               - align_fuzz (seq, dest, length_unit_log, ~0));
     596              :     }
     597              :   else
     598              :     {
     599              :       /* Backward branch.  */
     600      7993829 :       return (insn_current_address
     601      7993829 :               + align_fuzz (dest, seq, length_unit_log, ~0));
     602              :     }
     603              : }
     604              : 
     605              : /* Compute branch alignments based on CFG profile.  */
     606              : 
     607              : void
     608      1517128 : compute_alignments (void)
     609              : {
     610      1517128 :   basic_block bb;
     611      1517128 :   align_flags max_alignment;
     612              : 
     613      1517128 :   label_align.truncate (0);
     614              : 
     615      1517128 :   max_labelno = max_label_num ();
     616      1517128 :   min_labelno = get_first_label_num ();
     617      1517128 :   label_align.safe_grow_cleared (max_labelno - min_labelno + 1, true);
     618              : 
     619              :   /* If not optimizing or optimizing for size, don't assign any alignments.  */
     620      1517128 :   if (! optimize || optimize_function_for_size_p (cfun))
     621       518919 :     return;
     622              : 
     623       998209 :   if (dump_file)
     624              :     {
     625           33 :       dump_reg_info (dump_file);
     626           33 :       dump_flow_info (dump_file, TDF_DETAILS);
     627           33 :       flow_loops_dump (dump_file, NULL, 1);
     628              :     }
     629       998209 :   loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
     630       998209 :   profile_count count_threshold = cfun->cfg->count_max / param_align_threshold;
     631              : 
     632       998209 :   if (dump_file)
     633              :     {
     634           33 :       fprintf (dump_file, "count_max: ");
     635           33 :       cfun->cfg->count_max.dump (dump_file);
     636           33 :       fprintf (dump_file, "\n");
     637              :     }
     638     11761936 :   FOR_EACH_BB_FN (bb, cfun)
     639              :     {
     640     10763727 :       rtx_insn *label = BB_HEAD (bb);
     641     10763727 :       bool has_fallthru = 0;
     642     10763727 :       edge e;
     643     10763727 :       edge_iterator ei;
     644              : 
     645     17701126 :       if (!LABEL_P (label)
     646     10763727 :           || optimize_bb_for_size_p (bb))
     647              :         {
     648      6937399 :           if (dump_file)
     649          130 :             fprintf (dump_file,
     650              :                      "BB %4i loop %2i loop_depth %2i skipped.\n",
     651              :                      bb->index,
     652          130 :                      bb->loop_father->num,
     653              :                      bb_loop_depth (bb));
     654      6938969 :           continue;
     655              :         }
     656      3826328 :       max_alignment = LABEL_ALIGN (label);
     657      3826328 :       profile_count fallthru_count = profile_count::zero ();
     658      3826328 :       profile_count branch_count = profile_count::zero ();
     659              : 
     660     11171626 :       FOR_EACH_EDGE (e, ei, bb->preds)
     661              :         {
     662      7345298 :           if (e->flags & EDGE_FALLTHRU)
     663      2334047 :             has_fallthru = 1, fallthru_count += e->count ();
     664              :           else
     665      5011251 :             branch_count += e->count ();
     666              :         }
     667      3826328 :       if (dump_file)
     668              :         {
     669          119 :           fprintf (dump_file, "BB %4i loop %2i loop_depth"
     670              :                    " %2i fall ",
     671          119 :                    bb->index, bb->loop_father->num,
     672              :                    bb_loop_depth (bb));
     673          119 :           fallthru_count.dump (dump_file);
     674          119 :           fprintf (dump_file, " branch ");
     675          119 :           branch_count.dump (dump_file);
     676          119 :           if (!bb->loop_father->inner && bb->loop_father->num)
     677           20 :             fprintf (dump_file, " inner_loop");
     678          119 :           if (bb->loop_father->header == bb)
     679           18 :             fprintf (dump_file, " loop_header");
     680          119 :           fprintf (dump_file, "\n");
     681              :         }
     682      3826328 :       if (!fallthru_count.initialized_p () || !branch_count.initialized_p ())
     683         1570 :         continue;
     684              : 
     685              :       /* There are two purposes to align block with no fallthru incoming edge:
     686              :          1) to avoid fetch stalls when branch destination is near cache boundary
     687              :          2) to improve cache efficiency in case the previous block is not executed
     688              :             (so it does not need to be in the cache).
     689              : 
     690              :          We to catch first case, we align frequently executed blocks.
     691              :          To catch the second, we align blocks that are executed more frequently
     692              :          than the predecessor and the predecessor is likely to not be executed
     693              :          when function is called.  */
     694              : 
     695      3824758 :       if (!has_fallthru
     696      3824758 :           && (branch_count > count_threshold
     697       427217 :               || (bb->count > bb->prev_bb->count * 10
     698        26963 :                   && (bb->prev_bb->count
     699      3851721 :                       <= ENTRY_BLOCK_PTR_FOR_FN (cfun)->count / 2))))
     700              :         {
     701      1091150 :           align_flags alignment = JUMP_ALIGN (label);
     702      1091150 :           if (dump_file)
     703           38 :             fprintf (dump_file, "  jump alignment added.\n");
     704      1091150 :           max_alignment = align_flags::max (max_alignment, alignment);
     705              :         }
     706              :       /* In case block is frequent and reached mostly by non-fallthru edge,
     707              :          align it.  It is most likely a first block of loop.  */
     708      3824758 :       if (has_fallthru
     709      2332911 :           && !(single_succ_p (bb)
     710       804885 :                && single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun))
     711      1985718 :           && optimize_bb_for_speed_p (bb)
     712      1985718 :           && branch_count + fallthru_count > count_threshold
     713      6157671 :           && (branch_count > fallthru_count * param_align_loop_iterations))
     714              :         {
     715       303842 :           align_flags alignment = LOOP_ALIGN (label);
     716       303842 :           if (dump_file)
     717           11 :             fprintf (dump_file, "  internal loop alignment added.\n");
     718       303842 :           max_alignment = align_flags::max (max_alignment, alignment);
     719              :         }
     720      3824758 :       LABEL_TO_ALIGNMENT (label) = max_alignment;
     721              :     }
     722              : 
     723       998209 :   loop_optimizer_finalize ();
     724       998209 :   free_dominance_info (CDI_DOMINATORS);
     725              : }
     726              : 
     727              : /* Grow the LABEL_ALIGN array after new labels are created.  */
     728              : 
     729              : static void
     730            3 : grow_label_align (void)
     731              : {
     732            3 :   int old = max_labelno;
     733            3 :   int n_labels;
     734            3 :   int n_old_labels;
     735              : 
     736            3 :   max_labelno = max_label_num ();
     737              : 
     738            3 :   n_labels = max_labelno - min_labelno + 1;
     739            3 :   n_old_labels = old - min_labelno + 1;
     740              : 
     741            3 :   label_align.safe_grow_cleared (n_labels, true);
     742              : 
     743              :   /* Range of labels grows monotonically in the function.  Failing here
     744              :      means that the initialization of array got lost.  */
     745            3 :   gcc_assert (n_old_labels <= n_labels);
     746            3 : }
     747              : 
     748              : /* Update the already computed alignment information.  LABEL_PAIRS is a vector
     749              :    made up of pairs of labels for which the alignment information of the first
     750              :    element will be copied from that of the second element.  */
     751              : 
     752              : void
     753            0 : update_alignments (vec<rtx> &label_pairs)
     754              : {
     755            0 :   unsigned int i = 0;
     756            0 :   rtx iter, label = NULL_RTX;
     757              : 
     758            0 :   if (max_labelno != max_label_num ())
     759            0 :     grow_label_align ();
     760              : 
     761            0 :   FOR_EACH_VEC_ELT (label_pairs, i, iter)
     762            0 :     if (i & 1)
     763            0 :       LABEL_TO_ALIGNMENT (label) = LABEL_TO_ALIGNMENT (iter);
     764              :     else
     765              :       label = iter;
     766            0 : }
     767              : 
     768              : namespace {
     769              : 
     770              : const pass_data pass_data_compute_alignments =
     771              : {
     772              :   RTL_PASS, /* type */
     773              :   "alignments", /* name */
     774              :   OPTGROUP_NONE, /* optinfo_flags */
     775              :   TV_NONE, /* tv_id */
     776              :   0, /* properties_required */
     777              :   0, /* properties_provided */
     778              :   0, /* properties_destroyed */
     779              :   0, /* todo_flags_start */
     780              :   0, /* todo_flags_finish */
     781              : };
     782              : 
     783              : class pass_compute_alignments : public rtl_opt_pass
     784              : {
     785              : public:
     786       297180 :   pass_compute_alignments (gcc::context *ctxt)
     787       594360 :     : rtl_opt_pass (pass_data_compute_alignments, ctxt)
     788              :   {}
     789              : 
     790              :   /* opt_pass methods: */
     791      1517128 :   unsigned int execute (function *) final override
     792              :   {
     793      1517128 :     compute_alignments ();
     794      1517128 :     return 0;
     795              :   }
     796              : 
     797              : }; // class pass_compute_alignments
     798              : 
     799              : } // anon namespace
     800              : 
     801              : rtl_opt_pass *
     802       297180 : make_pass_compute_alignments (gcc::context *ctxt)
     803              : {
     804       297180 :   return new pass_compute_alignments (ctxt);
     805              : }
     806              : 
     807              : 
     808              : /* Make a pass over all insns and compute their actual lengths by shortening
     809              :    any branches of variable length if possible.  */
     810              : 
     811              : /* shorten_branches might be called multiple times:  for example, the SH
     812              :    port splits out-of-range conditional branches in MACHINE_DEPENDENT_REORG.
     813              :    In order to do this, it needs proper length information, which it obtains
     814              :    by calling shorten_branches.  This cannot be collapsed with
     815              :    shorten_branches itself into a single pass unless we also want to integrate
     816              :    reorg.cc, since the branch splitting exposes new instructions with delay
     817              :    slots.  */
     818              : 
     819              : void
     820      1519032 : shorten_branches (rtx_insn *first)
     821              : {
     822      1519032 :   rtx_insn *insn;
     823      1519032 :   int max_uid;
     824      1519032 :   int i;
     825      1519032 :   rtx_insn *seq;
     826      1519032 :   bool something_changed = true;
     827      1519032 :   char *varying_length;
     828      1519032 :   rtx body;
     829      1519032 :   int uid;
     830      1519032 :   rtx_insn *align_tab[MAX_CODE_ALIGN + 1];
     831              : 
     832              :   /* Compute maximum UID and allocate label_align / uid_shuid.  */
     833      1519032 :   max_uid = get_max_uid ();
     834              : 
     835              :   /* Free uid_shuid before reallocating it.  */
     836      1519032 :   free (uid_shuid);
     837              : 
     838      1519032 :   uid_shuid = XNEWVEC (int, max_uid);
     839              : 
     840      1519032 :   if (max_labelno != max_label_num ())
     841            3 :     grow_label_align ();
     842              : 
     843              :   /* Initialize label_align and set up uid_shuid to be strictly
     844              :      monotonically rising with insn order.  */
     845              :   /* We use alignment here to keep track of the maximum alignment we want to
     846              :      impose on the next CODE_LABEL (or the current one if we are processing
     847              :      the CODE_LABEL itself).  */
     848              : 
     849      1519032 :   align_flags max_alignment;
     850              : 
     851    216254826 :   for (insn = get_insns (), i = 1; insn; insn = NEXT_INSN (insn))
     852              :     {
     853    214735794 :       INSN_SHUID (insn) = i++;
     854    214735794 :       if (INSN_P (insn))
     855     96006875 :         continue;
     856              : 
     857    118728919 :       if (rtx_code_label *label = dyn_cast <rtx_code_label *> (insn))
     858              :         {
     859              :           /* Merge in alignments computed by compute_alignments.  */
     860      7011932 :           align_flags alignment = LABEL_TO_ALIGNMENT (label);
     861      7011932 :           max_alignment = align_flags::max (max_alignment, alignment);
     862              : 
     863      7011932 :           rtx_jump_table_data *table = jump_table_for_label (label);
     864      7011932 :           if (!table)
     865              :             {
     866      7004465 :               align_flags alignment = LABEL_ALIGN (label);
     867      7004465 :               max_alignment = align_flags::max (max_alignment, alignment);
     868              :             }
     869              :           /* ADDR_VECs only take room if read-only data goes into the text
     870              :              section.  */
     871      7011932 :           if ((JUMP_TABLES_IN_TEXT_SECTION
     872      7011932 :                || readonly_data_section == text_section)
     873            0 :               && table)
     874              :             {
     875            0 :               align_flags alignment = align_flags (ADDR_VEC_ALIGN (table));
     876            0 :               max_alignment = align_flags::max (max_alignment, alignment);
     877              :             }
     878      7011932 :           LABEL_TO_ALIGNMENT (label) = max_alignment;
     879      7011932 :           max_alignment = align_flags ();
     880              :         }
     881    111716987 :       else if (BARRIER_P (insn))
     882              :         {
     883              :           rtx_insn *label;
     884              : 
     885     28709221 :           for (label = insn; label && ! INSN_P (label);
     886     23837579 :                label = NEXT_INSN (label))
     887     27136167 :             if (LABEL_P (label))
     888              :               {
     889      3298588 :                 align_flags alignment
     890      3298588 :                   = align_flags (LABEL_ALIGN_AFTER_BARRIER (insn));
     891      3298588 :                 max_alignment = align_flags::max (max_alignment, alignment);
     892      3298588 :                 break;
     893              :               }
     894              :         }
     895              :     }
     896      1519032 :   if (!HAVE_ATTR_length)
     897              :     return;
     898              : 
     899              :   /* Allocate the rest of the arrays.  */
     900      1519032 :   insn_lengths = XNEWVEC (int, max_uid);
     901      1519032 :   insn_lengths_max_uid = max_uid;
     902              :   /* Syntax errors can lead to labels being outside of the main insn stream.
     903              :      Initialize insn_addresses, so that we get reproducible results.  */
     904      1519032 :   INSN_ADDRESSES_ALLOC (max_uid);
     905              : 
     906      1519032 :   varying_length = XCNEWVEC (char, max_uid);
     907              : 
     908              :   /* Initialize uid_align.  We scan instructions
     909              :      from end to start, and keep in align_tab[n] the last seen insn
     910              :      that does an alignment of at least n+1, i.e. the successor
     911              :      in the alignment chain for an insn that does / has a known
     912              :      alignment of n.  */
     913      1519032 :   uid_align = XCNEWVEC (rtx_insn *, max_uid);
     914              : 
     915     27342576 :   for (i = MAX_CODE_ALIGN + 1; --i >= 0;)
     916     25823544 :     align_tab[i] = nullptr;
     917      1519032 :   seq = get_last_insn ();
     918    216254826 :   for (; seq; seq = PREV_INSN (seq))
     919              :     {
     920    214735794 :       int uid = INSN_UID (seq);
     921    214735794 :       int log;
     922    214735794 :       log = (LABEL_P (seq) ? LABEL_TO_ALIGNMENT (seq).levels[0].log : 0);
     923    214735794 :       uid_align[uid] = align_tab[0];
     924    214735794 :       if (log)
     925              :         {
     926              :           /* Found an alignment label.  */
     927      1333602 :           gcc_checking_assert (log < MAX_CODE_ALIGN + 1);
     928      1333602 :           uid_align[uid] = align_tab[log];
     929      6668100 :           for (i = log - 1; i >= 0; i--)
     930      5334498 :             align_tab[i] = seq;
     931              :         }
     932              :     }
     933              : 
     934              :   /* When optimizing, we start assuming minimum length, and keep increasing
     935              :      lengths as we find the need for this, till nothing changes.
     936              :      When not optimizing, we start assuming maximum lengths, and
     937              :      do a single pass to update the lengths.  */
     938      1519032 :   bool increasing = optimize != 0;
     939              : 
     940              : #ifdef CASE_VECTOR_SHORTEN_MODE
     941              :   if (optimize)
     942              :     {
     943              :       /* Look for ADDR_DIFF_VECs, and initialize their minimum and maximum
     944              :          label fields.  */
     945              : 
     946              :       int min_shuid = INSN_SHUID (get_insns ()) - 1;
     947              :       int max_shuid = INSN_SHUID (get_last_insn ()) + 1;
     948              :       int rel;
     949              : 
     950              :       for (insn = first; insn != 0; insn = NEXT_INSN (insn))
     951              :         {
     952              :           rtx_insn *min_lab = nullptr, *max_lab = nullptr;
     953              :           rtx pat;
     954              :           int len, i, min, max, insn_shuid;
     955              :           int min_align;
     956              :           addr_diff_vec_flags flags;
     957              : 
     958              :           if (! JUMP_TABLE_DATA_P (insn)
     959              :               || GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC)
     960              :             continue;
     961              :           pat = PATTERN (insn);
     962              :           len = XVECLEN (pat, 1);
     963              :           gcc_assert (len > 0);
     964              :           min_align = MAX_CODE_ALIGN;
     965              :           for (min = max_shuid, max = min_shuid, i = len - 1; i >= 0; i--)
     966              :             {
     967              :               rtx_insn *lab = label_ref_label (XVECEXP (pat, 1, i));
     968              :               int shuid = INSN_SHUID (lab);
     969              :               if (shuid < min)
     970              :                 {
     971              :                   min = shuid;
     972              :                   min_lab = lab;
     973              :                 }
     974              :               if (shuid > max)
     975              :                 {
     976              :                   max = shuid;
     977              :                   max_lab = lab;
     978              :                 }
     979              : 
     980              :               int label_alignment = LABEL_TO_ALIGNMENT (lab).levels[0].log;
     981              :               if (min_align > label_alignment)
     982              :                 min_align = label_alignment;
     983              :             }
     984              :           XEXP (pat, 2) = gen_rtx_LABEL_REF (Pmode, min_lab);
     985              :           XEXP (pat, 3) = gen_rtx_LABEL_REF (Pmode, max_lab);
     986              :           insn_shuid = INSN_SHUID (insn);
     987              :           rel = INSN_SHUID (label_ref_label (XEXP (pat, 0)));
     988              :           memset (&flags, 0, sizeof (flags));
     989              :           flags.min_align = min_align;
     990              :           flags.base_after_vec = rel > insn_shuid;
     991              :           flags.min_after_vec  = min > insn_shuid;
     992              :           flags.max_after_vec  = max > insn_shuid;
     993              :           flags.min_after_base = min > rel;
     994              :           flags.max_after_base = max > rel;
     995              :           ADDR_DIFF_VEC_FLAGS (pat) = flags;
     996              : 
     997              :           if (increasing)
     998              :             PUT_MODE (pat, CASE_VECTOR_SHORTEN_MODE (0, 0, pat));
     999              :         }
    1000              :     }
    1001              : #endif /* CASE_VECTOR_SHORTEN_MODE */
    1002              : 
    1003              :   /* Compute initial lengths, addresses, and varying flags for each insn.  */
    1004      1519032 :   int (*length_fun) (rtx_insn *) = increasing ? insn_min_length : insn_default_length;
    1005              : 
    1006      1519032 :   for (insn_current_address = 0, insn = first;
    1007    216254826 :        insn != 0;
    1008    214735794 :        insn_current_address += insn_lengths[uid], insn = NEXT_INSN (insn))
    1009              :     {
    1010    214735794 :       uid = INSN_UID (insn);
    1011              : 
    1012    214735794 :       insn_lengths[uid] = 0;
    1013              : 
    1014    214735794 :       if (LABEL_P (insn))
    1015              :         {
    1016      7011932 :           int log = LABEL_TO_ALIGNMENT (insn).levels[0].log;
    1017      7011932 :           if (log)
    1018              :             {
    1019      1333602 :               int align = 1 << log;
    1020      1333602 :               int new_address = (insn_current_address + align - 1) & -align;
    1021      1333602 :               insn_lengths[uid] = new_address - insn_current_address;
    1022              :             }
    1023              :         }
    1024              : 
    1025    214735794 :       INSN_ADDRESSES (uid) = insn_current_address + insn_lengths[uid];
    1026              : 
    1027    214735794 :       if (NOTE_P (insn) || BARRIER_P (insn)
    1028    103026274 :           || LABEL_P (insn) || DEBUG_INSN_P (insn))
    1029    118721456 :         continue;
    1030     96014338 :       if (insn->deleted ())
    1031            0 :         continue;
    1032              : 
    1033     96014338 :       body = PATTERN (insn);
    1034     96014338 :       if (rtx_jump_table_data *table = dyn_cast <rtx_jump_table_data *> (insn))
    1035              :         {
    1036              :           /* This only takes room if read-only data goes into the text
    1037              :              section.  */
    1038         7467 :           if (JUMP_TABLES_IN_TEXT_SECTION
    1039         7467 :               || readonly_data_section == text_section)
    1040            0 :             insn_lengths[uid] = (XVECLEN (body,
    1041              :                                           GET_CODE (body) == ADDR_DIFF_VEC)
    1042            0 :                                  * GET_MODE_SIZE (table->get_data_mode ()));
    1043              :           /* Alignment is handled by ADDR_VEC_ALIGN.  */
    1044              :         }
    1045     96006871 :       else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
    1046        96260 :         insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
    1047     95910611 :       else if (rtx_sequence *body_seq = dyn_cast <rtx_sequence *> (body))
    1048              :         {
    1049              :           int i;
    1050              :           int const_delay_slots;
    1051              :           if (DELAY_SLOTS)
    1052              :             const_delay_slots = const_num_delay_slots (body_seq->insn (0));
    1053              :           else
    1054              :             const_delay_slots = 0;
    1055              : 
    1056              :           int (*inner_length_fun) (rtx_insn *)
    1057              :             = const_delay_slots ? length_fun : insn_default_length;
    1058              :           /* Inside a delay slot sequence, we do not do any branch shortening
    1059              :              if the shortening could change the number of delay slots
    1060              :              of the branch.  */
    1061            0 :           for (i = 0; i < body_seq->len (); i++)
    1062              :             {
    1063            0 :               rtx_insn *inner_insn = body_seq->insn (i);
    1064            0 :               int inner_uid = INSN_UID (inner_insn);
    1065            0 :               int inner_length;
    1066              : 
    1067            0 :               if (GET_CODE (PATTERN (inner_insn)) == ASM_INPUT
    1068            0 :                   || asm_noperands (PATTERN (inner_insn)) >= 0)
    1069            0 :                 inner_length = (asm_insn_count (PATTERN (inner_insn))
    1070            0 :                                 * insn_default_length (inner_insn));
    1071              :               else
    1072            0 :                 inner_length = inner_length_fun (inner_insn);
    1073              : 
    1074            0 :               insn_lengths[inner_uid] = inner_length;
    1075            0 :               if (const_delay_slots)
    1076              :                 {
    1077              :                   if ((varying_length[inner_uid]
    1078              :                        = insn_variable_length_p (inner_insn)) != 0)
    1079              :                     varying_length[uid] = 1;
    1080              :                   INSN_ADDRESSES (inner_uid) = (insn_current_address
    1081              :                                                 + insn_lengths[uid]);
    1082              :                 }
    1083              :               else
    1084            0 :                 varying_length[inner_uid] = 0;
    1085            0 :               insn_lengths[uid] += inner_length;
    1086              :             }
    1087              :         }
    1088     95910611 :       else if (GET_CODE (body) != USE && GET_CODE (body) != CLOBBER)
    1089              :         {
    1090     94841727 :           insn_lengths[uid] = length_fun (insn);
    1091     94841727 :           varying_length[uid] = insn_variable_length_p (insn);
    1092              :         }
    1093              : 
    1094              :       /* If needed, do any adjustment.  */
    1095              : #ifdef ADJUST_INSN_LENGTH
    1096              :       ADJUST_INSN_LENGTH (insn, insn_lengths[uid]);
    1097              :       if (insn_lengths[uid] < 0)
    1098              :         fatal_insn ("negative insn length", insn);
    1099              : #endif
    1100              :     }
    1101              : 
    1102              :   /* Now loop over all the insns finding varying length insns.  For each,
    1103              :      get the current insn length.  If it has changed, reflect the change.
    1104              :      When nothing changes for a full pass, we are done.  */
    1105              : 
    1106      2847056 :   while (something_changed)
    1107              :     {
    1108      1781970 :       something_changed = false;
    1109      1781970 :       insn_current_align = MAX_CODE_ALIGN - 1;
    1110    395161391 :       for (insn_current_address = 0, insn = first;
    1111    395161391 :            insn != 0;
    1112    393379421 :            insn = NEXT_INSN (insn))
    1113              :         {
    1114    393379421 :           int new_length;
    1115              : #ifdef ADJUST_INSN_LENGTH
    1116              :           int tmp_length;
    1117              : #endif
    1118    393379421 :           int length_align;
    1119              : 
    1120    393379421 :           uid = INSN_UID (insn);
    1121              : 
    1122    393379421 :           if (rtx_code_label *label = dyn_cast <rtx_code_label *> (insn))
    1123              :             {
    1124     12533934 :               int log = LABEL_TO_ALIGNMENT (label).levels[0].log;
    1125              : 
    1126              : #ifdef CASE_VECTOR_SHORTEN_MODE
    1127              :               /* If the mode of a following jump table was changed, we
    1128              :                  may need to update the alignment of this label.  */
    1129              : 
    1130              :               if (JUMP_TABLES_IN_TEXT_SECTION
    1131              :                   || readonly_data_section == text_section)
    1132              :                 {
    1133              :                   rtx_jump_table_data *table = jump_table_for_label (label);
    1134              :                   if (table)
    1135              :                     {
    1136              :                       int newlog = ADDR_VEC_ALIGN (table);
    1137              :                       if (newlog != log)
    1138              :                         {
    1139              :                           log = newlog;
    1140              :                           LABEL_TO_ALIGNMENT (insn) = log;
    1141              :                           something_changed = true;
    1142              :                         }
    1143              :                     }
    1144              :                 }
    1145              : #endif
    1146              : 
    1147     12533934 :               if (log > insn_current_align)
    1148              :                 {
    1149      2695262 :                   int align = 1 << log;
    1150      2695262 :                   int new_address= (insn_current_address + align - 1) & -align;
    1151      2695262 :                   insn_lengths[uid] = new_address - insn_current_address;
    1152      2695262 :                   insn_current_align = log;
    1153      2695262 :                   insn_current_address = new_address;
    1154              :                 }
    1155              :               else
    1156      9838672 :                 insn_lengths[uid] = 0;
    1157     12533934 :               INSN_ADDRESSES (uid) = insn_current_address;
    1158     12533934 :               continue;
    1159     12533934 :             }
    1160              : 
    1161    380845487 :           length_align = INSN_LENGTH_ALIGNMENT (insn);
    1162    380845487 :           if (length_align < insn_current_align)
    1163      4477232 :             insn_current_align = length_align;
    1164              : 
    1165    380845487 :           insn_last_address = INSN_ADDRESSES (uid);
    1166    380845487 :           INSN_ADDRESSES (uid) = insn_current_address;
    1167              : 
    1168              : #ifdef CASE_VECTOR_SHORTEN_MODE
    1169              :           if (optimize
    1170              :               && JUMP_TABLE_DATA_P (insn)
    1171              :               && GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
    1172              :             {
    1173              :               rtx_jump_table_data *table = as_a <rtx_jump_table_data *> (insn);
    1174              :               rtx body = PATTERN (insn);
    1175              :               int old_length = insn_lengths[uid];
    1176              :               rtx_insn *rel_lab =
    1177              :                 safe_as_a <rtx_insn *> (XEXP (XEXP (body, 0), 0));
    1178              :               rtx_insn *min_lab = label_ref_label (XEXP (body, 2));
    1179              :               rtx_insn *max_lab = label_ref_label (XEXP (body, 3));
    1180              :               int rel_addr = INSN_ADDRESSES (INSN_UID (rel_lab));
    1181              :               int min_addr = INSN_ADDRESSES (INSN_UID (min_lab));
    1182              :               int max_addr = INSN_ADDRESSES (INSN_UID (max_lab));
    1183              :               rtx_insn *prev;
    1184              :               int rel_align = 0;
    1185              :               addr_diff_vec_flags flags;
    1186              :               scalar_int_mode vec_mode;
    1187              : 
    1188              :               /* Avoid automatic aggregate initialization.  */
    1189              :               flags = ADDR_DIFF_VEC_FLAGS (body);
    1190              : 
    1191              :               /* Try to find a known alignment for rel_lab.  */
    1192              :               for (prev = rel_lab;
    1193              :                    prev
    1194              :                    && ! insn_lengths[INSN_UID (prev)]
    1195              :                    && ! (varying_length[INSN_UID (prev)] & 1);
    1196              :                    prev = PREV_INSN (prev))
    1197              :                 if (varying_length[INSN_UID (prev)] & 2)
    1198              :                   {
    1199              :                     rel_align = LABEL_TO_ALIGNMENT (prev).levels[0].log;
    1200              :                     break;
    1201              :                   }
    1202              : 
    1203              :               /* See the comment on addr_diff_vec_flags in rtl.h for the
    1204              :                  meaning of the flags values.  base: REL_LAB   vec: INSN  */
    1205              :               /* Anything after INSN has still addresses from the last
    1206              :                  pass; adjust these so that they reflect our current
    1207              :                  estimate for this pass.  */
    1208              :               if (flags.base_after_vec)
    1209              :                 rel_addr += insn_current_address - insn_last_address;
    1210              :               if (flags.min_after_vec)
    1211              :                 min_addr += insn_current_address - insn_last_address;
    1212              :               if (flags.max_after_vec)
    1213              :                 max_addr += insn_current_address - insn_last_address;
    1214              :               /* We want to know the worst case, i.e. lowest possible value
    1215              :                  for the offset of MIN_LAB.  If MIN_LAB is after REL_LAB,
    1216              :                  its offset is positive, and we have to be wary of code shrink;
    1217              :                  otherwise, it is negative, and we have to be vary of code
    1218              :                  size increase.  */
    1219              :               if (flags.min_after_base)
    1220              :                 {
    1221              :                   /* If INSN is between REL_LAB and MIN_LAB, the size
    1222              :                      changes we are about to make can change the alignment
    1223              :                      within the observed offset, therefore we have to break
    1224              :                      it up into two parts that are independent.  */
    1225              :                   if (! flags.base_after_vec && flags.min_after_vec)
    1226              :                     {
    1227              :                       min_addr -= align_fuzz (rel_lab, insn, rel_align, 0);
    1228              :                       min_addr -= align_fuzz (insn, min_lab, 0, 0);
    1229              :                     }
    1230              :                   else
    1231              :                     min_addr -= align_fuzz (rel_lab, min_lab, rel_align, 0);
    1232              :                 }
    1233              :               else
    1234              :                 {
    1235              :                   if (flags.base_after_vec && ! flags.min_after_vec)
    1236              :                     {
    1237              :                       min_addr -= align_fuzz (min_lab, insn, 0, ~0);
    1238              :                       min_addr -= align_fuzz (insn, rel_lab, 0, ~0);
    1239              :                     }
    1240              :                   else
    1241              :                     min_addr -= align_fuzz (min_lab, rel_lab, 0, ~0);
    1242              :                 }
    1243              :               /* Likewise, determine the highest lowest possible value
    1244              :                  for the offset of MAX_LAB.  */
    1245              :               if (flags.max_after_base)
    1246              :                 {
    1247              :                   if (! flags.base_after_vec && flags.max_after_vec)
    1248              :                     {
    1249              :                       max_addr += align_fuzz (rel_lab, insn, rel_align, ~0);
    1250              :                       max_addr += align_fuzz (insn, max_lab, 0, ~0);
    1251              :                     }
    1252              :                   else
    1253              :                     max_addr += align_fuzz (rel_lab, max_lab, rel_align, ~0);
    1254              :                 }
    1255              :               else
    1256              :                 {
    1257              :                   if (flags.base_after_vec && ! flags.max_after_vec)
    1258              :                     {
    1259              :                       max_addr += align_fuzz (max_lab, insn, 0, 0);
    1260              :                       max_addr += align_fuzz (insn, rel_lab, 0, 0);
    1261              :                     }
    1262              :                   else
    1263              :                     max_addr += align_fuzz (max_lab, rel_lab, 0, 0);
    1264              :                 }
    1265              :               vec_mode = CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr,
    1266              :                                                    max_addr - rel_addr, body);
    1267              :               if (!increasing
    1268              :                   || (GET_MODE_SIZE (vec_mode)
    1269              :                       >= GET_MODE_SIZE (table->get_data_mode ())))
    1270              :                 PUT_MODE (body, vec_mode);
    1271              :               if (JUMP_TABLES_IN_TEXT_SECTION
    1272              :                   || readonly_data_section == text_section)
    1273              :                 {
    1274              :                   insn_lengths[uid]
    1275              :                     = (XVECLEN (body, 1)
    1276              :                        * GET_MODE_SIZE (table->get_data_mode ()));
    1277              :                   insn_current_address += insn_lengths[uid];
    1278              :                   if (insn_lengths[uid] != old_length)
    1279              :                     something_changed = true;
    1280              :                 }
    1281              : 
    1282              :               continue;
    1283              :             }
    1284              : #endif /* CASE_VECTOR_SHORTEN_MODE */
    1285              : 
    1286    380845487 :           if (! (varying_length[uid]))
    1287              :             {
    1288    364569004 :               rtx_sequence *seq;
    1289    364569004 :               if (NONJUMP_INSN_P (insn)
    1290    364569004 :                   && (seq = dyn_cast<rtx_sequence *> (PATTERN (insn))))
    1291              :                 {
    1292            0 :                   for (int i = 0; i < seq->len (); i++)
    1293              :                     {
    1294            0 :                       rtx_insn *inner_insn = seq->insn (i);
    1295            0 :                       int inner_uid = INSN_UID (inner_insn);
    1296              : 
    1297            0 :                       INSN_ADDRESSES (inner_uid) = insn_current_address;
    1298              : 
    1299            0 :                       insn_current_address += insn_lengths[inner_uid];
    1300              :                     }
    1301              :                 }
    1302              :               else
    1303    364569004 :                 insn_current_address += insn_lengths[uid];
    1304              : 
    1305    364569004 :               continue;
    1306    364569004 :             }
    1307              : 
    1308     16276483 :           rtx_sequence *seqn;
    1309     16276483 :           if (NONJUMP_INSN_P (insn)
    1310     16276483 :               && (seqn = dyn_cast <rtx_sequence *> (PATTERN (insn))))
    1311              :             {
    1312              :               int i;
    1313              : 
    1314            0 :               body = PATTERN (insn);
    1315            0 :               new_length = 0;
    1316            0 :               for (i = 0; i < seqn->len (); i++)
    1317              :                 {
    1318            0 :                   rtx_insn *inner_insn = seqn->insn (i);
    1319            0 :                   int inner_uid = INSN_UID (inner_insn);
    1320            0 :                   int inner_length;
    1321              : 
    1322            0 :                   INSN_ADDRESSES (inner_uid) = insn_current_address;
    1323              : 
    1324              :                   /* insn_current_length returns 0 for insns with a
    1325              :                      non-varying length.  */
    1326            0 :                   if (! varying_length[inner_uid])
    1327            0 :                     inner_length = insn_lengths[inner_uid];
    1328              :                   else
    1329            0 :                     inner_length = insn_current_length (inner_insn);
    1330              : 
    1331            0 :                   if (inner_length != insn_lengths[inner_uid])
    1332              :                     {
    1333            0 :                       if (!increasing || inner_length > insn_lengths[inner_uid])
    1334              :                         {
    1335            0 :                           insn_lengths[inner_uid] = inner_length;
    1336            0 :                           something_changed = true;
    1337              :                         }
    1338              :                       else
    1339              :                         inner_length = insn_lengths[inner_uid];
    1340              :                     }
    1341            0 :                   insn_current_address += inner_length;
    1342            0 :                   new_length += inner_length;
    1343              :                 }
    1344              :             }
    1345              :           else
    1346              :             {
    1347     16276483 :               new_length = insn_current_length (insn);
    1348     16276483 :               insn_current_address += new_length;
    1349              :             }
    1350              : 
    1351              : #ifdef ADJUST_INSN_LENGTH
    1352              :           /* If needed, do any adjustment.  */
    1353              :           tmp_length = new_length;
    1354              :           ADJUST_INSN_LENGTH (insn, new_length);
    1355              :           insn_current_address += (new_length - tmp_length);
    1356              : #endif
    1357              : 
    1358     16276483 :           if (new_length != insn_lengths[uid]
    1359      5441992 :               && (!increasing || new_length > insn_lengths[uid]))
    1360              :             {
    1361      5441992 :               insn_lengths[uid] = new_length;
    1362      5441992 :               something_changed = true;
    1363              :             }
    1364              :           else
    1365     10834491 :             insn_current_address += insn_lengths[uid] - new_length;
    1366              :         }
    1367              :       /* For a non-optimizing compile, do only a single pass.  */
    1368      1781970 :       if (!increasing)
    1369              :         break;
    1370              :     }
    1371      1519032 :   crtl->max_insn_address = insn_current_address;
    1372      1519032 :   free (varying_length);
    1373              : }
    1374              : 
    1375              : /* Given the body of an INSN known to be generated by an ASM statement, return
    1376              :    the number of machine instructions likely to be generated for this insn.
    1377              :    This is used to compute its length.  */
    1378              : 
    1379              : static int
    1380       104326 : asm_insn_count (rtx body)
    1381              : {
    1382       104326 :   const char *templ;
    1383              : 
    1384       104326 :   if (GET_CODE (body) == ASM_INPUT)
    1385         3585 :     templ = XSTR (body, 0);
    1386              :   else
    1387       100741 :     templ = decode_asm_operands (body, NULL, NULL, NULL, NULL, NULL);
    1388              : 
    1389       104326 :   return asm_str_count (templ);
    1390              : }
    1391              : 
    1392              : /* Return the number of machine instructions likely to be generated for the
    1393              :    inline-asm template. */
    1394              : int
    1395       769254 : asm_str_count (const char *templ)
    1396              : {
    1397       769254 :   int count = 1;
    1398              : 
    1399       769254 :   if (!*templ)
    1400              :     return 0;
    1401              : 
    1402      3882636 :   for (; *templ; templ++)
    1403      3678947 :     if (IS_ASM_LOGICAL_LINE_SEPARATOR (*templ, templ)
    1404      3671493 :         || *templ == '\n')
    1405       221751 :       count++;
    1406              : 
    1407              :   return count;
    1408              : }
    1409              : 
    1410              : /* Return true if DWARF2 debug info can be emitted for DECL.  */
    1411              : 
    1412              : static bool
    1413      3110768 : dwarf2_debug_info_emitted_p (tree decl)
    1414              : {
    1415              :   /* When DWARF2 debug info is not generated internally.  */
    1416      3110768 :   if (!dwarf_debuginfo_p () && !dwarf_based_debuginfo_p ())
    1417              :     return false;
    1418              : 
    1419      1178654 :   if (DECL_IGNORED_P (decl))
    1420        16326 :     return false;
    1421              : 
    1422              :   return true;
    1423              : }
    1424              : 
    1425              : /* Return scope resulting from combination of S1 and S2.  */
    1426              : static tree
    1427            0 : choose_inner_scope (tree s1, tree s2)
    1428              : {
    1429            0 :    if (!s1)
    1430              :      return s2;
    1431            0 :    if (!s2)
    1432              :      return s1;
    1433            0 :    if (BLOCK_NUMBER (s1) > BLOCK_NUMBER (s2))
    1434            0 :      return s1;
    1435              :    return s2;
    1436              : }
    1437              : 
    1438              : /* Emit lexical block notes needed to change scope from S1 to S2.  */
    1439              : 
    1440              : static void
    1441     17958629 : change_scope (rtx_insn *orig_insn, tree s1, tree s2)
    1442              : {
    1443     17958629 :   rtx_insn *insn = orig_insn;
    1444     17958629 :   tree com = NULL_TREE;
    1445     17958629 :   tree ts1 = s1, ts2 = s2;
    1446     17958629 :   tree s;
    1447              : 
    1448     58927309 :   while (ts1 != ts2)
    1449              :     {
    1450     40968680 :       gcc_assert (ts1 && ts2);
    1451     40968680 :       if (BLOCK_NUMBER (ts1) > BLOCK_NUMBER (ts2))
    1452     16542351 :         ts1 = BLOCK_SUPERCONTEXT (ts1);
    1453     24426329 :       else if (BLOCK_NUMBER (ts1) < BLOCK_NUMBER (ts2))
    1454     16542351 :         ts2 = BLOCK_SUPERCONTEXT (ts2);
    1455              :       else
    1456              :         {
    1457      7883978 :           ts1 = BLOCK_SUPERCONTEXT (ts1);
    1458      7883978 :           ts2 = BLOCK_SUPERCONTEXT (ts2);
    1459              :         }
    1460              :     }
    1461     42384958 :   com = ts1;
    1462              : 
    1463              :   /* Close scopes.  */
    1464              :   s = s1;
    1465     42384958 :   while (s != com)
    1466              :     {
    1467     24426329 :       rtx_note *note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
    1468     24426329 :       NOTE_BLOCK (note) = s;
    1469     24426329 :       s = BLOCK_SUPERCONTEXT (s);
    1470              :     }
    1471              : 
    1472              :   /* Open scopes.  */
    1473              :   s = s2;
    1474     42384958 :   while (s != com)
    1475              :     {
    1476     24426329 :       insn = emit_note_before (NOTE_INSN_BLOCK_BEG, insn);
    1477     24426329 :       NOTE_BLOCK (insn) = s;
    1478     24426329 :       s = BLOCK_SUPERCONTEXT (s);
    1479              :     }
    1480     17958629 : }
    1481              : 
    1482              : /* Rebuild all the NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes based
    1483              :    on the scope tree and the newly reordered instructions.  */
    1484              : 
    1485              : static void
    1486       578567 : reemit_insn_block_notes (void)
    1487              : {
    1488       578567 :   tree cur_block = DECL_INITIAL (cfun->decl);
    1489       578567 :   rtx_insn *insn;
    1490              : 
    1491       578567 :   insn = get_insns ();
    1492    154992193 :   for (; insn; insn = NEXT_INSN (insn))
    1493              :     {
    1494    154413626 :       tree this_block;
    1495              : 
    1496              :       /* Prevent lexical blocks from straddling section boundaries.  */
    1497    154413626 :       if (NOTE_P (insn))
    1498    100331053 :         switch (NOTE_KIND (insn))
    1499              :           {
    1500              :           case NOTE_INSN_SWITCH_TEXT_SECTIONS:
    1501              :             {
    1502        81868 :               for (tree s = cur_block; s != DECL_INITIAL (cfun->decl);
    1503        60348 :                    s = BLOCK_SUPERCONTEXT (s))
    1504              :                 {
    1505        60348 :                   rtx_note *note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
    1506        60348 :                   NOTE_BLOCK (note) = s;
    1507        60348 :                   note = emit_note_after (NOTE_INSN_BLOCK_BEG, insn);
    1508        60348 :                   NOTE_BLOCK (note) = s;
    1509              :                 }
    1510              :             }
    1511              :             break;
    1512              : 
    1513     11560449 :           case NOTE_INSN_BEGIN_STMT:
    1514     11560449 :           case NOTE_INSN_INLINE_ENTRY:
    1515     11560449 :             this_block = LOCATION_BLOCK (NOTE_MARKER_LOCATION (insn));
    1516     11551603 :             if (!this_block)
    1517        14322 :               continue;
    1518     11546127 :             goto set_cur_block_to_this_block;
    1519              : 
    1520     88749084 :           default:
    1521     88749084 :             continue;
    1522     88749084 :         }
    1523              : 
    1524     54104093 :       if (!active_insn_p (insn))
    1525      7362091 :         continue;
    1526              : 
    1527              :       /* Avoid putting scope notes between jump table and its label.  */
    1528     46742002 :       if (JUMP_TABLE_DATA_P (insn))
    1529         6305 :         continue;
    1530              : 
    1531     46735697 :       this_block = insn_scope (insn);
    1532              :       /* For sequences compute scope resulting from merging all scopes
    1533              :          of instructions nested inside.  */
    1534     46735697 :       if (rtx_sequence *body = dyn_cast <rtx_sequence *> (PATTERN (insn)))
    1535              :         {
    1536              :           int i;
    1537              : 
    1538              :           this_block = NULL;
    1539            0 :           for (i = 0; i < body->len (); i++)
    1540            0 :             this_block = choose_inner_scope (this_block,
    1541            0 :                                              insn_scope (body->insn (i)));
    1542              :         }
    1543     46735697 :       if (! this_block)
    1544              :         {
    1545     10462284 :           if (INSN_LOCATION (insn) == UNKNOWN_LOCATION)
    1546      5104704 :             continue;
    1547              :           else
    1548      5357580 :             this_block = DECL_INITIAL (cfun->decl);
    1549              :         }
    1550              : 
    1551     36273413 :     set_cur_block_to_this_block:
    1552     53177120 :       if (this_block != cur_block)
    1553              :         {
    1554     17380062 :           change_scope (insn, cur_block, this_block);
    1555     17380062 :           cur_block = this_block;
    1556              :         }
    1557              :     }
    1558              : 
    1559              :   /* change_scope emits before the insn, not after.  */
    1560       578567 :   rtx_note *note = emit_note (NOTE_INSN_DELETED);
    1561       578567 :   change_scope (note, cur_block, DECL_INITIAL (cfun->decl));
    1562       578567 :   delete_insn (note);
    1563              : 
    1564       578567 :   reorder_blocks ();
    1565       578567 : }
    1566              : 
    1567              : static const char *some_local_dynamic_name;
    1568              : 
    1569              : /* Locate some local-dynamic symbol still in use by this function
    1570              :    so that we can print its name in local-dynamic base patterns.
    1571              :    Return null if there are no local-dynamic references.  */
    1572              : 
    1573              : const char *
    1574          423 : get_some_local_dynamic_name ()
    1575              : {
    1576          423 :   subrtx_iterator::array_type array;
    1577          423 :   rtx_insn *insn;
    1578              : 
    1579          423 :   if (some_local_dynamic_name)
    1580              :     return some_local_dynamic_name;
    1581              : 
    1582         8882 :   for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
    1583         8875 :     if (NONDEBUG_INSN_P (insn))
    1584        18241 :       FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
    1585              :         {
    1586        15828 :           const_rtx x = *iter;
    1587        15828 :           if (GET_CODE (x) == SYMBOL_REF)
    1588              :             {
    1589          569 :               if (SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC)
    1590          187 :                 return some_local_dynamic_name = XSTR (x, 0);
    1591          382 :               if (CONSTANT_POOL_ADDRESS_P (x))
    1592            0 :                 iter.substitute (get_pool_constant (x));
    1593              :             }
    1594              :         }
    1595              : 
    1596              :   return 0;
    1597          423 : }
    1598              : 
    1599              : /* Arrange for us to emit a source location note before any further
    1600              :    real insns or section changes, by setting the SEEN_NEXT_VIEW bit in
    1601              :    *SEEN, as long as we are keeping track of location views.  The bit
    1602              :    indicates we have referenced the next view at the current PC, so we
    1603              :    have to emit it.  This should be called next to the var_location
    1604              :    debug hook.  */
    1605              : 
    1606              : static inline void
    1607     66085824 : set_next_view_needed (int *seen)
    1608              : {
    1609     66085824 :   if (debug_variable_location_views)
    1610     66085824 :     *seen |= SEEN_NEXT_VIEW;
    1611              : }
    1612              : 
    1613              : /* Clear the flag in *SEEN indicating we need to emit the next view.
    1614              :    This should be called next to the source_line debug hook.  */
    1615              : 
    1616              : static inline void
    1617     48720841 : clear_next_view_needed (int *seen)
    1618              : {
    1619     48720841 :   *seen &= ~SEEN_NEXT_VIEW;
    1620              : }
    1621              : 
    1622              : /* Test whether we have a pending request to emit the next view in
    1623              :    *SEEN, and emit it if needed, clearing the request bit.  */
    1624              : 
    1625              : static inline void
    1626     92794534 : maybe_output_next_view (int *seen)
    1627              : {
    1628     92794534 :   if ((*seen & SEEN_NEXT_VIEW) != 0)
    1629              :     {
    1630      8945861 :       clear_next_view_needed (seen);
    1631      8945861 :       (*debug_hooks->source_line) (last_linenum, last_columnnum,
    1632              :                                    last_filename, last_discriminator,
    1633              :                                    false);
    1634              :     }
    1635     92794534 : }
    1636              : 
    1637              : /* We want to emit param bindings (before the first begin_stmt) in the
    1638              :    initial view, if we are emitting views.  To that end, we may
    1639              :    consume initial notes in the function, processing them in
    1640              :    final_start_function, before signaling the beginning of the
    1641              :    prologue, rather than in final.
    1642              : 
    1643              :    We don't test whether the DECLs are PARM_DECLs: the assumption is
    1644              :    that there will be a NOTE_INSN_BEGIN_STMT marker before any
    1645              :    non-parameter NOTE_INSN_VAR_LOCATION.  It's ok if the marker is not
    1646              :    there, we'll just have more variable locations bound in the initial
    1647              :    view, which is consistent with their being bound without any code
    1648              :    that would give them a value.  */
    1649              : 
    1650              : static inline bool
    1651      2978606 : in_initial_view_p (rtx_insn *insn)
    1652              : {
    1653      2978606 :   return (!DECL_IGNORED_P (current_function_decl)
    1654      2968167 :           && debug_variable_location_views
    1655      1954206 :           && insn && GET_CODE (insn) == NOTE
    1656      4770053 :           && (NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
    1657       837627 :               || NOTE_KIND (insn) == NOTE_INSN_DELETED));
    1658              : }
    1659              : 
    1660              : /* Output assembler code for the start of a function,
    1661              :    and initialize some of the variables in this file
    1662              :    for the new function.  The label for the function and associated
    1663              :    assembler pseudo-ops have already been output in `assemble_start_function'.
    1664              : 
    1665              :    FIRST is the first insn of the rtl for the function being compiled.
    1666              :    FILE is the file to write assembler code to.
    1667              :    SEEN should be initially set to zero, and it may be updated to
    1668              :    indicate we have references to the next location view, that would
    1669              :    require us to emit it at the current PC.
    1670              :    OPTIMIZE_P is nonzero if we should eliminate redundant
    1671              :      test and compare insns.  */
    1672              : 
    1673              : static void
    1674      1522701 : final_start_function_1 (rtx_insn **firstp, FILE *file, int *seen,
    1675              :                         int optimize_p ATTRIBUTE_UNUSED)
    1676              : {
    1677      1522701 :   block_depth = 0;
    1678              : 
    1679      1522701 :   this_is_asm_operands = 0;
    1680              : 
    1681      1522701 :   need_profile_function = false;
    1682              : 
    1683      1522701 :   last_filename = LOCATION_FILE (prologue_location);
    1684      1522701 :   last_linenum = LOCATION_LINE (prologue_location);
    1685      1522701 :   last_columnnum = LOCATION_COLUMN (prologue_location);
    1686      1522701 :   last_discriminator = 0;
    1687      1522701 :   force_source_line = false;
    1688              : 
    1689      1522701 :   high_block_linenum = high_function_linenum = last_linenum;
    1690              : 
    1691      1522701 :   rtx_insn *first = *firstp;
    1692      1522701 :   if (in_initial_view_p (first))
    1693              :     {
    1694      1454001 :       do
    1695              :         {
    1696      1454001 :           final_scan_insn (first, file, 0, 0, seen);
    1697      1454001 :           first = NEXT_INSN (first);
    1698              :         }
    1699      1454001 :       while (in_initial_view_p (first));
    1700       500181 :       *firstp = first;
    1701              :     }
    1702              : 
    1703      1522701 :   if (!DECL_IGNORED_P (current_function_decl))
    1704      1512262 :     debug_hooks->begin_prologue (last_linenum, last_columnnum,
    1705              :                                  last_filename);
    1706              : 
    1707      1522701 :   if (!dwarf2_debug_info_emitted_p (current_function_decl))
    1708       952290 :     dwarf2out_begin_prologue (0, 0, NULL);
    1709              : 
    1710      1522701 :   if (DECL_IGNORED_P (current_function_decl) && last_linenum && last_filename)
    1711         6174 :     debug_hooks->set_ignored_loc (last_linenum, last_columnnum, last_filename);
    1712              : 
    1713              : #ifdef LEAF_REG_REMAP
    1714              :   if (crtl->uses_only_leaf_regs)
    1715              :     leaf_renumber_regs (first);
    1716              : #endif
    1717              : 
    1718              :   /* The Sun386i and perhaps other machines don't work right
    1719              :      if the profiling code comes after the prologue.  */
    1720      1522701 :   if (targetm.profile_before_prologue () && crtl->profile)
    1721              :     {
    1722          300 :       if (targetm.asm_out.function_prologue == default_function_pro_epilogue
    1723          300 :           && targetm.have_prologue ())
    1724              :         {
    1725              :           rtx_insn *insn;
    1726          600 :           for (insn = first; insn; insn = NEXT_INSN (insn))
    1727          600 :             if (!NOTE_P (insn))
    1728              :               {
    1729              :                 insn = NULL;
    1730              :                 break;
    1731              :               }
    1732          600 :             else if (NOTE_KIND (insn) == NOTE_INSN_BASIC_BLOCK
    1733          300 :                      || NOTE_KIND (insn) == NOTE_INSN_FUNCTION_BEG)
    1734              :               break;
    1735          300 :             else if (NOTE_KIND (insn) == NOTE_INSN_DELETED
    1736            0 :                      || NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION)
    1737          300 :               continue;
    1738              :             else
    1739              :               {
    1740              :                 insn = NULL;
    1741              :                 break;
    1742              :               }
    1743              : 
    1744          300 :           if (insn)
    1745          300 :             need_profile_function = true;
    1746              :           else
    1747            0 :             profile_function (file);
    1748              :         }
    1749              :       else
    1750            0 :         profile_function (file);
    1751              :     }
    1752              : 
    1753              :   /* If debugging, assign block numbers to all of the blocks in this
    1754              :      function.  */
    1755      1522701 :   if (write_symbols)
    1756              :     {
    1757       578567 :       reemit_insn_block_notes ();
    1758       578567 :       number_blocks (current_function_decl);
    1759              :       /* We never actually put out begin/end notes for the top-level
    1760              :          block in the function.  But, conceptually, that block is
    1761              :          always needed.  */
    1762       578567 :       TREE_ASM_WRITTEN (DECL_INITIAL (current_function_decl)) = 1;
    1763              :     }
    1764              : 
    1765      1522701 :   unsigned HOST_WIDE_INT min_frame_size
    1766      1522701 :     = constant_lower_bound (get_frame_size ());
    1767      1522701 :   if (min_frame_size > (unsigned HOST_WIDE_INT) warn_frame_larger_than_size)
    1768              :     {
    1769              :       /* Issue a warning */
    1770            6 :       warning (OPT_Wframe_larger_than_,
    1771              :                "the frame size of %wu bytes is larger than %wu bytes",
    1772              :                min_frame_size, warn_frame_larger_than_size);
    1773              :     }
    1774              : 
    1775              :   /* First output the function prologue: code to set up the stack frame.  */
    1776      1522701 :   targetm.asm_out.function_prologue (file);
    1777              : 
    1778              :   /* If the machine represents the prologue as RTL, the profiling code must
    1779              :      be emitted when NOTE_INSN_PROLOGUE_END is scanned.  */
    1780      1522701 :   if (! targetm.have_prologue ())
    1781            0 :     profile_after_prologue (file);
    1782      1522701 : }
    1783              : 
    1784              : /* This is an exported final_start_function_1, callable without SEEN.  */
    1785              : 
    1786              : void
    1787         5572 : final_start_function (rtx_insn *first, FILE *file,
    1788              :                       int optimize_p ATTRIBUTE_UNUSED)
    1789              : {
    1790         5572 :   int seen = 0;
    1791         5572 :   final_start_function_1 (&first, file, &seen, optimize_p);
    1792         5572 :   gcc_assert (seen == 0);
    1793         5572 : }
    1794              : 
    1795              : static void
    1796      1519033 : profile_after_prologue (FILE *file ATTRIBUTE_UNUSED)
    1797              : {
    1798      1519033 :   if (!targetm.profile_before_prologue () && crtl->profile)
    1799           12 :     profile_function (file);
    1800      1519033 : }
    1801              : 
    1802              : static void
    1803          312 : profile_function (FILE *file ATTRIBUTE_UNUSED)
    1804              : {
    1805              : #ifndef NO_PROFILE_COUNTERS
    1806              : # define NO_PROFILE_COUNTERS    0
    1807              : #endif
    1808              : #ifdef ASM_OUTPUT_REG_PUSH
    1809          312 :   rtx sval = NULL, chain = NULL;
    1810              : 
    1811          312 :   if (cfun->returns_struct)
    1812            0 :     sval = targetm.calls.struct_value_rtx (TREE_TYPE (current_function_decl),
    1813              :                                            true);
    1814          312 :   if (cfun->static_chain_decl)
    1815            1 :     chain = targetm.calls.static_chain (current_function_decl, true);
    1816              : #endif /* ASM_OUTPUT_REG_PUSH */
    1817              : 
    1818          312 :   if (! NO_PROFILE_COUNTERS)
    1819              :     {
    1820              :       int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
    1821              :       switch_to_section (data_section);
    1822              :       ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
    1823              :       targetm.asm_out.internal_label (file, "LP", current_function_funcdef_no);
    1824              :       assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1);
    1825              :     }
    1826              : 
    1827          312 :   switch_to_section (current_function_section ());
    1828              : 
    1829              : #ifdef ASM_OUTPUT_REG_PUSH
    1830          312 :   if (sval && REG_P (sval))
    1831            0 :     ASM_OUTPUT_REG_PUSH (file, REGNO (sval));
    1832          312 :   if (chain && REG_P (chain))
    1833            1 :     ASM_OUTPUT_REG_PUSH (file, REGNO (chain));
    1834              : #endif
    1835              : 
    1836          312 :   FUNCTION_PROFILER (file, current_function_funcdef_no);
    1837              : 
    1838              : #ifdef ASM_OUTPUT_REG_PUSH
    1839          312 :   if (chain && REG_P (chain))
    1840            1 :     ASM_OUTPUT_REG_POP (file, REGNO (chain));
    1841          312 :   if (sval && REG_P (sval))
    1842            0 :     ASM_OUTPUT_REG_POP (file, REGNO (sval));
    1843              : #endif
    1844          312 : }
    1845              : 
    1846              : /* Output assembler code for the end of a function.
    1847              :    For clarity, args are same as those of `final_start_function'
    1848              :    even though not all of them are needed.  */
    1849              : 
    1850              : void
    1851      1522701 : final_end_function (void)
    1852              : {
    1853      1522701 :   app_disable ();
    1854              : 
    1855      1522701 :   if (!DECL_IGNORED_P (current_function_decl))
    1856      1512262 :     debug_hooks->end_function (high_function_linenum);
    1857              : 
    1858              :   /* Finally, output the function epilogue:
    1859              :      code to restore the stack frame and return to the caller.  */
    1860      1522701 :   targetm.asm_out.function_epilogue (asm_out_file);
    1861              : 
    1862              :   /* And debug output.  */
    1863      1522701 :   if (!DECL_IGNORED_P (current_function_decl))
    1864      1512262 :     debug_hooks->end_epilogue (last_linenum, last_filename);
    1865              : 
    1866      1522701 :   if (!dwarf2_debug_info_emitted_p (current_function_decl)
    1867      1522701 :       && dwarf2out_do_frame ())
    1868       952232 :     dwarf2out_end_epilogue (last_linenum, last_filename);
    1869              : 
    1870      1522701 :   some_local_dynamic_name = 0;
    1871      1522701 : }
    1872              : 
    1873              : 
    1874              : /* Dumper helper for basic block information. FILE is the assembly
    1875              :    output file, and INSN is the instruction being emitted.  */
    1876              : 
    1877              : static void
    1878    274342249 : dump_basic_block_info (FILE *file, rtx_insn *insn, basic_block *start_to_bb,
    1879              :                        basic_block *end_to_bb, int bb_map_size, int *bb_seqn)
    1880              : {
    1881    274342249 :   basic_block bb;
    1882              : 
    1883    274342249 :   if (!flag_debug_asm)
    1884              :     return;
    1885              : 
    1886        34287 :   if (INSN_UID (insn) < bb_map_size
    1887        34287 :       && (bb = start_to_bb[INSN_UID (insn)]) != NULL)
    1888              :     {
    1889         2100 :       edge e;
    1890         2100 :       edge_iterator ei;
    1891              : 
    1892         2100 :       fprintf (file, "%s BLOCK %d", ASM_COMMENT_START, bb->index);
    1893         2100 :       if (bb->count.initialized_p ())
    1894              :         {
    1895          164 :           fprintf (file, ", count:");
    1896          164 :           bb->count.dump (file);
    1897              :         }
    1898         2100 :       fprintf (file, " seq:%d", (*bb_seqn)++);
    1899         2100 :       fprintf (file, "\n%s PRED:", ASM_COMMENT_START);
    1900         4490 :       FOR_EACH_EDGE (e, ei, bb->preds)
    1901              :         {
    1902         2390 :           dump_edge_info (file, e, TDF_DETAILS, 0);
    1903              :         }
    1904         2100 :       fprintf (file, "\n");
    1905              :     }
    1906        34287 :   if (INSN_UID (insn) < bb_map_size
    1907        34287 :       && (bb = end_to_bb[INSN_UID (insn)]) != NULL)
    1908              :     {
    1909         2100 :       edge e;
    1910         2100 :       edge_iterator ei;
    1911              : 
    1912         2100 :       fprintf (asm_out_file, "%s SUCC:", ASM_COMMENT_START);
    1913         4488 :       FOR_EACH_EDGE (e, ei, bb->succs)
    1914              :        {
    1915         2388 :          dump_edge_info (asm_out_file, e, TDF_DETAILS, 1);
    1916              :        }
    1917         2100 :       fprintf (file, "\n");
    1918              :     }
    1919              : }
    1920              : 
    1921              : /* Output assembler code for some insns: all or part of a function.
    1922              :    For description of args, see `final_start_function', above.  */
    1923              : 
    1924              : static void
    1925      1519033 : final_1 (rtx_insn *first, FILE *file, int seen, int optimize_p)
    1926              : {
    1927      1519033 :   rtx_insn *insn, *next;
    1928              : 
    1929              :   /* Used for -dA dump.  */
    1930      1519033 :   basic_block *start_to_bb = NULL;
    1931      1519033 :   basic_block *end_to_bb = NULL;
    1932      1519033 :   int bb_map_size = 0;
    1933      1519033 :   int bb_seqn = 0;
    1934              : 
    1935      1519033 :   last_ignored_compare = 0;
    1936              : 
    1937      1519033 :   init_recog ();
    1938              : 
    1939      1519033 :   CC_STATUS_INIT;
    1940              : 
    1941      1519033 :   if (flag_debug_asm)
    1942              :     {
    1943         1210 :       basic_block bb;
    1944              : 
    1945         1210 :       bb_map_size = get_max_uid () + 1;
    1946         1210 :       start_to_bb = XCNEWVEC (basic_block, bb_map_size);
    1947         1210 :       end_to_bb = XCNEWVEC (basic_block, bb_map_size);
    1948              : 
    1949              :       /* There is no cfg for a thunk.  */
    1950         1210 :       if (!cfun->is_thunk)
    1951         3304 :         FOR_EACH_BB_REVERSE_FN (bb, cfun)
    1952              :           {
    1953         2100 :             start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
    1954         2100 :             end_to_bb[INSN_UID (BB_END (bb))] = bb;
    1955              :           }
    1956              :     }
    1957              : 
    1958              :   /* Output the insns.  */
    1959    275861282 :   for (insn = first; insn;)
    1960              :     {
    1961    274342249 :       if (HAVE_ATTR_length)
    1962              :         {
    1963    274342249 :           if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
    1964              :             {
    1965              :               /* This can be triggered by bugs elsewhere in the compiler if
    1966              :                  new insns are created after init_insn_lengths is called.  */
    1967     61060429 :               gcc_assert (NOTE_P (insn));
    1968     61060429 :               insn_current_address = -1;
    1969              :             }
    1970              :           else
    1971    213281820 :             insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
    1972              :           /* final can be seen as an iteration of shorten_branches that
    1973              :              does nothing (since a fixed point has already been reached).  */
    1974    274342249 :           insn_last_address = insn_current_address;
    1975              :         }
    1976              : 
    1977    274342249 :       dump_basic_block_info (file, insn, start_to_bb, end_to_bb,
    1978              :                              bb_map_size, &bb_seqn);
    1979    274342249 :       insn = final_scan_insn (insn, file, optimize_p, 0, &seen);
    1980              :     }
    1981              : 
    1982      1519033 :   maybe_output_next_view (&seen);
    1983              : 
    1984      1519033 :   if (flag_debug_asm)
    1985              :     {
    1986         1210 :       free (start_to_bb);
    1987         1210 :       free (end_to_bb);
    1988              :     }
    1989              : 
    1990              :   /* Remove CFI notes, to avoid compare-debug failures.  */
    1991    275861282 :   for (insn = first; insn; insn = next)
    1992              :     {
    1993    274342249 :       next = NEXT_INSN (insn);
    1994    274342249 :       if (NOTE_P (insn)
    1995    166444315 :           && (NOTE_KIND (insn) == NOTE_INSN_CFI
    1996    166444315 :               || NOTE_KIND (insn) == NOTE_INSN_CFI_LABEL))
    1997     12087071 :         delete_insn (insn);
    1998              :     }
    1999      1519033 : }
    2000              : 
    2001              : /* This is an exported final_1, callable without SEEN.  */
    2002              : 
    2003              : void
    2004         1904 : final (rtx_insn *first, FILE *file, int optimize_p)
    2005              : {
    2006              :   /* Those that use the internal final_start_function_1/final_1 API
    2007              :      skip initial debug bind notes in final_start_function_1, and pass
    2008              :      the modified FIRST to final_1.  But those that use the public
    2009              :      final_start_function/final APIs, final_start_function can't move
    2010              :      FIRST because it's not passed by reference, so if they were
    2011              :      skipped there, skip them again here.  */
    2012         1904 :   while (in_initial_view_p (first))
    2013            0 :     first = NEXT_INSN (first);
    2014              : 
    2015         1904 :   final_1 (first, file, 0, optimize_p);
    2016         1904 : }
    2017              : 
    2018              : const char *
    2019     94841803 : get_insn_template (int code, rtx_insn *insn)
    2020              : {
    2021     94841803 :   switch (insn_data[code].output_format)
    2022              :     {
    2023     17936831 :     case INSN_OUTPUT_FORMAT_SINGLE:
    2024     17936831 :       return insn_data[code].output.single;
    2025     10219021 :     case INSN_OUTPUT_FORMAT_MULTI:
    2026     10219021 :       return insn_data[code].output.multi[which_alternative];
    2027     66685951 :     case INSN_OUTPUT_FORMAT_FUNCTION:
    2028     66685951 :       gcc_assert (insn);
    2029     66685951 :       return (*insn_data[code].output.function) (recog_data.operand, insn);
    2030              : 
    2031            0 :     default:
    2032            0 :       gcc_unreachable ();
    2033              :     }
    2034              : }
    2035              : 
    2036              : /* Emit the appropriate declaration for an alternate-entry-point
    2037              :    symbol represented by INSN, to FILE.  INSN is a CODE_LABEL with
    2038              :    LABEL_KIND != LABEL_NORMAL.
    2039              : 
    2040              :    The case fall-through in this function is intentional.  */
    2041              : static void
    2042            0 : output_alternate_entry_point (FILE *file, rtx_insn *insn)
    2043              : {
    2044            0 :   const char *name = LABEL_NAME (insn);
    2045              : 
    2046            0 :   switch (LABEL_KIND (insn))
    2047              :     {
    2048            0 :     case LABEL_WEAK_ENTRY:
    2049              : #ifdef ASM_WEAKEN_LABEL
    2050            0 :       ASM_WEAKEN_LABEL (file, name);
    2051            0 :       gcc_fallthrough ();
    2052              : #endif
    2053            0 :     case LABEL_GLOBAL_ENTRY:
    2054            0 :       targetm.asm_out.globalize_label (file, name);
    2055            0 :       gcc_fallthrough ();
    2056            0 :     case LABEL_STATIC_ENTRY:
    2057              : #ifdef ASM_OUTPUT_TYPE_DIRECTIVE
    2058            0 :       ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
    2059              : #endif
    2060            0 :       ASM_OUTPUT_LABEL (file, name);
    2061            0 :       break;
    2062              : 
    2063            0 :     case LABEL_NORMAL:
    2064            0 :     default:
    2065            0 :       gcc_unreachable ();
    2066              :     }
    2067            0 : }
    2068              : 
    2069              : /* Given a CALL_INSN, find and return the nested CALL. */
    2070              : static rtx
    2071     39449020 : call_from_call_insn (const rtx_call_insn *insn)
    2072              : {
    2073     39449020 :   rtx x;
    2074     39449020 :   gcc_assert (CALL_P (insn));
    2075     39449020 :   x = PATTERN (insn);
    2076              : 
    2077     56451250 :   while (GET_CODE (x) != CALL)
    2078              :     {
    2079     17002230 :       switch (GET_CODE (x))
    2080              :         {
    2081            0 :         default:
    2082            0 :           gcc_unreachable ();
    2083            0 :         case COND_EXEC:
    2084            0 :           x = COND_EXEC_CODE (x);
    2085            0 :           break;
    2086      1695427 :         case PARALLEL:
    2087      1695427 :           x = XVECEXP (x, 0, 0);
    2088      1695427 :           break;
    2089     15306803 :         case SET:
    2090     15306803 :           x = XEXP (x, 1);
    2091     15306803 :           break;
    2092              :         }
    2093              :     }
    2094     39449020 :   return x;
    2095              : }
    2096              : 
    2097              : /* Return the CALL in X if there is one.  */
    2098              : 
    2099              : rtx
    2100     33149058 : get_call_rtx_from (const rtx_insn *insn)
    2101              : {
    2102     33149058 :   const rtx_call_insn *call_insn = as_a<const rtx_call_insn *> (insn);
    2103     33149058 :   return call_from_call_insn (call_insn);
    2104              : }
    2105              : 
    2106              : /* Print a comment into the asm showing FILENAME, LINENUM, and the
    2107              :    corresponding source line, if available.  */
    2108              : 
    2109              : static void
    2110           32 : asm_show_source (const char *filename, int linenum)
    2111              : {
    2112           32 :   if (!filename)
    2113            0 :     return;
    2114              : 
    2115           32 :   diagnostics::char_span line
    2116           32 :     = global_dc->get_file_cache ().get_source_line (filename, linenum);
    2117           32 :   if (!line)
    2118              :     return;
    2119              : 
    2120           32 :   fprintf (asm_out_file, "%s %s:%i: ", ASM_COMMENT_START, filename, linenum);
    2121              :   /* "line" is not 0-terminated, so we must use its length.  */
    2122           32 :   fwrite (line.get_buffer (), 1, line.length (), asm_out_file);
    2123           32 :   fputc ('\n', asm_out_file);
    2124              : }
    2125              : 
    2126              : /* Judge if an absolute jump table is relocatable.  */
    2127              : 
    2128              : bool
    2129        14934 : jumptable_relocatable (void)
    2130              : {
    2131        14934 :   bool relocatable = false;
    2132              : 
    2133        14934 :   if (!CASE_VECTOR_PC_RELATIVE
    2134        14934 :       && !targetm.asm_out.generate_pic_addr_diff_vec ()
    2135        14934 :       && targetm_common.have_named_sections)
    2136        12516 :      relocatable = targetm.asm_out.reloc_rw_mask ();
    2137              : 
    2138        14934 :   return relocatable;
    2139              : }
    2140              : 
    2141              : /* The final scan for one insn, INSN.
    2142              :    Args are same as in `final', except that INSN
    2143              :    is the insn being scanned.
    2144              :    Value returned is the next insn to be scanned.
    2145              : 
    2146              :    NOPEEPHOLES is the flag to disallow peephole processing (currently
    2147              :    used for within delayed branch sequence output).
    2148              : 
    2149              :    SEEN is used to track the end of the prologue, for emitting
    2150              :    debug information.  We force the emission of a line note after
    2151              :    both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG.  */
    2152              : 
    2153              : static rtx_insn *
    2154    275796250 : final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
    2155              :                    int nopeepholes ATTRIBUTE_UNUSED, int *seen)
    2156              : {
    2157    275796250 :   rtx_insn *next;
    2158    275796250 :   rtx_jump_table_data *table;
    2159              : 
    2160    275796250 :   insn_counter++;
    2161              : 
    2162              :   /* Ignore deleted insns.  These can occur when we split insns (due to a
    2163              :      template of "#") while not optimizing.  */
    2164    275796250 :   if (insn->deleted ())
    2165            0 :     return NEXT_INSN (insn);
    2166              : 
    2167    275796250 :   switch (GET_CODE (insn))
    2168              :     {
    2169    167898316 :     case NOTE:
    2170    167898316 :       switch (NOTE_KIND (insn))
    2171              :         {
    2172              :         case NOTE_INSN_DELETED:
    2173              :         case NOTE_INSN_UPDATE_SJLJ_CONTEXT:
    2174              :           break;
    2175              : 
    2176        65368 :         case NOTE_INSN_SWITCH_TEXT_SECTIONS:
    2177        65368 :           maybe_output_next_view (seen);
    2178              : 
    2179        65368 :           output_function_exception_table (0);
    2180              : 
    2181        65368 :           if (targetm.asm_out.unwind_emit)
    2182            0 :             targetm.asm_out.unwind_emit (asm_out_file, insn);
    2183              : 
    2184        65368 :           in_cold_section_p = !in_cold_section_p;
    2185              : 
    2186        65368 :           gcc_checking_assert (in_cold_section_p);
    2187        65368 :           if (in_cold_section_p)
    2188        65368 :             cold_function_name
    2189        65368 :               = clone_function_name (current_function_decl, "cold");
    2190              : 
    2191        65368 :           if (dwarf2out_do_frame ())
    2192              :             {
    2193        65366 :               dwarf2out_switch_text_section ();
    2194        65366 :               if (!dwarf2_debug_info_emitted_p (current_function_decl)
    2195        65366 :                   && !DECL_IGNORED_P (current_function_decl))
    2196        43829 :                 debug_hooks->switch_text_section ();
    2197              :             }
    2198            2 :           else if (!DECL_IGNORED_P (current_function_decl))
    2199            1 :             debug_hooks->switch_text_section ();
    2200        65400 :           if (DECL_IGNORED_P (current_function_decl) && last_linenum
    2201        65400 :               && last_filename)
    2202           32 :             debug_hooks->set_ignored_loc (last_linenum, last_columnnum,
    2203              :                                           last_filename);
    2204              : 
    2205        65368 :           switch_to_section (current_function_section ());
    2206        65368 :           targetm.asm_out.function_switched_text_sections (asm_out_file,
    2207              :                                                            current_function_decl,
    2208              :                                                            in_cold_section_p);
    2209              :           /* Emit a label for the split cold section.  Form label name by
    2210              :              suffixing "cold" to the original function's name.  */
    2211        65368 :           if (in_cold_section_p)
    2212              :             {
    2213              : #ifdef ASM_DECLARE_COLD_FUNCTION_NAME
    2214        65368 :               ASM_DECLARE_COLD_FUNCTION_NAME (asm_out_file,
    2215              :                                               IDENTIFIER_POINTER
    2216              :                                                   (cold_function_name),
    2217              :                                               current_function_decl);
    2218              : #else
    2219              :               ASM_OUTPUT_LABEL (asm_out_file,
    2220              :                                 IDENTIFIER_POINTER (cold_function_name));
    2221              : #endif
    2222        65368 :               if (dwarf2out_do_frame ()
    2223        65368 :                   && cfun->fde->dw_fde_second_begin != NULL)
    2224        65366 :                 ASM_OUTPUT_LABEL (asm_out_file, cfun->fde->dw_fde_second_begin);
    2225              :             }
    2226              :           break;
    2227              : 
    2228     14549251 :         case NOTE_INSN_BASIC_BLOCK:
    2229     14549251 :           if (need_profile_function)
    2230              :             {
    2231          300 :               profile_function (asm_out_file);
    2232          300 :               need_profile_function = false;
    2233              :             }
    2234              : 
    2235     14549251 :           if (targetm.asm_out.unwind_emit)
    2236            0 :             targetm.asm_out.unwind_emit (asm_out_file, insn);
    2237              : 
    2238              :           break;
    2239              : 
    2240       429359 :         case NOTE_INSN_EH_REGION_BEG:
    2241       429359 :           ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LEHB",
    2242              :                                   NOTE_EH_HANDLER (insn));
    2243       429359 :           break;
    2244              : 
    2245       429359 :         case NOTE_INSN_EH_REGION_END:
    2246       429359 :           ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LEHE",
    2247              :                                   NOTE_EH_HANDLER (insn));
    2248       429359 :           break;
    2249              : 
    2250      1519033 :         case NOTE_INSN_PROLOGUE_END:
    2251      1519033 :           targetm.asm_out.function_end_prologue (file);
    2252      1519033 :           profile_after_prologue (file);
    2253              : 
    2254      1519033 :           if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE)
    2255              :             {
    2256       637681 :               *seen |= SEEN_EMITTED;
    2257       637681 :               force_source_line = true;
    2258              :             }
    2259              :           else
    2260       881352 :             *seen |= SEEN_NOTE;
    2261              : 
    2262              :           break;
    2263              : 
    2264      1619313 :         case NOTE_INSN_EPILOGUE_BEG:
    2265      1619313 :           if (!DECL_IGNORED_P (current_function_decl))
    2266      1614169 :             (*debug_hooks->begin_epilogue) (last_linenum, last_filename);
    2267      1619313 :           targetm.asm_out.function_begin_epilogue (file);
    2268      1619313 :           break;
    2269              : 
    2270     12081363 :         case NOTE_INSN_CFI:
    2271     12081363 :           dwarf2out_emit_cfi (NOTE_CFI (insn));
    2272     12081363 :           break;
    2273              : 
    2274         5708 :         case NOTE_INSN_CFI_LABEL:
    2275         5708 :           ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LCFI",
    2276              :                                   NOTE_LABEL_NUMBER (insn));
    2277         5708 :           break;
    2278              : 
    2279      1517129 :         case NOTE_INSN_FUNCTION_BEG:
    2280      1517129 :           if (need_profile_function)
    2281              :             {
    2282            0 :               profile_function (asm_out_file);
    2283            0 :               need_profile_function = false;
    2284              :             }
    2285              : 
    2286      1517129 :           app_disable ();
    2287      1517129 :           if (!DECL_IGNORED_P (current_function_decl))
    2288      1510358 :             debug_hooks->end_prologue (last_linenum, last_filename);
    2289              : 
    2290      1517129 :           if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE)
    2291              :             {
    2292       879448 :               *seen |= SEEN_EMITTED;
    2293       879448 :               force_source_line = true;
    2294              :             }
    2295              :           else
    2296       637681 :             *seen |= SEEN_NOTE;
    2297              : 
    2298              :           break;
    2299              : 
    2300     24486677 :         case NOTE_INSN_BLOCK_BEG:
    2301     24486677 :           if (debug_info_level >= DINFO_LEVEL_NORMAL
    2302        30779 :               || dwarf_debuginfo_p ()
    2303     24486677 :               || write_symbols == VMS_DEBUG)
    2304              :             {
    2305     24486677 :               int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
    2306              : 
    2307     24486677 :               app_disable ();
    2308     24486677 :               ++block_depth;
    2309     24486677 :               high_block_linenum = last_linenum;
    2310              : 
    2311              :               /* Output debugging info about the symbol-block beginning.  */
    2312     24486677 :               if (!DECL_IGNORED_P (current_function_decl))
    2313     24486677 :                 debug_hooks->begin_block (last_linenum, n, NOTE_BLOCK (insn));
    2314              : 
    2315              :               /* Mark this block as output.  */
    2316     24486677 :               TREE_ASM_WRITTEN (NOTE_BLOCK (insn)) = 1;
    2317     24486677 :               BLOCK_IN_COLD_SECTION_P (NOTE_BLOCK (insn)) = in_cold_section_p;
    2318              :             }
    2319              :           break;
    2320              : 
    2321     24486677 :         case NOTE_INSN_BLOCK_END:
    2322     24486677 :           maybe_output_next_view (seen);
    2323              : 
    2324     24486677 :           if (debug_info_level >= DINFO_LEVEL_NORMAL
    2325        30779 :               || dwarf_debuginfo_p ()
    2326     24486677 :               || write_symbols == VMS_DEBUG)
    2327              :             {
    2328     24486677 :               int n = BLOCK_NUMBER (NOTE_BLOCK (insn));
    2329              : 
    2330     24486677 :               app_disable ();
    2331              : 
    2332              :               /* End of a symbol-block.  */
    2333     24486677 :               --block_depth;
    2334     24486677 :               gcc_assert (block_depth >= 0);
    2335              : 
    2336     24486677 :               if (!DECL_IGNORED_P (current_function_decl))
    2337     24486677 :                 debug_hooks->end_block (high_block_linenum, n);
    2338     24486677 :               gcc_assert (BLOCK_IN_COLD_SECTION_P (NOTE_BLOCK (insn))
    2339              :                           == in_cold_section_p);
    2340              :             }
    2341              :           break;
    2342              : 
    2343        56473 :         case NOTE_INSN_DELETED_LABEL:
    2344              :           /* Emit the label.  We may have deleted the CODE_LABEL because
    2345              :              the label could be proved to be unreachable, though still
    2346              :              referenced (in the form of having its address taken.  */
    2347        56473 :           ASM_OUTPUT_DEBUG_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
    2348        56473 :           break;
    2349              : 
    2350         8769 :         case NOTE_INSN_DELETED_DEBUG_LABEL:
    2351              :           /* Similarly, but need to use different namespace for it.  */
    2352         8769 :           if (CODE_LABEL_NUMBER (insn) != -1)
    2353         8769 :             ASM_OUTPUT_DEBUG_LABEL (file, "LDL", CODE_LABEL_NUMBER (insn));
    2354              :           break;
    2355              : 
    2356     66102170 :         case NOTE_INSN_VAR_LOCATION:
    2357     66102170 :           if (!DECL_IGNORED_P (current_function_decl))
    2358              :             {
    2359     66085824 :               debug_hooks->var_location (insn);
    2360     66085824 :               set_next_view_needed (seen);
    2361              :             }
    2362              :           break;
    2363              : 
    2364      4141887 :         case NOTE_INSN_BEGIN_STMT:
    2365      4141887 :           gcc_checking_assert (cfun->debug_nonbind_markers);
    2366      4141887 :           if (!DECL_IGNORED_P (current_function_decl)
    2367      4141887 :               && notice_source_line (insn, NULL))
    2368              :             {
    2369     11560432 :             output_source_line:
    2370     11560432 :               (*debug_hooks->source_line) (last_linenum, last_columnnum,
    2371              :                                            last_filename, last_discriminator,
    2372              :                                            true);
    2373     11560432 :               clear_next_view_needed (seen);
    2374              :             }
    2375              :           break;
    2376              : 
    2377      7418562 :         case NOTE_INSN_INLINE_ENTRY:
    2378      7418562 :           gcc_checking_assert (cfun->debug_nonbind_markers);
    2379      7418562 :           if (!DECL_IGNORED_P (current_function_decl)
    2380      7418562 :               && notice_source_line (insn, NULL))
    2381              :             {
    2382      7418545 :               (*debug_hooks->inline_entry) (LOCATION_BLOCK
    2383              :                                             (NOTE_MARKER_LOCATION (insn)));
    2384      7418545 :               goto output_source_line;
    2385              :             }
    2386              :           break;
    2387              : 
    2388            0 :         default:
    2389            0 :           gcc_unreachable ();
    2390              :           break;
    2391              :         }
    2392              :       break;
    2393              : 
    2394              :     case BARRIER:
    2395              :       break;
    2396              : 
    2397      7011934 :     case CODE_LABEL:
    2398              :       /* The target port might emit labels in the output function for
    2399              :          some insn, e.g. sh.cc output_branchy_insn.  */
    2400      7011934 :       if (CODE_LABEL_NUMBER (insn) <= max_labelno)
    2401              :         {
    2402      7011932 :           align_flags alignment = LABEL_TO_ALIGNMENT (insn);
    2403      8345534 :           if (alignment.levels[0].log && NEXT_INSN (insn))
    2404              :             {
    2405              : #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
    2406              :               /* Output both primary and secondary alignment.  */
    2407      1333602 :               ASM_OUTPUT_MAX_SKIP_ALIGN (file, alignment.levels[0].log,
    2408              :                                          alignment.levels[0].maxskip);
    2409      1333602 :               ASM_OUTPUT_MAX_SKIP_ALIGN (file, alignment.levels[1].log,
    2410              :                                          alignment.levels[1].maxskip);
    2411              : #else
    2412              : #ifdef ASM_OUTPUT_ALIGN_WITH_NOP
    2413              :               ASM_OUTPUT_ALIGN_WITH_NOP (file, alignment.levels[0].log);
    2414              : #else
    2415              :               ASM_OUTPUT_ALIGN (file, alignment.levels[0].log);
    2416              : #endif
    2417              : #endif
    2418              :             }
    2419              :         }
    2420      7011934 :       CC_STATUS_INIT;
    2421              : 
    2422      7011934 :       if (!DECL_IGNORED_P (current_function_decl) && LABEL_NAME (insn))
    2423        66019 :         debug_hooks->label (as_a <rtx_code_label *> (insn));
    2424              : 
    2425      7011934 :       app_disable ();
    2426              : 
    2427              :       /* If this label is followed by a jump-table, make sure we put
    2428              :          the label in the read-only section.  Also possibly write the
    2429              :          label and jump table together.  */
    2430      7011934 :       table = jump_table_for_label (as_a <rtx_code_label *> (insn));
    2431              : 
    2432              :       /* Still in the function's own section here, which is where the base
    2433              :          label of a PC-relative table has to go.  */
    2434      7011934 :       if (table
    2435         7467 :           && JUMP_TABLE_SHARED_P (PATTERN (table))
    2436      7012870 :           && targetm.asm_out.jump_table_base)
    2437            0 :         targetm.asm_out.jump_table_base (file, table,
    2438            0 :                                              CODE_LABEL_NUMBER (insn));
    2439              : 
    2440      7011934 :       if (table)
    2441              :         {
    2442              : #if defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC)
    2443              :           /* In this case, the case vector is being moved by the
    2444              :              target, so don't output the label at all.  Leave that
    2445              :              to the back end macros.  */
    2446              : #else
    2447         7467 :           if (! JUMP_TABLES_IN_TEXT_SECTION)
    2448              :             {
    2449         7467 :               int log_align;
    2450              : 
    2451         7467 :               switch_to_section (targetm.asm_out.function_rodata_section
    2452              :                                  (current_function_decl,
    2453              :                                   jumptable_relocatable ()));
    2454              : 
    2455              : #ifdef ADDR_VEC_ALIGN
    2456         7467 :               log_align = ADDR_VEC_ALIGN (table);
    2457              : #else
    2458              :               log_align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT);
    2459              : #endif
    2460         7467 :               ASM_OUTPUT_ALIGN (file, log_align);
    2461              :             }
    2462              :           else
    2463              :             switch_to_section (current_function_section ());
    2464              : 
    2465              : #ifdef ASM_OUTPUT_CASE_LABEL
    2466         7467 :           ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn), table);
    2467              : #else
    2468              :           targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
    2469              : #endif
    2470              : #endif
    2471         7467 :           break;
    2472              :         }
    2473      7004467 :       if (LABEL_ALT_ENTRY_P (insn))
    2474            0 :         output_alternate_entry_point (file, insn);
    2475              :       else
    2476      7004467 :         targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
    2477              :       break;
    2478              : 
    2479     96014356 :     default:
    2480     96014356 :       {
    2481     96014356 :         rtx body = PATTERN (insn);
    2482     96014356 :         int insn_code_number;
    2483     96014356 :         const char *templ;
    2484     96014356 :         bool is_stmt, *is_stmt_p;
    2485              : 
    2486     96014356 :         if (MAY_HAVE_DEBUG_MARKER_INSNS && cfun->debug_nonbind_markers)
    2487              :           {
    2488     22005488 :             is_stmt = false;
    2489     22005488 :             is_stmt_p = NULL;
    2490              :           }
    2491              :         else
    2492              :           is_stmt_p = &is_stmt;
    2493              : 
    2494              :         /* Reset this early so it is correct for ASM statements.  */
    2495     96014356 :         current_insn_predicate = NULL_RTX;
    2496              : 
    2497              :         /* An INSN, JUMP_INSN or CALL_INSN.
    2498              :            First check for special kinds that recog doesn't recognize.  */
    2499              : 
    2500     96014356 :         if (GET_CODE (body) == USE /* These are just declarations.  */
    2501     96014356 :             || GET_CODE (body) == CLOBBER)
    2502              :           break;
    2503              : 
    2504              :         /* Detect insns that are really jump-tables
    2505              :            and output them as such.  */
    2506              : 
    2507     94945471 :         if (JUMP_TABLE_DATA_P (insn))
    2508              :           {
    2509              : #if !(defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC))
    2510         7467 :             int vlen, idx;
    2511              : #endif
    2512              : 
    2513         7467 :             if (! JUMP_TABLES_IN_TEXT_SECTION)
    2514         7467 :               switch_to_section (targetm.asm_out.function_rodata_section
    2515              :                                  (current_function_decl,
    2516              :                                   jumptable_relocatable ()));
    2517              :             else
    2518              :               switch_to_section (current_function_section ());
    2519              : 
    2520         7467 :             app_disable ();
    2521              : 
    2522              : #if defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC)
    2523              :             if (GET_CODE (body) == ADDR_VEC)
    2524              :               {
    2525              : #ifdef ASM_OUTPUT_ADDR_VEC
    2526              :                 ASM_OUTPUT_ADDR_VEC (PREV_INSN (insn), body);
    2527              : #else
    2528              :                 gcc_unreachable ();
    2529              : #endif
    2530              :               }
    2531              :             else
    2532              :               {
    2533              : #ifdef ASM_OUTPUT_ADDR_DIFF_VEC
    2534              :                 ASM_OUTPUT_ADDR_DIFF_VEC (PREV_INSN (insn), body);
    2535              : #else
    2536              :                 gcc_unreachable ();
    2537              : #endif
    2538              :               }
    2539              : #else
    2540         7467 :             vlen = XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC);
    2541       177417 :             for (idx = 0; idx < vlen; idx++)
    2542              :               {
    2543       169950 :                 if (GET_CODE (body) == ADDR_VEC)
    2544              :                   {
    2545              : #ifdef ASM_OUTPUT_ADDR_VEC_ELT
    2546       142042 :                     ASM_OUTPUT_ADDR_VEC_ELT
    2547              :                       (file, CODE_LABEL_NUMBER
    2548              :                        (label_ref_label (XVECEXP (body, 0, idx))));
    2549              : #else
    2550              :                     gcc_unreachable ();
    2551              : #endif
    2552              :                   }
    2553              :                 else
    2554              :                   {
    2555              : #ifdef ASM_OUTPUT_ADDR_DIFF_ELT
    2556        27908 :                     ASM_OUTPUT_ADDR_DIFF_ELT
    2557              :                       (file,
    2558              :                        body,
    2559              :                        CODE_LABEL_NUMBER
    2560              :                        (label_ref_label (XVECEXP (body, 1, idx))),
    2561              :                        CODE_LABEL_NUMBER (label_ref_label (XEXP (body, 0))));
    2562              : #else
    2563              :                     gcc_unreachable ();
    2564              : #endif
    2565              :                   }
    2566              :               }
    2567              : #ifdef ASM_OUTPUT_CASE_END
    2568              :             ASM_OUTPUT_CASE_END (file,
    2569              :                                  CODE_LABEL_NUMBER (PREV_INSN (insn)),
    2570              :                                  insn);
    2571              : #endif
    2572              : #endif
    2573              : 
    2574         7467 :             switch_to_section (current_function_section ());
    2575              : 
    2576         7467 :             if (debug_variable_location_views
    2577         7467 :                 && !DECL_IGNORED_P (current_function_decl))
    2578         6301 :               debug_hooks->var_location (insn);
    2579              : 
    2580              :             break;
    2581              :           }
    2582              :         /* Output this line note if it is the first or the last line
    2583              :            note in a row.  */
    2584     94938004 :         if (!DECL_IGNORED_P (current_function_decl)
    2585     94938004 :             && notice_source_line (insn, is_stmt_p))
    2586              :           {
    2587     28214548 :             if (flag_verbose_asm)
    2588           32 :               asm_show_source (last_filename, last_linenum);
    2589     28214548 :             (*debug_hooks->source_line) (last_linenum, last_columnnum,
    2590              :                                          last_filename, last_discriminator,
    2591              :                                          is_stmt);
    2592     28214548 :             clear_next_view_needed (seen);
    2593              :           }
    2594              :         else
    2595     66723456 :           maybe_output_next_view (seen);
    2596              : 
    2597     94938004 :         gcc_checking_assert (!DEBUG_INSN_P (insn));
    2598              : 
    2599     94938004 :         if (GET_CODE (body) == PARALLEL
    2600     11876990 :             && GET_CODE (XVECEXP (body, 0, 0)) == ASM_INPUT)
    2601     94938004 :           body = XVECEXP (body, 0, 0);
    2602              : 
    2603     94938004 :         if (GET_CODE (body) == ASM_INPUT)
    2604              :           {
    2605         3136 :             const char *string = XSTR (body, 0);
    2606              : 
    2607              :             /* There's no telling what that did to the condition codes.  */
    2608         3136 :             CC_STATUS_INIT;
    2609              : 
    2610         3136 :             if (string[0])
    2611              :               {
    2612          859 :                 expanded_location loc;
    2613              : 
    2614          859 :                 app_enable ();
    2615          859 :                 loc = expand_location (ASM_INPUT_SOURCE_LOCATION (body));
    2616          859 :                 if (*loc.file && loc.line)
    2617          859 :                   fprintf (asm_out_file, "%s %i \"%s\" 1\n",
    2618              :                            ASM_COMMENT_START, loc.line, loc.file);
    2619          859 :                 fprintf (asm_out_file, "\t%s\n", string);
    2620              : #if HAVE_AS_LINE_ZERO
    2621          859 :                 if (*loc.file && loc.line)
    2622          859 :                   fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
    2623              : #endif
    2624              :               }
    2625              :             break;
    2626              :           }
    2627              : 
    2628              :         /* Detect `asm' construct with operands.  */
    2629     94934868 :         if (asm_noperands (body) >= 0)
    2630              :           {
    2631        93124 :             unsigned int noperands = asm_noperands (body);
    2632        93124 :             rtx *ops = XALLOCAVEC (rtx, noperands);
    2633        93124 :             const char *string;
    2634        93124 :             location_t loc;
    2635        93124 :             expanded_location expanded;
    2636              : 
    2637              :             /* There's no telling what that did to the condition codes.  */
    2638        93124 :             CC_STATUS_INIT;
    2639              : 
    2640              :             /* Get out the operand values.  */
    2641        93124 :             string = decode_asm_operands (body, ops, NULL, NULL, NULL, &loc);
    2642              :             /* Inhibit dying on what would otherwise be compiler bugs.  */
    2643        93124 :             insn_noperands = noperands;
    2644        93124 :             this_is_asm_operands = insn;
    2645        93124 :             expanded = expand_location (loc);
    2646              : 
    2647              : #ifdef FINAL_PRESCAN_INSN
    2648              :             FINAL_PRESCAN_INSN (insn, ops, insn_noperands);
    2649              : #endif
    2650              : 
    2651              :             /* Output the insn using them.  */
    2652        93124 :             if (string[0])
    2653              :               {
    2654        20461 :                 app_enable ();
    2655        20461 :                 if (expanded.file && expanded.line)
    2656        20401 :                   fprintf (asm_out_file, "%s %i \"%s\" 1\n",
    2657              :                            ASM_COMMENT_START, expanded.line, expanded.file);
    2658        20461 :                 output_asm_insn (string, ops);
    2659              : #if HAVE_AS_LINE_ZERO
    2660        20461 :                 if (expanded.file && expanded.line)
    2661        20401 :                   fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
    2662              : #endif
    2663              :               }
    2664              : 
    2665        93124 :             if (targetm.asm_out.final_postscan_insn)
    2666            0 :               targetm.asm_out.final_postscan_insn (file, insn, ops,
    2667              :                                                    insn_noperands);
    2668              : 
    2669        93124 :             this_is_asm_operands = 0;
    2670        93124 :             break;
    2671              :           }
    2672              : 
    2673     94841744 :         app_disable ();
    2674              : 
    2675     94841744 :         if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (body))
    2676              :           {
    2677              :             /* A delayed-branch sequence */
    2678            0 :             int i;
    2679              : 
    2680            0 :             final_sequence = seq;
    2681              : 
    2682              :             /* The first insn in this SEQUENCE might be a JUMP_INSN that will
    2683              :                force the restoration of a comparison that was previously
    2684              :                thought unnecessary.  If that happens, cancel this sequence
    2685              :                and cause that insn to be restored.  */
    2686              : 
    2687            0 :             next = final_scan_insn (seq->insn (0), file, 0, 1, seen);
    2688            0 :             if (next != seq->insn (1))
    2689              :               {
    2690            0 :                 final_sequence = 0;
    2691            0 :                 return next;
    2692              :               }
    2693              : 
    2694            0 :             for (i = 1; i < seq->len (); i++)
    2695              :               {
    2696            0 :                 rtx_insn *insn = seq->insn (i);
    2697            0 :                 rtx_insn *next = NEXT_INSN (insn);
    2698              :                 /* We loop in case any instruction in a delay slot gets
    2699              :                    split.  */
    2700            0 :                 do
    2701            0 :                   insn = final_scan_insn (insn, file, 0, 1, seen);
    2702            0 :                 while (insn != next);
    2703              :               }
    2704              : #ifdef DBR_OUTPUT_SEQEND
    2705              :             DBR_OUTPUT_SEQEND (file);
    2706              : #endif
    2707            0 :             final_sequence = 0;
    2708              : 
    2709              :             /* If the insn requiring the delay slot was a CALL_INSN, the
    2710              :                insns in the delay slot are actually executed before the
    2711              :                called function.  Hence we don't preserve any CC-setting
    2712              :                actions in these insns and the CC must be marked as being
    2713              :                clobbered by the function.  */
    2714            0 :             if (CALL_P (seq->insn (0)))
    2715              :               {
    2716            0 :                 CC_STATUS_INIT;
    2717              :               }
    2718            0 :             break;
    2719              :           }
    2720              : 
    2721              :         /* We have a real machine instruction as rtl.  */
    2722              : 
    2723     94841744 :         body = PATTERN (insn);
    2724              : 
    2725              :         /* Do machine-specific peephole optimizations if desired.  */
    2726              : 
    2727     94841744 :         if (HAVE_peephole && optimize_p && !flag_no_peephole && !nopeepholes)
    2728              :           {
    2729              :             rtx_insn *next = peephole (insn);
    2730              :             /* When peepholing, if there were notes within the peephole,
    2731              :                emit them before the peephole.  */
    2732              :             if (next != 0 && next != NEXT_INSN (insn))
    2733              :               {
    2734              :                 rtx_insn *note, *prev = PREV_INSN (insn);
    2735              : 
    2736              :                 for (note = NEXT_INSN (insn); note != next;
    2737              :                      note = NEXT_INSN (note))
    2738              :                   final_scan_insn (note, file, optimize_p, nopeepholes, seen);
    2739              : 
    2740              :                 /* Put the notes in the proper position for a later
    2741              :                    rescan.  For example, the SH target can do this
    2742              :                    when generating a far jump in a delayed branch
    2743              :                    sequence.  */
    2744              :                 note = NEXT_INSN (insn);
    2745              :                 SET_PREV_INSN (note) = prev;
    2746              :                 SET_NEXT_INSN (prev) = note;
    2747              :                 SET_NEXT_INSN (PREV_INSN (next)) = insn;
    2748              :                 SET_PREV_INSN (insn) = PREV_INSN (next);
    2749              :                 SET_NEXT_INSN (insn) = next;
    2750              :                 SET_PREV_INSN (next) = insn;
    2751              :               }
    2752              : 
    2753              :             /* PEEPHOLE might have changed this.  */
    2754              :             body = PATTERN (insn);
    2755              :           }
    2756              : 
    2757              :         /* Try to recognize the instruction.
    2758              :            If successful, verify that the operands satisfy the
    2759              :            constraints for the instruction.  Crash if they don't,
    2760              :            since `reload' should have changed them so that they do.  */
    2761              : 
    2762     94841744 :         insn_code_number = recog_memoized (insn);
    2763     94841744 :         cleanup_subreg_operands (insn);
    2764              : 
    2765              :         /* Dump the insn in the assembly for debugging (-dAP).
    2766              :            If the final dump is requested as slim RTL, dump slim
    2767              :            RTL to the assembly file also.  */
    2768     94841744 :         if (flag_dump_rtl_in_asm)
    2769              :           {
    2770           29 :             print_rtx_head = ASM_COMMENT_START;
    2771           29 :             if (! (dump_flags & TDF_SLIM))
    2772           29 :               print_rtl_single (asm_out_file, insn);
    2773              :             else
    2774            0 :               dump_insn_slim (asm_out_file, insn);
    2775           29 :             print_rtx_head = "";
    2776              :           }
    2777              : 
    2778     94841744 :         if (! constrain_operands_cached (insn, 1))
    2779            0 :           fatal_insn_not_found (insn);
    2780              : 
    2781              :         /* Some target machines need to prescan each insn before
    2782              :            it is output.  */
    2783              : 
    2784              : #ifdef FINAL_PRESCAN_INSN
    2785              :         FINAL_PRESCAN_INSN (insn, recog_data.operand, recog_data.n_operands);
    2786              : #endif
    2787              : 
    2788     94841744 :         if (targetm.have_conditional_execution ()
    2789     94841744 :             && GET_CODE (PATTERN (insn)) == COND_EXEC)
    2790            0 :           current_insn_predicate = COND_EXEC_TEST (PATTERN (insn));
    2791              : 
    2792     94841744 :         current_output_insn = debug_insn = insn;
    2793              : 
    2794              :         /* Find the proper template for this insn.  */
    2795     94841744 :         templ = get_insn_template (insn_code_number, insn);
    2796              : 
    2797              :         /* If the C code returns 0, it means that it is a jump insn
    2798              :            which follows a deleted test insn, and that test insn
    2799              :            needs to be reinserted.  */
    2800     94841744 :         if (templ == 0)
    2801              :           {
    2802            0 :             rtx_insn *prev;
    2803              : 
    2804            0 :             gcc_assert (prev_nonnote_insn (insn) == last_ignored_compare);
    2805              : 
    2806              :             /* We have already processed the notes between the setter and
    2807              :                the user.  Make sure we don't process them again, this is
    2808              :                particularly important if one of the notes is a block
    2809              :                scope note or an EH note.  */
    2810            0 :             for (prev = insn;
    2811            0 :                  prev != last_ignored_compare;
    2812            0 :                  prev = PREV_INSN (prev))
    2813              :               {
    2814            0 :                 if (NOTE_P (prev))
    2815            0 :                   delete_insn (prev);   /* Use delete_note.  */
    2816              :               }
    2817              : 
    2818              :             return prev;
    2819              :           }
    2820              : 
    2821              :         /* If the template is the string "#", it means that this insn must
    2822              :            be split.  */
    2823     94841744 :         if (templ[0] == '#' && templ[1] == '\0')
    2824              :           {
    2825            0 :             rtx_insn *new_rtx = try_split (body, insn, 0);
    2826              : 
    2827              :             /* If we didn't split the insn, go away.  */
    2828            0 :             if (new_rtx == insn && PATTERN (new_rtx) == body)
    2829            0 :               fatal_insn ("could not split insn", insn);
    2830              : 
    2831              :             /* If we have a length attribute, this instruction should have
    2832              :                been split in shorten_branches, to ensure that we would have
    2833              :                valid length info for the splitees.  */
    2834            0 :             gcc_assert (!HAVE_ATTR_length);
    2835              : 
    2836              :             return new_rtx;
    2837              :           }
    2838              : 
    2839              :         /* ??? This will put the directives in the wrong place if
    2840              :            get_insn_template outputs assembly directly.  However calling it
    2841              :            before get_insn_template breaks if the insns is split.  */
    2842     94841744 :         if (targetm.asm_out.unwind_emit_before_insn
    2843     94841744 :             && targetm.asm_out.unwind_emit)
    2844            0 :           targetm.asm_out.unwind_emit (asm_out_file, insn);
    2845              : 
    2846     94841744 :         rtx_call_insn *call_insn = dyn_cast <rtx_call_insn *> (insn);
    2847      6299962 :         if (call_insn != NULL)
    2848              :           {
    2849      6299962 :             rtx x = call_from_call_insn (call_insn);
    2850      6299962 :             x = XEXP (x, 0);
    2851      6299962 :             if (x && MEM_P (x) && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
    2852              :               {
    2853      6094112 :                 tree t;
    2854      6094112 :                 x = XEXP (x, 0);
    2855      6094112 :                 t = SYMBOL_REF_DECL (x);
    2856      6094112 :                 if (t)
    2857      5832358 :                   assemble_external (t);
    2858              :               }
    2859              :           }
    2860              : 
    2861              :         /* Output assembler code from the template.  */
    2862     94841744 :         output_asm_insn (templ, recog_data.operand);
    2863              : 
    2864              :         /* Some target machines need to postscan each insn after
    2865              :            it is output.  */
    2866     94841744 :         if (targetm.asm_out.final_postscan_insn)
    2867            0 :           targetm.asm_out.final_postscan_insn (file, insn, recog_data.operand,
    2868            0 :                                                recog_data.n_operands);
    2869              : 
    2870     94841744 :         if (!targetm.asm_out.unwind_emit_before_insn
    2871            0 :             && targetm.asm_out.unwind_emit)
    2872            0 :           targetm.asm_out.unwind_emit (asm_out_file, insn);
    2873              : 
    2874              :         /* Let the debug info back-end know about this call.  We do this only
    2875              :            after the instruction has been emitted because labels that may be
    2876              :            created to reference the call instruction must appear after it.  */
    2877     52113468 :         if ((debug_variable_location_views || call_insn != NULL)
    2878     97852890 :             && !DECL_IGNORED_P (current_function_decl))
    2879     45708105 :           debug_hooks->var_location (insn);
    2880              : 
    2881     94841744 :         current_output_insn = debug_insn = 0;
    2882              :       }
    2883              :     }
    2884    275796250 :   return NEXT_INSN (insn);
    2885              : }
    2886              : 
    2887              : /* This is a wrapper around final_scan_insn_1 that allows ports to
    2888              :    call it recursively without a known value for SEEN.  The value is
    2889              :    saved at the outermost call, and recovered for recursive calls.
    2890              :    Recursive calls MUST pass NULL, or the same pointer if they can
    2891              :    otherwise get to it.  */
    2892              : 
    2893              : rtx_insn *
    2894    275796250 : final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p,
    2895              :                  int nopeepholes, int *seen)
    2896              : {
    2897    275796250 :   static int *enclosing_seen;
    2898    275796250 :   static int recursion_counter;
    2899              : 
    2900    275796250 :   gcc_assert (seen || recursion_counter);
    2901    275796250 :   gcc_assert (!recursion_counter || !seen || seen == enclosing_seen);
    2902              : 
    2903    275796250 :   if (!recursion_counter++)
    2904    275796250 :     enclosing_seen = seen;
    2905            0 :   else if (!seen)
    2906            0 :     seen = enclosing_seen;
    2907              : 
    2908    275796250 :   rtx_insn *ret = final_scan_insn_1 (insn, file, optimize_p, nopeepholes, seen);
    2909              : 
    2910    275796250 :   if (!--recursion_counter)
    2911    275796250 :     enclosing_seen = NULL;
    2912              : 
    2913    275796250 :   return ret;
    2914              : }
    2915              : 
    2916              : 
    2917              : 
    2918              : /* Map DECLs to instance discriminators.  This is allocated and
    2919              :    defined in ada/gcc-interfaces/trans.cc, when compiling with -gnateS.
    2920              :    Mappings from this table are saved and restored for LTO, so
    2921              :    link-time compilation will have this map set, at least in
    2922              :    partitions containing at least one DECL with an associated instance
    2923              :    discriminator.  */
    2924              : 
    2925              : decl_to_instance_map_t *decl_to_instance_map;
    2926              : 
    2927              : /* Return the instance number assigned to DECL.  */
    2928              : 
    2929              : static inline int
    2930            0 : map_decl_to_instance (const_tree decl)
    2931              : {
    2932            0 :   int *inst;
    2933              : 
    2934            0 :   if (!decl_to_instance_map || !decl || !DECL_P (decl))
    2935              :     return 0;
    2936              : 
    2937            0 :   inst = decl_to_instance_map->get (decl);
    2938              : 
    2939            0 :   if (!inst)
    2940              :     return 0;
    2941              : 
    2942            0 :   return *inst;
    2943              : }
    2944              : 
    2945              : /* Set DISCRIMINATOR to the appropriate value, possibly derived from LOC.  */
    2946              : 
    2947              : static inline int
    2948     97531679 : compute_discriminator (location_t loc)
    2949              : {
    2950     97531679 :   int discriminator;
    2951              : 
    2952     97531679 :   if (!decl_to_instance_map)
    2953     97531679 :     discriminator = get_discriminator_from_loc (loc);
    2954              :   else
    2955              :     {
    2956            0 :       tree block = LOCATION_BLOCK (loc);
    2957              : 
    2958            0 :       while (block && TREE_CODE (block) == BLOCK
    2959            0 :              && !inlined_function_outer_scope_p (block))
    2960            0 :         block = BLOCK_SUPERCONTEXT (block);
    2961              : 
    2962            0 :       tree decl;
    2963              : 
    2964            0 :       if (!block)
    2965            0 :         decl = current_function_decl;
    2966            0 :       else if (DECL_P (block))
    2967              :         decl = block;
    2968              :       else
    2969            0 :         decl = block_ultimate_origin (block);
    2970              : 
    2971            0 :       discriminator = map_decl_to_instance (decl);
    2972              :     }
    2973              : 
    2974     97531679 :   return discriminator;
    2975              : }
    2976              : 
    2977              : /* Return discriminator of the statement that produced this insn.  */
    2978              : int
    2979     85971247 : insn_discriminator (const rtx_insn *insn)
    2980              : {
    2981     85971247 :   return compute_discriminator (INSN_LOCATION (insn));
    2982              : }
    2983              : 
    2984              : /* Return whether a source line note needs to be emitted before INSN.
    2985              :    Sets IS_STMT to TRUE if the line should be marked as a possible
    2986              :    breakpoint location.  */
    2987              : 
    2988              : static bool
    2989    106448364 : notice_source_line (rtx_insn *insn, bool *is_stmt)
    2990              : {
    2991    106448364 :   const char *filename;
    2992    106448364 :   int linenum, columnnum;
    2993    106448364 :   int discriminator;
    2994              : 
    2995    106448364 :   if (NOTE_MARKER_P (insn))
    2996              :     {
    2997     11560449 :       location_t loc = NOTE_MARKER_LOCATION (insn);
    2998     11560449 :       expanded_location xloc = expand_location (loc);
    2999     11560449 :       if (xloc.line == 0
    3000     11560449 :           && (LOCATION_LOCUS (loc) == UNKNOWN_LOCATION
    3001           27 :               || LOCATION_LOCUS (loc) == BUILTINS_LOCATION))
    3002           17 :         return false;
    3003              : 
    3004     11560432 :       filename = xloc.file;
    3005     11560432 :       linenum = xloc.line;
    3006     11560432 :       columnnum = xloc.column;
    3007     11560432 :       discriminator = compute_discriminator (loc);
    3008     11560432 :       force_source_line = true;
    3009     11560432 :     }
    3010     94887915 :   else if (INSN_HAS_LOCATION (insn))
    3011              :     {
    3012     85880934 :       expanded_location xloc = insn_location (insn);
    3013     85880934 :       filename = xloc.file;
    3014     85880934 :       linenum = xloc.line;
    3015     85880934 :       columnnum = xloc.column;
    3016     85880934 :       discriminator = insn_discriminator (insn);
    3017              :     }
    3018              :   else
    3019              :     {
    3020              :       filename = NULL;
    3021              :       linenum = 0;
    3022              :       columnnum = 0;
    3023              :       discriminator = 0;
    3024              :     }
    3025              : 
    3026     97441366 :   if (filename == NULL)
    3027              :     return false;
    3028              : 
    3029     97441366 :   if (force_source_line
    3030     84627020 :       || filename != last_filename
    3031     81535586 :       || last_linenum != linenum
    3032     69302021 :       || (debug_column_info && last_columnnum != columnnum))
    3033              :     {
    3034     32722236 :       force_source_line = false;
    3035     32722236 :       last_filename = filename;
    3036     32722236 :       last_linenum = linenum;
    3037     32722236 :       last_columnnum = columnnum;
    3038     32722236 :       last_discriminator = discriminator;
    3039     32722236 :       if (is_stmt)
    3040     12438448 :         *is_stmt = true;
    3041     32722236 :       high_block_linenum = MAX (last_linenum, high_block_linenum);
    3042     32722236 :       high_function_linenum = MAX (last_linenum, high_function_linenum);
    3043     32722236 :       return true;
    3044              :     }
    3045              : 
    3046     64719130 :   if (SUPPORTS_DISCRIMINATOR && last_discriminator != discriminator)
    3047              :     {
    3048              :       /* If the discriminator changed, but the line number did not,
    3049              :          output the line table entry with is_stmt false so the
    3050              :          debugger does not treat this as a breakpoint location.  */
    3051      7052744 :       last_discriminator = discriminator;
    3052      7052744 :       if (is_stmt)
    3053      6482115 :         *is_stmt = false;
    3054              :       return true;
    3055              :     }
    3056              : 
    3057              :   return false;
    3058              : }
    3059              : 
    3060              : /* For each operand in INSN, simplify (subreg (reg)) so that it refers
    3061              :    directly to the desired hard register.  */
    3062              : 
    3063              : void
    3064    103468361 : cleanup_subreg_operands (rtx_insn *insn)
    3065              : {
    3066    103468361 :   int i;
    3067    103468361 :   bool changed = false;
    3068    103468361 :   extract_insn_cached (insn);
    3069    423361301 :   for (i = 0; i < recog_data.n_operands; i++)
    3070              :     {
    3071              :       /* The following test cannot use recog_data.operand when testing
    3072              :          for a SUBREG: the underlying object might have been changed
    3073              :          already if we are inside a match_operator expression that
    3074              :          matches the else clause.  Instead we test the underlying
    3075              :          expression directly.  */
    3076    216424579 :       if (GET_CODE (*recog_data.operand_loc[i]) == SUBREG)
    3077              :         {
    3078          235 :           recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i], true);
    3079          235 :           changed = true;
    3080              :         }
    3081    216424344 :       else if (GET_CODE (recog_data.operand[i]) == PLUS
    3082              :                || GET_CODE (recog_data.operand[i]) == MULT
    3083              :                || MEM_P (recog_data.operand[i]))
    3084     50635176 :         recog_data.operand[i] = walk_alter_subreg (recog_data.operand_loc[i], &changed);
    3085              :     }
    3086              : 
    3087    105610472 :   for (i = 0; i < recog_data.n_dups; i++)
    3088              :     {
    3089      2142111 :       if (GET_CODE (*recog_data.dup_loc[i]) == SUBREG)
    3090              :         {
    3091            0 :           *recog_data.dup_loc[i] = alter_subreg (recog_data.dup_loc[i], true);
    3092            0 :           changed = true;
    3093              :         }
    3094              :       else if (GET_CODE (*recog_data.dup_loc[i]) == PLUS
    3095              :                || GET_CODE (*recog_data.dup_loc[i]) == MULT
    3096              :                || MEM_P (*recog_data.dup_loc[i]))
    3097       578293 :         *recog_data.dup_loc[i] = walk_alter_subreg (recog_data.dup_loc[i], &changed);
    3098              :     }
    3099    103468361 :   if (changed)
    3100          235 :     df_insn_rescan (insn);
    3101    103468361 : }
    3102              : 
    3103              : /* If X is a SUBREG, try to replace it with a REG or a MEM, based on
    3104              :    the thing it is a subreg of.  Do it anyway if FINAL_P.  */
    3105              : 
    3106              : rtx
    3107      3338232 : alter_subreg (rtx *xp, bool final_p)
    3108              : {
    3109      3338232 :   rtx x = *xp;
    3110      3338232 :   rtx y = SUBREG_REG (x);
    3111              : 
    3112              :   /* simplify_subreg does not remove subreg from volatile references.
    3113              :      We are required to.  */
    3114      3338232 :   if (MEM_P (y))
    3115              :     {
    3116       231499 :       poly_int64 offset = SUBREG_BYTE (x);
    3117              : 
    3118              :       /* For paradoxical subregs on big-endian machines, SUBREG_BYTE
    3119              :          contains 0 instead of the proper offset.  See simplify_subreg.  */
    3120       231499 :       if (paradoxical_subreg_p (x))
    3121        32914 :         offset = byte_lowpart_offset (GET_MODE (x), GET_MODE (y));
    3122              : 
    3123       231499 :       if (final_p)
    3124          110 :         *xp = adjust_address (y, GET_MODE (x), offset);
    3125              :       else
    3126       231389 :         *xp = adjust_address_nv (y, GET_MODE (x), offset);
    3127              :     }
    3128      3106733 :   else if (REG_P (y) && HARD_REGISTER_P (y))
    3129              :     {
    3130      6213466 :       rtx new_rtx = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
    3131      3106733 :                                      SUBREG_BYTE (x));
    3132              : 
    3133      3106733 :       if (new_rtx != 0)
    3134      3101110 :         *xp = new_rtx;
    3135         5623 :       else if (final_p && REG_P (y))
    3136              :         {
    3137              :           /* Simplify_subreg can't handle some REG cases, but we have to.  */
    3138         2186 :           unsigned int regno;
    3139         2186 :           poly_int64 offset;
    3140              : 
    3141         2186 :           regno = subreg_regno (x);
    3142         2186 :           if (subreg_lowpart_p (x))
    3143         2186 :             offset = byte_lowpart_offset (GET_MODE (x), GET_MODE (y));
    3144              :           else
    3145            0 :             offset = SUBREG_BYTE (x);
    3146         2186 :           *xp = gen_rtx_REG_offset (y, GET_MODE (x), regno, offset);
    3147              :         }
    3148              :     }
    3149              : 
    3150      3338232 :   return *xp;
    3151              : }
    3152              : 
    3153              : /* Do alter_subreg on all the SUBREGs contained in X.  */
    3154              : 
    3155              : static rtx
    3156    171974514 : walk_alter_subreg (rtx *xp, bool *changed)
    3157              : {
    3158    171974514 :   rtx x = *xp;
    3159    171974514 :   switch (GET_CODE (x))
    3160              :     {
    3161     35865686 :     case PLUS:
    3162     35865686 :     case MULT:
    3163     35865686 :     case AND:
    3164     35865686 :     case ASHIFT:
    3165     35865686 :       XEXP (x, 0) = walk_alter_subreg (&XEXP (x, 0), changed);
    3166     35865686 :       XEXP (x, 1) = walk_alter_subreg (&XEXP (x, 1), changed);
    3167     35865686 :       break;
    3168              : 
    3169     45050311 :     case MEM:
    3170     45050311 :     case ZERO_EXTEND:
    3171     45050311 :       XEXP (x, 0) = walk_alter_subreg (&XEXP (x, 0), changed);
    3172     45050311 :       break;
    3173              : 
    3174            0 :     case SUBREG:
    3175            0 :       *changed = true;
    3176            0 :       return alter_subreg (xp, true);
    3177              : 
    3178              :     default:
    3179              :       break;
    3180              :     }
    3181              : 
    3182    171974514 :   return *xp;
    3183              : }
    3184              : 
    3185              : /* Report inconsistency between the assembler template and the operands.
    3186              :    In an `asm', it's the user's fault; otherwise, the compiler's fault.  */
    3187              : 
    3188              : void
    3189           23 : output_operand_lossage (const char *cmsgid, ...)
    3190              : {
    3191           23 :   char *fmt_string;
    3192           23 :   char *new_message;
    3193           23 :   const char *pfx_str;
    3194           23 :   va_list ap;
    3195              : 
    3196           23 :   va_start (ap, cmsgid);
    3197              : 
    3198           23 :   pfx_str = this_is_asm_operands ? _("invalid 'asm': ") : "output_operand: ";
    3199           23 :   fmt_string = xasprintf ("%s%s", pfx_str, _(cmsgid));
    3200           23 :   new_message = xvasprintf (fmt_string, ap);
    3201              : 
    3202           23 :   if (this_is_asm_operands)
    3203           23 :     error_for_asm (this_is_asm_operands, "%s", new_message);
    3204              :   else
    3205            0 :     internal_error ("%s", new_message);
    3206              : 
    3207           23 :   free (fmt_string);
    3208           23 :   free (new_message);
    3209           23 :   va_end (ap);
    3210           23 : }
    3211              : 
    3212              : /* Output of assembler code from a template, and its subroutines.  */
    3213              : 
    3214              : /* Annotate the assembly with a comment describing the pattern and
    3215              :    alternative used.  */
    3216              : 
    3217              : static void
    3218         3536 : output_asm_name (void)
    3219              : {
    3220         3536 :   if (debug_insn)
    3221              :     {
    3222         3382 :       fprintf (asm_out_file, "\t%s %d\t",
    3223         3382 :                ASM_COMMENT_START, INSN_UID (debug_insn));
    3224              : 
    3225         3382 :       fprintf (asm_out_file, "[c=%d",
    3226              :                insn_cost (debug_insn, optimize_insn_for_speed_p ()));
    3227         3382 :       if (HAVE_ATTR_length)
    3228         3382 :         fprintf (asm_out_file, " l=%d",
    3229              :                  get_attr_length (debug_insn));
    3230         3382 :       fprintf (asm_out_file, "]  ");
    3231              : 
    3232         3382 :       int num = INSN_CODE (debug_insn);
    3233         3382 :       fprintf (asm_out_file, "%s", insn_data[num].name);
    3234         3382 :       if (insn_data[num].n_alternatives > 1)
    3235         1967 :         fprintf (asm_out_file, "/%d", which_alternative);
    3236              : 
    3237              :       /* Clear this so only the first assembler insn
    3238              :          of any rtl insn will get the special comment for -dp.  */
    3239         3382 :       debug_insn = 0;
    3240              :     }
    3241         3536 : }
    3242              : 
    3243              : /* If OP is a REG or MEM and we can find a MEM_EXPR corresponding to it
    3244              :    or its address, return that expr .  Set *PADDRESSP to 1 if the expr
    3245              :    corresponds to the address of the object and 0 if to the object.  */
    3246              : 
    3247              : static tree
    3248          406 : get_mem_expr_from_op (rtx op, int *paddressp)
    3249              : {
    3250          406 :   tree expr;
    3251          406 :   int inner_addressp;
    3252              : 
    3253          406 :   *paddressp = 0;
    3254              : 
    3255          406 :   if (REG_P (op))
    3256          259 :     return REG_EXPR (op);
    3257          147 :   else if (!MEM_P (op))
    3258              :     return 0;
    3259              : 
    3260           51 :   if (MEM_EXPR (op) != 0)
    3261              :     return MEM_EXPR (op);
    3262              : 
    3263              :   /* Otherwise we have an address, so indicate it and look at the address.  */
    3264            0 :   *paddressp = 1;
    3265            0 :   op = XEXP (op, 0);
    3266              : 
    3267              :   /* First check if we have a decl for the address, then look at the right side
    3268              :      if it is a PLUS.  Otherwise, strip off arithmetic and keep looking.
    3269              :      But don't allow the address to itself be indirect.  */
    3270            0 :   if ((expr = get_mem_expr_from_op (op, &inner_addressp)) && ! inner_addressp)
    3271              :     return expr;
    3272            0 :   else if (GET_CODE (op) == PLUS
    3273            0 :            && (expr = get_mem_expr_from_op (XEXP (op, 1), &inner_addressp)))
    3274              :     return expr;
    3275              : 
    3276            0 :   while (UNARY_P (op)
    3277            0 :          || GET_RTX_CLASS (GET_CODE (op)) == RTX_BIN_ARITH)
    3278            0 :     op = XEXP (op, 0);
    3279              : 
    3280            0 :   expr = get_mem_expr_from_op (op, &inner_addressp);
    3281            0 :   return inner_addressp ? 0 : expr;
    3282              : }
    3283              : 
    3284              : /* Output operand names for assembler instructions.  OPERANDS is the
    3285              :    operand vector, OPORDER is the order to write the operands, and NOPS
    3286              :    is the number of operands to write.  */
    3287              : 
    3288              : static void
    3289          248 : output_asm_operand_names (rtx *operands, int *oporder, int nops)
    3290              : {
    3291          248 :   int wrote = 0;
    3292          248 :   int i;
    3293              : 
    3294          654 :   for (i = 0; i < nops; i++)
    3295              :     {
    3296          406 :       int addressp;
    3297          406 :       int opnum = oporder[i];
    3298              :       /* Skip invalid ops. */
    3299          406 :       if (opnum == MAX_RECOG_OPERANDS)
    3300            0 :         continue;
    3301          406 :       rtx op = operands[opnum];
    3302          406 :       tree expr = get_mem_expr_from_op (op, &addressp);
    3303              : 
    3304          634 :       fprintf (asm_out_file, "%c%s",
    3305              :                wrote ? ',' : '\t', wrote ? "" : ASM_COMMENT_START);
    3306          406 :       wrote = 1;
    3307          406 :       if (expr)
    3308              :         {
    3309          231 :           fprintf (asm_out_file, "%s",
    3310          231 :                    addressp ? "*" : "");
    3311          231 :           print_mem_expr (asm_out_file, expr);
    3312          231 :           wrote = 1;
    3313              :         }
    3314           79 :       else if (REG_P (op) && ORIGINAL_REGNO (op)
    3315          243 :                && ORIGINAL_REGNO (op) != REGNO (op))
    3316           41 :         fprintf (asm_out_file, " tmp%i", ORIGINAL_REGNO (op));
    3317              :     }
    3318          248 : }
    3319              : 
    3320              : #ifdef ASSEMBLER_DIALECT
    3321              : /* Helper function to parse assembler dialects in the asm string.
    3322              :    This is called from output_asm_insn and asm_fprintf.  */
    3323              : static const char *
    3324    258919462 : do_assembler_dialects (const char *p, int *dialect)
    3325              : {
    3326    258919462 :   char c = *(p - 1);
    3327              : 
    3328    258919462 :   switch (c)
    3329              :     {
    3330    129459730 :     case '{':
    3331    129459730 :       {
    3332    129459730 :         int i;
    3333              : 
    3334    129459730 :         if (*dialect)
    3335            0 :           output_operand_lossage ("nested assembly dialect alternatives");
    3336              :         else
    3337    129459730 :           *dialect = 1;
    3338              : 
    3339              :         /* If we want the first dialect, do nothing.  Otherwise, skip
    3340              :            DIALECT_NUMBER of strings ending with '|'.  */
    3341    129460831 :         for (i = 0; i < dialect_number; i++)
    3342              :           {
    3343         9311 :             while (*p && *p != '}')
    3344              :               {
    3345         8733 :                 if (*p == '|')
    3346              :                   {
    3347         1102 :                     p++;
    3348         1102 :                     break;
    3349              :                   }
    3350              : 
    3351              :                 /* Skip over any character after a percent sign.  */
    3352         7631 :                 if (*p == '%')
    3353         2722 :                   p++;
    3354         7631 :                 if (*p)
    3355         7631 :                   p++;
    3356              :               }
    3357              : 
    3358         1680 :             if (*p == '}')
    3359              :               break;
    3360              :           }
    3361              : 
    3362    129459730 :         if (*p == '\0')
    3363            0 :           output_operand_lossage ("unterminated assembly dialect alternative");
    3364              :       }
    3365              :       break;
    3366              : 
    3367     66442818 :     case '|':
    3368     66442818 :       if (*dialect)
    3369              :         {
    3370              :           /* Skip to close brace.  */
    3371    353043295 :           do
    3372              :             {
    3373    353043295 :               if (*p == '\0')
    3374              :                 {
    3375            0 :                   output_operand_lossage ("unterminated assembly dialect alternative");
    3376            0 :                   break;
    3377              :                 }
    3378              : 
    3379              :               /* Skip over any character after a percent sign.  */
    3380    353043295 :               if (*p == '%' && p[1])
    3381              :                 {
    3382    130221008 :                   p += 2;
    3383    130221008 :                   continue;
    3384              :                 }
    3385              : 
    3386    222822287 :               if (*p++ == '}')
    3387              :                 break;
    3388              :             }
    3389              :           while (1);
    3390              : 
    3391     66442817 :           *dialect = 0;
    3392              :         }
    3393              :       else
    3394            1 :         putc (c, asm_out_file);
    3395              :       break;
    3396              : 
    3397     63016914 :     case '}':
    3398     63016914 :       if (! *dialect)
    3399            1 :         putc (c, asm_out_file);
    3400     63016914 :       *dialect = 0;
    3401     63016914 :       break;
    3402            0 :     default:
    3403            0 :       gcc_unreachable ();
    3404              :     }
    3405              : 
    3406    258919462 :   return p;
    3407              : }
    3408              : #endif
    3409              : 
    3410              : static rtx *current_modifier_operands;
    3411              : static const vec<unsigned long> *current_modifier_opnums;
    3412              : 
    3413              : /* Return the Nth operand of the current multi-operand modifier.  */
    3414              : 
    3415              : rtx
    3416           12 : output_operand_modifier_operand (int code, unsigned int n)
    3417              : {
    3418           12 :   if (code < PRINT_OPERAND_MODIFIER_BASE
    3419           12 :       || !current_modifier_opnums
    3420           24 :       || n >= current_modifier_opnums->length ())
    3421              :     return nullptr;
    3422            8 :   rtx x = current_modifier_operands[(*current_modifier_opnums)[n]];
    3423            8 :   if (x && GET_CODE (x) == SUBREG)
    3424            0 :     x = alter_subreg (&x, true);
    3425            8 :   if (x)
    3426            8 :     mark_symbol_refs_as_used (x);
    3427            8 :   return x;
    3428              : }
    3429              : 
    3430              : /* Output OPERAND, which was parsed from a %[...] reference.  */
    3431              : 
    3432              : static void
    3433          156 : output_bracketed_operand (bracketed_operand &operand, rtx *operands,
    3434              :                           int *oporder, char *opoutput, int &ops)
    3435              : {
    3436          156 :   if (this_is_asm_operands)
    3437          624 :     for (unsigned long opnum : operand.opnums)
    3438          156 :       if (opnum >= insn_noperands)
    3439              :         {
    3440            0 :           output_operand_lossage ("operand number out of range");
    3441            0 :           return;
    3442              :         }
    3443          156 :   unsigned long opnum = operand.opnums[0];
    3444          156 :   if (!operand.modifier.empty ())
    3445              :     {
    3446            0 :       int code = targetm.asm_out.print_operand_modifier
    3447            0 :         (operand.modifier, this_is_asm_operands != NULL);
    3448            0 :       if (code < PRINT_OPERAND_MODIFIER_BASE)
    3449              :         {
    3450            0 :           output_operand_lossage ("invalid operand modifier '%.*s'",
    3451            0 :                                   (int) operand.modifier.size (),
    3452              :                                   operand.modifier.begin ());
    3453            0 :           return;
    3454              :         }
    3455            0 :       rtx *saved_operands = current_modifier_operands;
    3456            0 :       const vec<unsigned long> *saved_opnums = current_modifier_opnums;
    3457            0 :       current_modifier_operands = operands;
    3458            0 :       current_modifier_opnums = &operand.opnums;
    3459            0 :       output_operand (operands[opnum], code);
    3460            0 :       current_modifier_operands = saved_operands;
    3461            0 :       current_modifier_opnums = saved_opnums;
    3462              :     }
    3463              :   else
    3464          156 :     output_operand (operands[opnum], 0);
    3465              : 
    3466          624 :   for (unsigned long number : operand.opnums)
    3467              :     {
    3468          156 :       if (!opoutput[number])
    3469          154 :         oporder[ops++] = number;
    3470          156 :       opoutput[number] = 1;
    3471              :     }
    3472              : }
    3473              : 
    3474              : /* Output text from TEMPLATE to the assembler output file,
    3475              :    obeying %-directions to substitute operands taken from
    3476              :    the vector OPERANDS.
    3477              : 
    3478              :    %N (for N a digit) means print operand N in usual manner.
    3479              :    %lN means require operand N to be a CODE_LABEL or LABEL_REF
    3480              :       and print the label name with no punctuation.
    3481              :    %cN means require operand N to be a constant
    3482              :       and print the constant expression with no punctuation.
    3483              :    %aN means expect operand N to be a memory address
    3484              :       (not a memory reference!) and print a reference
    3485              :       to that address.
    3486              :    %nN means expect operand N to be a constant
    3487              :       and print a constant expression for minus the value
    3488              :       of the operand, with no other punctuation.  */
    3489              : 
    3490              : void
    3491    107201054 : output_asm_insn (const char *templ, rtx *operands)
    3492              : {
    3493    107201054 :   const char *p;
    3494    107201054 :   int c;
    3495              : #ifdef ASSEMBLER_DIALECT
    3496    107201054 :   int dialect = 0;
    3497              : #endif
    3498    107201054 :   int oporder[MAX_RECOG_OPERANDS+1];
    3499    107201054 :   char opoutput[MAX_RECOG_OPERANDS+1];
    3500    107201054 :   int ops = 0;
    3501              : 
    3502              :   /* An insn may return a null string template
    3503              :      in a case where no assembler code is needed.  */
    3504    107201054 :   if (*templ == 0)
    3505     13185547 :     return;
    3506              : 
    3507     94015507 :   memset (opoutput, 0, sizeof opoutput);
    3508     94015507 :   p = templ;
    3509     94015507 :   putc ('\t', asm_out_file);
    3510              : 
    3511              : #ifdef ASM_OUTPUT_OPCODE
    3512    101714193 :   ASM_OUTPUT_OPCODE (asm_out_file, p);
    3513              : #endif
    3514              : 
    3515   1154004975 :   while ((c = *p++))
    3516   1059989468 :     switch (c)
    3517              :       {
    3518        39011 :       case '\n':
    3519        39011 :         if (flag_verbose_asm)
    3520            0 :           output_asm_operand_names (operands, oporder, ops);
    3521        39011 :         if (flag_print_asm_name)
    3522           74 :           output_asm_name ();
    3523              : 
    3524        39011 :         ops = 0;
    3525        39011 :         memset (opoutput, 0, sizeof opoutput);
    3526              : 
    3527        39011 :         putc (c, asm_out_file);
    3528              : #ifdef ASM_OUTPUT_OPCODE
    3529       113519 :         while ((c = *p) == '\t')
    3530              :           {
    3531        35497 :             putc (c, asm_out_file);
    3532        35497 :             p++;
    3533              :           }
    3534        39011 :         ASM_OUTPUT_OPCODE (asm_out_file, p);
    3535              : #endif
    3536              :         break;
    3537              : 
    3538              : #ifdef ASSEMBLER_DIALECT
    3539    258919462 :       case '{':
    3540    258919462 :       case '}':
    3541    258919462 :       case '|':
    3542    258919462 :         p = do_assembler_dialects (p, &dialect);
    3543    258919462 :         break;
    3544              : #endif
    3545              : 
    3546    190661825 :       case '%':
    3547              :         /* %% outputs a single %.  %{, %} and %| print {, } and | respectively
    3548              :            if ASSEMBLER_DIALECT defined and these characters have a special
    3549              :            meaning as dialect delimiters.*/
    3550    190661825 :         if (*p == '%'
    3551              : #ifdef ASSEMBLER_DIALECT
    3552    190646568 :             || *p == '{' || *p == '}' || *p == '|'
    3553              : #endif
    3554              :             )
    3555              :           {
    3556       135557 :             putc (*p, asm_out_file);
    3557       135557 :             p++;
    3558              :           }
    3559              :         /* %= outputs a number which is unique to each insn in the entire
    3560              :            compilation.  This is useful for making local labels that are
    3561              :            referred to more than once in a given insn.  */
    3562    190526268 :         else if (*p == '=')
    3563              :           {
    3564           19 :             p++;
    3565           19 :             fprintf (asm_out_file, "%d", insn_counter);
    3566              :           }
    3567    190526249 :         else if (*p == '[')
    3568              :           {
    3569          156 :             bracketed_operand operand;
    3570          156 :             if (!parse_bracketed_operand (&p, operand))
    3571              :               {
    3572            0 :                 output_operand_lossage ("invalid %%[...] operand modifier");
    3573            0 :                 break;
    3574              :               }
    3575          156 :             output_bracketed_operand (operand, operands, oporder, opoutput,
    3576              :                                       ops);
    3577          156 :             c = *p;
    3578          156 :           }
    3579              :         /* % followed by a letter and some digits
    3580              :            outputs an operand in a special way depending on the letter.
    3581              :            Letters `acln' are implemented directly.
    3582              :            Other letters are passed to `output_operand' so that
    3583              :            the TARGET_PRINT_OPERAND hook can define them.  */
    3584    190526093 :         else if (ISALPHA (*p))
    3585              :           {
    3586     50260236 :             int letter = *p++;
    3587     50260236 :             unsigned long opnum;
    3588     50260236 :             char *endptr;
    3589     50260236 :             int letter2 = 0;
    3590              : 
    3591     50260236 :             if (letter == 'c' && *p == 'c')
    3592           98 :               letter2 = *p++;
    3593     50260236 :             opnum = strtoul (p, &endptr, 10);
    3594              : 
    3595     50260236 :             if (endptr == p)
    3596            0 :               output_operand_lossage ("operand number missing "
    3597              :                                       "after %%-letter");
    3598     50260236 :             else if (this_is_asm_operands && opnum >= insn_noperands)
    3599              :               {
    3600              :                 /* Force the opnum in bounds to a bogus location. */
    3601            4 :                 opnum = MAX_RECOG_OPERANDS;
    3602            4 :                 output_operand_lossage ("operand number out of range");
    3603              :               }
    3604     50260232 :             else if (letter == 'l')
    3605      8893534 :               output_asm_label (operands[opnum]);
    3606     41366698 :             else if (letter == 'a')
    3607         2283 :               output_address (VOIDmode, operands[opnum]);
    3608     41364415 :             else if (letter == 'c')
    3609              :               {
    3610       242611 :                 if (letter2 == 'c' || CONSTANT_ADDRESS_P (operands[opnum]))
    3611         1559 :                   output_addr_const (asm_out_file, operands[opnum]);
    3612              :                 else
    3613       241052 :                   output_operand (operands[opnum], 'c');
    3614              :               }
    3615     41121804 :             else if (letter == 'n')
    3616              :               {
    3617            0 :                 if (CONST_INT_P (operands[opnum]))
    3618            0 :                   fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC,
    3619            0 :                            - INTVAL (operands[opnum]));
    3620              :                 else
    3621              :                   {
    3622            0 :                     putc ('-', asm_out_file);
    3623            0 :                     output_addr_const (asm_out_file, operands[opnum]);
    3624              :                   }
    3625              :               }
    3626              :             else
    3627     41121804 :               output_operand (operands[opnum], letter);
    3628              : 
    3629     50260236 :             if (!opoutput[opnum])
    3630     47906578 :               oporder[ops++] = opnum;
    3631     50260236 :             opoutput[opnum] = 1;
    3632              : 
    3633     50260236 :             p = endptr;
    3634     50260236 :             c = *p;
    3635              :           }
    3636              :         /* % followed by a digit outputs an operand the default way.  */
    3637    140265857 :         else if (ISDIGIT (*p))
    3638              :           {
    3639    118328052 :             unsigned long opnum;
    3640    118328052 :             char *endptr;
    3641              : 
    3642    118328052 :             opnum = strtoul (p, &endptr, 10);
    3643    118328052 :             if (this_is_asm_operands && opnum >= insn_noperands)
    3644              :               {
    3645              :                 /* Force the opnum in bounds to a bogus location. */
    3646            3 :                 opnum = MAX_RECOG_OPERANDS;
    3647            3 :                 output_operand_lossage ("operand number out of range");
    3648              :               }
    3649              :             else
    3650    118328049 :               output_operand (operands[opnum], 0);
    3651              : 
    3652    118328052 :             if (!opoutput[opnum])
    3653    115977309 :               oporder[ops++] = opnum;
    3654    118328052 :             opoutput[opnum] = 1;
    3655              : 
    3656    118328052 :             p = endptr;
    3657    118328052 :             c = *p;
    3658              :           }
    3659              :         /* % followed by punctuation: output something for that
    3660              :            punctuation character alone, with no operand.  The
    3661              :            TARGET_PRINT_OPERAND hook decides what is actually done.  */
    3662     21937805 :         else if (targetm.asm_out.print_operand_punct_valid_p ((unsigned char) *p))
    3663     21937805 :           output_operand (NULL_RTX, *p++);
    3664              :         else
    3665            0 :           output_operand_lossage ("invalid %%-code");
    3666              :         break;
    3667              : 
    3668    610369170 :       default:
    3669    610369170 :         putc (c, asm_out_file);
    3670              :       }
    3671              : 
    3672              :   /* Try to keep the asm a bit more readable.  */
    3673     94015507 :   if ((flag_verbose_asm || flag_print_asm_name) && strlen (templ) < 9)
    3674          415 :     putc ('\t', asm_out_file);
    3675              : 
    3676              :   /* Write out the variable names for operands, if we know them.  */
    3677     94015507 :   if (flag_verbose_asm)
    3678          248 :     output_asm_operand_names (operands, oporder, ops);
    3679     94015507 :   if (flag_print_asm_name)
    3680         3462 :     output_asm_name ();
    3681              : 
    3682     94015507 :   putc ('\n', asm_out_file);
    3683              : }
    3684              : 
    3685              : /* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol.  */
    3686              : 
    3687              : void
    3688      8901247 : output_asm_label (rtx x)
    3689              : {
    3690      8901247 :   char buf[256];
    3691              : 
    3692      8901247 :   if (GET_CODE (x) == LABEL_REF)
    3693         7873 :     x = label_ref_label (x);
    3694      8901247 :   rtx_note *note = dyn_cast<rtx_note *> (x);
    3695      8901247 :   if (LABEL_P (x)
    3696          104 :       || (note
    3697          104 :           && NOTE_KIND (note) == NOTE_INSN_DELETED_LABEL))
    3698      8901247 :     ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
    3699              :   else
    3700            0 :     output_operand_lossage ("'%%l' operand isn't a label");
    3701              : 
    3702      8901247 :   assemble_name (asm_out_file, buf);
    3703      8901247 : }
    3704              : 
    3705              : /* Marks SYMBOL_REFs in x as referenced through use of assemble_external.  */
    3706              : 
    3707              : void
    3708    159691069 : mark_symbol_refs_as_used (rtx x)
    3709              : {
    3710    159691069 :   subrtx_iterator::array_type array;
    3711    436092870 :   FOR_EACH_SUBRTX (iter, array, x, ALL)
    3712              :     {
    3713    276401801 :       const_rtx x = *iter;
    3714    276401801 :       if (GET_CODE (x) == SYMBOL_REF)
    3715     16349204 :         if (tree t = SYMBOL_REF_DECL (x))
    3716     15149004 :           assemble_external (t);
    3717              :     }
    3718    159691069 : }
    3719              : 
    3720              : /* Print operand X using machine-dependent assembler syntax.
    3721              :    CODE is a non-digit that preceded the operand-number in the % spec,
    3722              :    such as 'z' if the spec was `%z3'.  CODE is 0 if there was no char
    3723              :    between the % and the digits.
    3724              :    When CODE is a non-letter, X is 0.
    3725              : 
    3726              :    The meanings of the letters are machine-dependent and controlled
    3727              :    by TARGET_PRINT_OPERAND.  */
    3728              : 
    3729              : void
    3730    181628866 : output_operand (rtx x, int code ATTRIBUTE_UNUSED)
    3731              : {
    3732    181628866 :   if (x && GET_CODE (x) == SUBREG)
    3733            0 :     x = alter_subreg (&x, true);
    3734              : 
    3735              :   /* X must not be a pseudo reg.  */
    3736    181628866 :   if (!targetm.no_register_allocation)
    3737    181628866 :     gcc_assert (!x || !REG_P (x) || REGNO (x) < FIRST_PSEUDO_REGISTER);
    3738              : 
    3739    181628866 :   targetm.asm_out.print_operand (asm_out_file, x, code);
    3740              : 
    3741    181628866 :   if (x == NULL_RTX)
    3742              :     return;
    3743              : 
    3744    159691061 :   mark_symbol_refs_as_used (x);
    3745              : }
    3746              : 
    3747              : /* Print a memory reference operand for address X using
    3748              :    machine-dependent assembler syntax.  */
    3749              : 
    3750              : void
    3751      3979362 : output_address (machine_mode mode, rtx x)
    3752              : {
    3753      3979362 :   bool changed = false;
    3754      3979362 :   walk_alter_subreg (&x, &changed);
    3755      3979362 :   targetm.asm_out.print_operand_address (asm_out_file, mode, x);
    3756      3979362 : }
    3757              : 
    3758              : /* Print an integer constant expression in assembler syntax.
    3759              :    Addition and subtraction are the only arithmetic
    3760              :    that may appear in these expressions.  */
    3761              : 
    3762              : void
    3763    168329472 : output_addr_const (FILE *file, rtx x)
    3764              : {
    3765    179016781 :   char buf[256];
    3766              : 
    3767    179016781 :  restart:
    3768    179016781 :   switch (GET_CODE (x))
    3769              :     {
    3770          550 :     case PC:
    3771          550 :       putc ('.', file);
    3772          550 :       break;
    3773              : 
    3774    129120903 :     case SYMBOL_REF:
    3775    129120903 :       if (SYMBOL_REF_DECL (x))
    3776     21020669 :         assemble_external (SYMBOL_REF_DECL (x));
    3777              : #ifdef ASM_OUTPUT_SYMBOL_REF
    3778    129120903 :       ASM_OUTPUT_SYMBOL_REF (file, x);
    3779              : #else
    3780              :       assemble_name (file, XSTR (x, 0));
    3781              : #endif
    3782              :       break;
    3783              : 
    3784        15132 :     case LABEL_REF:
    3785        15132 :       x = label_ref_label (x);
    3786              :       /* Fall through.  */
    3787        15132 :     case CODE_LABEL:
    3788        15132 :       ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
    3789              : #ifdef ASM_OUTPUT_LABEL_REF
    3790              :       ASM_OUTPUT_LABEL_REF (file, buf);
    3791              : #else
    3792        15132 :       assemble_name (file, buf);
    3793              : #endif
    3794        15132 :       break;
    3795              : 
    3796     39178010 :     case CONST_INT:
    3797     39178010 :       fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
    3798     39178010 :       break;
    3799              : 
    3800      2749495 :     case CONST:
    3801              :       /* This used to output parentheses around the expression,
    3802              :          but that does not work on the 386 (either ATT or BSD assembler).  */
    3803      2749495 :       output_addr_const (file, XEXP (x, 0));
    3804      2749495 :       break;
    3805              : 
    3806            2 :     case CONST_WIDE_INT:
    3807              :       /* We do not know the mode here so we have to use a round about
    3808              :          way to build a wide-int to get it printed properly.  */
    3809            2 :       {
    3810            2 :         wide_int w = wide_int::from_array (&CONST_WIDE_INT_ELT (x, 0),
    3811            2 :                                            CONST_WIDE_INT_NUNITS (x),
    3812            2 :                                            CONST_WIDE_INT_NUNITS (x)
    3813            2 :                                            * HOST_BITS_PER_WIDE_INT,
    3814            2 :                                            false);
    3815            2 :         print_decs (w, file);
    3816            2 :       }
    3817            2 :       break;
    3818              : 
    3819            0 :     case CONST_DOUBLE:
    3820            0 :       if (CONST_DOUBLE_AS_INT_P (x))
    3821              :         {
    3822              :           /* We can use %d if the number is one word and positive.  */
    3823            0 :           if (CONST_DOUBLE_HIGH (x))
    3824            0 :             fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
    3825              :                      (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (x),
    3826            0 :                      (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x));
    3827            0 :           else if (CONST_DOUBLE_LOW (x) < 0)
    3828            0 :             fprintf (file, HOST_WIDE_INT_PRINT_HEX,
    3829              :                      (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x));
    3830              :           else
    3831            0 :             fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_DOUBLE_LOW (x));
    3832              :         }
    3833              :       else
    3834              :         /* We can't handle floating point constants;
    3835              :            PRINT_OPERAND must handle them.  */
    3836            0 :         output_operand_lossage ("floating constant misused");
    3837              :       break;
    3838              : 
    3839            0 :     case CONST_FIXED:
    3840            0 :       fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_FIXED_VALUE_LOW (x));
    3841            0 :       break;
    3842              : 
    3843      2769551 :     case PLUS:
    3844              :       /* Some assemblers need integer constants to appear last (eg masm).  */
    3845      2769551 :       if (CONST_INT_P (XEXP (x, 0)))
    3846              :         {
    3847            0 :           output_addr_const (file, XEXP (x, 1));
    3848            0 :           if (INTVAL (XEXP (x, 0)) >= 0)
    3849            0 :             fprintf (file, "+");
    3850            0 :           output_addr_const (file, XEXP (x, 0));
    3851              :         }
    3852              :       else
    3853              :         {
    3854      2769551 :           output_addr_const (file, XEXP (x, 0));
    3855      2769551 :           if (!CONST_INT_P (XEXP (x, 1))
    3856      2769551 :               || INTVAL (XEXP (x, 1)) >= 0)
    3857      2742976 :             fprintf (file, "+");
    3858      2769551 :           output_addr_const (file, XEXP (x, 1));
    3859              :         }
    3860              :       break;
    3861              : 
    3862      5168269 :     case MINUS:
    3863              :       /* Avoid outputting things like x-x or x+5-x,
    3864              :          since some assemblers can't handle that.  */
    3865      5168269 :       x = simplify_subtraction (x);
    3866      5168269 :       if (GET_CODE (x) != MINUS)
    3867            0 :         goto restart;
    3868              : 
    3869      5168269 :       output_addr_const (file, XEXP (x, 0));
    3870      5168269 :       fprintf (file, "-");
    3871      5168269 :       if ((CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) >= 0)
    3872              :           || GET_CODE (XEXP (x, 1)) == PC
    3873              :           || GET_CODE (XEXP (x, 1)) == SYMBOL_REF
    3874              :           || GET_CODE (XEXP (x, 1)) == LABEL_REF
    3875              :           || GET_CODE (XEXP (x, 1)) == CODE_LABEL)
    3876              :         output_addr_const (file, XEXP (x, 1));
    3877              :       else
    3878              :         {
    3879            6 :           fputs (targetm.asm_out.open_paren, file);
    3880            6 :           output_addr_const (file, XEXP (x, 1));
    3881            6 :           fputs (targetm.asm_out.close_paren, file);
    3882              :         }
    3883              :       break;
    3884              : 
    3885            0 :     case ZERO_EXTEND:
    3886            0 :     case SIGN_EXTEND:
    3887            0 :     case SUBREG:
    3888            0 :     case TRUNCATE:
    3889            0 :       output_addr_const (file, XEXP (x, 0));
    3890            0 :       break;
    3891              : 
    3892        14869 :     default:
    3893        14869 :       if (targetm.asm_out.output_addr_const_extra (file, x))
    3894              :         break;
    3895              : 
    3896            0 :       output_operand_lossage ("invalid expression as operand");
    3897              :     }
    3898    168329472 : }
    3899              : 
    3900              : /* Output a quoted string.  */
    3901              : 
    3902              : void
    3903      1605340 : output_quoted_string (FILE *asm_file, const char *string)
    3904              : {
    3905              : #ifdef OUTPUT_QUOTED_STRING
    3906              :   OUTPUT_QUOTED_STRING (asm_file, string);
    3907              : #else
    3908      1605340 :   char c;
    3909              : 
    3910      1605340 :   putc ('\"', asm_file);
    3911     95848412 :   while ((c = *string++) != 0)
    3912              :     {
    3913     92637732 :       if (ISPRINT (c))
    3914              :         {
    3915     92637720 :           if (c == '\"' || c == '\\')
    3916           15 :             putc ('\\', asm_file);
    3917     92637720 :           putc (c, asm_file);
    3918              :         }
    3919              :       else
    3920           12 :         fprintf (asm_file, "\\%03o", (unsigned char) c);
    3921              :     }
    3922      1605340 :   putc ('\"', asm_file);
    3923              : #endif
    3924      1605340 : }
    3925              : 
    3926              : /* Write a HOST_WIDE_INT number in hex form 0x1234, fast. */
    3927              : 
    3928              : void
    3929    519492071 : fprint_whex (FILE *f, unsigned HOST_WIDE_INT value)
    3930              : {
    3931    519492071 :   char buf[2 + CHAR_BIT * sizeof (value) / 4];
    3932    519492071 :   if (value == 0)
    3933     49665045 :     putc ('0', f);
    3934              :   else
    3935              :     {
    3936              :       char *p = buf + sizeof (buf);
    3937    981148619 :       do
    3938    981148619 :         *--p = "0123456789abcdef"[value % 16];
    3939    981148619 :       while ((value /= 16) != 0);
    3940    469827026 :       *--p = 'x';
    3941    469827026 :       *--p = '0';
    3942    469827026 :       fwrite (p, 1, buf + sizeof (buf) - p, f);
    3943              :     }
    3944    519492071 : }
    3945              : 
    3946              : /* Internal function that prints an unsigned long in decimal in reverse.
    3947              :    The output string IS NOT null-terminated. */
    3948              : 
    3949              : static int
    3950    450389672 : sprint_ul_rev (char *s, unsigned long value)
    3951              : {
    3952            0 :   int i = 0;
    3953   1402129342 :   do
    3954              :     {
    3955   1402129342 :       s[i] = "0123456789"[value % 10];
    3956   1402129342 :       value /= 10;
    3957   1402129342 :       i++;
    3958              :       /* alternate version, without modulo */
    3959              :       /* oldval = value; */
    3960              :       /* value /= 10; */
    3961              :       /* s[i] = "0123456789" [oldval - 10*value]; */
    3962              :       /* i++ */
    3963              :     }
    3964   1402129342 :   while (value != 0);
    3965    329389249 :   return i;
    3966              : }
    3967              : 
    3968              : /* Write an unsigned long as decimal to a file, fast. */
    3969              : 
    3970              : void
    3971    121000423 : fprint_ul (FILE *f, unsigned long value)
    3972              : {
    3973              :   /* python says: len(str(2**64)) == 20 */
    3974    121000423 :   char s[20];
    3975    121000423 :   int i;
    3976              : 
    3977    121000423 :   i = sprint_ul_rev (s, value);
    3978              : 
    3979              :   /* It's probably too small to bother with string reversal and fputs. */
    3980    234806328 :   do
    3981              :     {
    3982    234806328 :       i--;
    3983    234806328 :       putc (s[i], f);
    3984              :     }
    3985    234806328 :   while (i != 0);
    3986    121000423 : }
    3987              : 
    3988              : /* Write an unsigned long as decimal to a string, fast.
    3989              :    s must be wide enough to not overflow, at least 21 chars.
    3990              :    Returns the length of the string (without terminating '\0'). */
    3991              : 
    3992              : int
    3993    329389249 : sprint_ul (char *s, unsigned long value)
    3994              : {
    3995    329389249 :   int len = sprint_ul_rev (s, value);
    3996    329389249 :   s[len] = '\0';
    3997              : 
    3998    329389249 :   std::reverse (s, s + len);
    3999    329389249 :   return len;
    4000              : }
    4001              : 
    4002              : /* A poor man's fprintf, with the added features of %I, %R, %L, and %U.
    4003              :    %R prints the value of REGISTER_PREFIX.
    4004              :    %L prints the value of LOCAL_LABEL_PREFIX.
    4005              :    %U prints the value of USER_LABEL_PREFIX.
    4006              :    %I prints the value of IMMEDIATE_PREFIX.
    4007              :    %O runs ASM_OUTPUT_OPCODE to transform what follows in the string.
    4008              :    Also supported are %d, %i, %u, %x, %X, %o, %c, %s and %%.
    4009              : 
    4010              :    We handle alternate assembler dialects here, just like output_asm_insn.  */
    4011              : 
    4012              : void
    4013            2 : asm_fprintf (FILE *file, const char *p, ...)
    4014              : {
    4015            2 :   char buf[10];
    4016            2 :   char *q, c;
    4017              : #ifdef ASSEMBLER_DIALECT
    4018            2 :   int dialect = 0;
    4019              : #endif
    4020            2 :   va_list argptr;
    4021              : 
    4022            2 :   va_start (argptr, p);
    4023              : 
    4024            2 :   buf[0] = '%';
    4025              : 
    4026           21 :   while ((c = *p++))
    4027           19 :     switch (c)
    4028              :       {
    4029              : #ifdef ASSEMBLER_DIALECT
    4030            0 :       case '{':
    4031            0 :       case '}':
    4032            0 :       case '|':
    4033            0 :         p = do_assembler_dialects (p, &dialect);
    4034            0 :         break;
    4035              : #endif
    4036              : 
    4037            6 :       case '%':
    4038            6 :         c = *p++;
    4039            6 :         q = &buf[1];
    4040            6 :         while (strchr ("-+ #0", c))
    4041              :           {
    4042            0 :             *q++ = c;
    4043            0 :             c = *p++;
    4044              :           }
    4045            6 :         while (ISDIGIT (c) || c == '.')
    4046              :           {
    4047            0 :             *q++ = c;
    4048            0 :             c = *p++;
    4049              :           }
    4050            6 :         switch (c)
    4051              :           {
    4052            2 :           case '%':
    4053            2 :             putc ('%', file);
    4054            2 :             break;
    4055              : 
    4056            0 :           case 'd':  case 'i':  case 'u':
    4057            0 :           case 'x':  case 'X':  case 'o':
    4058            0 :           case 'c':
    4059            0 :             *q++ = c;
    4060            0 :             *q = 0;
    4061            0 :             fprintf (file, buf, va_arg (argptr, int));
    4062            0 :             break;
    4063              : 
    4064            0 :           case 'w':
    4065              :             /* This is a prefix to the 'd', 'i', 'u', 'x', 'X', and
    4066              :                'o' cases, but we do not check for those cases.  It
    4067              :                means that the value is a HOST_WIDE_INT, which may be
    4068              :                either `long' or `long long'.  */
    4069            0 :             memcpy (q, HOST_WIDE_INT_PRINT, strlen (HOST_WIDE_INT_PRINT));
    4070            0 :             q += strlen (HOST_WIDE_INT_PRINT);
    4071            0 :             *q++ = *p++;
    4072            0 :             *q = 0;
    4073            0 :             fprintf (file, buf, va_arg (argptr, HOST_WIDE_INT));
    4074            0 :             break;
    4075              : 
    4076            0 :           case 'l':
    4077            0 :             *q++ = c;
    4078            0 :             if (*p == 'l')
    4079              :               {
    4080            0 :                 *q++ = *p++;
    4081            0 :                 *q++ = *p++;
    4082            0 :                 *q = 0;
    4083            0 :                 fprintf (file, buf, va_arg (argptr, long long));
    4084              :               }
    4085              :             else
    4086              :               {
    4087            0 :                 *q++ = *p++;
    4088            0 :                 *q = 0;
    4089            0 :                 fprintf (file, buf, va_arg (argptr, long));
    4090              :               }
    4091              : 
    4092              :             break;
    4093              : 
    4094            0 :           case 's':
    4095            0 :             *q++ = c;
    4096            0 :             *q = 0;
    4097            0 :             fprintf (file, buf, va_arg (argptr, char *));
    4098            0 :             break;
    4099              : 
    4100            0 :           case 'O':
    4101              : #ifdef ASM_OUTPUT_OPCODE
    4102            0 :             ASM_OUTPUT_OPCODE (asm_out_file, p);
    4103              : #endif
    4104              :             break;
    4105              : 
    4106              :           case 'R':
    4107              : #ifdef REGISTER_PREFIX
    4108              :             fprintf (file, "%s", REGISTER_PREFIX);
    4109              : #endif
    4110              :             break;
    4111              : 
    4112              :           case 'I':
    4113              : #ifdef IMMEDIATE_PREFIX
    4114              :             fprintf (file, "%s", IMMEDIATE_PREFIX);
    4115              : #endif
    4116              :             break;
    4117              : 
    4118            0 :           case 'L':
    4119              : #ifdef LOCAL_LABEL_PREFIX
    4120            0 :             fprintf (file, "%s", LOCAL_LABEL_PREFIX);
    4121              : #endif
    4122            0 :             break;
    4123              : 
    4124            0 :           case 'U':
    4125            0 :             fputs (user_label_prefix, file);
    4126            0 :             break;
    4127              : 
    4128              : #ifdef ASM_FPRINTF_EXTENSIONS
    4129              :             /* Uppercase letters are reserved for general use by asm_fprintf
    4130              :                and so are not available to target specific code.  In order to
    4131              :                prevent the ASM_FPRINTF_EXTENSIONS macro from using them then,
    4132              :                they are defined here.  As they get turned into real extensions
    4133              :                to asm_fprintf they should be removed from this list.  */
    4134              :           case 'A': case 'B': case 'C': case 'D': case 'E':
    4135              :           case 'F': case 'G': case 'H': case 'J': case 'K':
    4136              :           case 'M': case 'N': case 'P': case 'Q': case 'S':
    4137              :           case 'T': case 'V': case 'W': case 'Y': case 'Z':
    4138              :             break;
    4139              : 
    4140            4 :           ASM_FPRINTF_EXTENSIONS (file, argptr, p)
    4141              : #endif
    4142            0 :           default:
    4143            0 :             gcc_unreachable ();
    4144              :           }
    4145              :         break;
    4146              : 
    4147           13 :       default:
    4148           13 :         putc (c, file);
    4149              :       }
    4150            2 :   va_end (argptr);
    4151            2 : }
    4152              : 
    4153              : /* Return true if this function has no function calls.  */
    4154              : 
    4155              : bool
    4156      3065058 : leaf_function_p (void)
    4157              : {
    4158      3065058 :   rtx_insn *insn;
    4159              : 
    4160              :   /* Ensure we walk the entire function body.  */
    4161      3065058 :   gcc_assert (!in_sequence_p ());
    4162              : 
    4163              :   /* Some back-ends (e.g. s390) want leaf functions to stay leaf
    4164              :      functions even if they call mcount.  */
    4165      3065058 :   if (crtl->profile && !targetm.keep_leaf_when_profiled ())
    4166              :     return false;
    4167              : 
    4168     81784666 :   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
    4169              :     {
    4170     80665891 :       rtx_call_insn *call = dyn_cast<rtx_call_insn *> (insn);
    4171      2086915 :       if (call && ! SIBLING_CALL_P (call) && ! FAKE_CALL_P (call))
    4172              :         return false;
    4173     78720232 :       rtx_sequence *seq;
    4174     78720232 :       if (NONJUMP_INSN_P (insn)
    4175     38053032 :           && (seq = dyn_cast <rtx_sequence *> (PATTERN (insn)))
    4176     78720232 :           && (call = dyn_cast<rtx_call_insn *> (seq->insn (0)))
    4177     78720232 :           && ! SIBLING_CALL_P (call))
    4178              :         return false;
    4179              :     }
    4180              : 
    4181              :   return true;
    4182              : }
    4183              : 
    4184              : /* Return true if branch is a forward branch.
    4185              :    Uses insn_shuid array, so it works only in the final pass.  May be used by
    4186              :    output templates to customary add branch prediction hints.
    4187              :  */
    4188              : bool
    4189            0 : final_forward_branch_p (rtx_insn *insn)
    4190              : {
    4191            0 :   int insn_id, label_id;
    4192              : 
    4193            0 :   gcc_assert (uid_shuid);
    4194            0 :   insn_id = INSN_SHUID (insn);
    4195            0 :   label_id = INSN_SHUID (JUMP_LABEL (insn));
    4196              :   /* We've hit some insns that does not have id information available.  */
    4197            0 :   gcc_assert (insn_id && label_id);
    4198            0 :   return insn_id < label_id;
    4199              : }
    4200              : 
    4201              : /* On some machines, a function with no call insns
    4202              :    can run faster if it doesn't create its own register window.
    4203              :    When output, the leaf function should use only the "output"
    4204              :    registers.  Ordinarily, the function would be compiled to use
    4205              :    the "input" registers to find its arguments; it is a candidate
    4206              :    for leaf treatment if it uses only the "input" registers.
    4207              :    Leaf function treatment means renumbering so the function
    4208              :    uses the "output" registers instead.  */
    4209              : 
    4210              : #ifdef LEAF_REGISTERS
    4211              : 
    4212              : /* Return bool if this function uses only the registers that can be
    4213              :    safely renumbered.  */
    4214              : 
    4215              : bool
    4216              : only_leaf_regs_used (void)
    4217              : {
    4218              :   int i;
    4219              :   const char *const permitted_reg_in_leaf_functions = LEAF_REGISTERS;
    4220              : 
    4221              :   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
    4222              :     if ((df_regs_ever_live_p (i) || global_regs[i])
    4223              :         && ! permitted_reg_in_leaf_functions[i])
    4224              :       return false;
    4225              : 
    4226              :   if (crtl->uses_pic_offset_table
    4227              :       && pic_offset_table_rtx != 0
    4228              :       && REG_P (pic_offset_table_rtx)
    4229              :       && ! permitted_reg_in_leaf_functions[REGNO (pic_offset_table_rtx)])
    4230              :     return false;
    4231              : 
    4232              :   return true;
    4233              : }
    4234              : 
    4235              : /* Scan all instructions and renumber all registers into those
    4236              :    available in leaf functions.  */
    4237              : 
    4238              : static void
    4239              : leaf_renumber_regs (rtx_insn *first)
    4240              : {
    4241              :   rtx_insn *insn;
    4242              : 
    4243              :   /* Renumber only the actual patterns.
    4244              :      The reg-notes can contain frame pointer refs,
    4245              :      and renumbering them could crash, and should not be needed.  */
    4246              :   for (insn = first; insn; insn = NEXT_INSN (insn))
    4247              :     if (INSN_P (insn))
    4248              :       leaf_renumber_regs_insn (PATTERN (insn));
    4249              : }
    4250              : 
    4251              : /* Scan IN_RTX and its subexpressions, and renumber all regs into those
    4252              :    available in leaf functions.  */
    4253              : 
    4254              : void
    4255              : leaf_renumber_regs_insn (rtx in_rtx)
    4256              : {
    4257              :   int i, j;
    4258              :   const char *format_ptr;
    4259              : 
    4260              :   if (in_rtx == 0)
    4261              :     return;
    4262              : 
    4263              :   /* Renumber all input-registers into output-registers.
    4264              :      renumbered_regs would be 1 for an output-register;
    4265              :      they  */
    4266              : 
    4267              :   if (REG_P (in_rtx))
    4268              :     {
    4269              :       int newreg;
    4270              : 
    4271              :       /* Don't renumber the same reg twice.  */
    4272              :       if (in_rtx->used)
    4273              :         return;
    4274              : 
    4275              :       newreg = REGNO (in_rtx);
    4276              :       /* Don't try to renumber pseudo regs.  It is possible for a pseudo reg
    4277              :          to reach here as part of a REG_NOTE.  */
    4278              :       if (newreg >= FIRST_PSEUDO_REGISTER)
    4279              :         {
    4280              :           in_rtx->used = 1;
    4281              :           return;
    4282              :         }
    4283              :       newreg = LEAF_REG_REMAP (newreg);
    4284              :       gcc_assert (newreg >= 0);
    4285              :       df_set_regs_ever_live (REGNO (in_rtx), false);
    4286              :       df_set_regs_ever_live (newreg, true);
    4287              :       SET_REGNO (in_rtx, newreg);
    4288              :       in_rtx->used = 1;
    4289              :       return;
    4290              :     }
    4291              : 
    4292              :   if (INSN_P (in_rtx))
    4293              :     {
    4294              :       /* Inside a SEQUENCE, we find insns.
    4295              :          Renumber just the patterns of these insns,
    4296              :          just as we do for the top-level insns.  */
    4297              :       leaf_renumber_regs_insn (PATTERN (in_rtx));
    4298              :       return;
    4299              :     }
    4300              : 
    4301              :   format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx));
    4302              : 
    4303              :   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++)
    4304              :     switch (*format_ptr++)
    4305              :       {
    4306              :       case 'e':
    4307              :         leaf_renumber_regs_insn (XEXP (in_rtx, i));
    4308              :         break;
    4309              : 
    4310              :       case 'E':
    4311              :         if (XVEC (in_rtx, i) != NULL)
    4312              :           for (j = 0; j < XVECLEN (in_rtx, i); j++)
    4313              :             leaf_renumber_regs_insn (XVECEXP (in_rtx, i, j));
    4314              :         break;
    4315              : 
    4316              :       case 'S':
    4317              :       case 's':
    4318              :       case '0':
    4319              :       case 'i':
    4320              :       case 'L':
    4321              :       case 'w':
    4322              :       case 'p':
    4323              :       case 'n':
    4324              :       case 'u':
    4325              :         break;
    4326              : 
    4327              :       default:
    4328              :         gcc_unreachable ();
    4329              :       }
    4330              : }
    4331              : #endif
    4332              : 
    4333              : /* Turn the RTL into assembly.  */
    4334              : static unsigned int
    4335      1517129 : rest_of_handle_final (void)
    4336              : {
    4337      1517129 :   const char *fnname = get_fnname_from_decl (current_function_decl);
    4338              : 
    4339              :   /* Turn debug markers into notes if the var-tracking pass has not
    4340              :      been invoked.  */
    4341      1517129 :   if (!flag_var_tracking && MAY_HAVE_DEBUG_MARKER_INSNS)
    4342            1 :     delete_vta_debug_insns (false);
    4343              : 
    4344      1517129 :   assemble_start_function (current_function_decl, fnname);
    4345      1517129 :   rtx_insn *first = get_insns ();
    4346      1517129 :   int seen = 0;
    4347      1517129 :   final_start_function_1 (&first, asm_out_file, &seen, optimize);
    4348      1517129 :   final_1 (first, asm_out_file, seen, optimize);
    4349      1517129 :   if (flag_ipa_ra
    4350       978016 :       && !lookup_attribute ("noipa", DECL_ATTRIBUTES (current_function_decl))
    4351              :       /* Functions with naked attributes are supported only with basic asm
    4352              :          statements in the body, thus for supported use cases the information
    4353              :          on clobbered registers is not available.  */
    4354      2473456 :       && !lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl)))
    4355       956327 :     collect_fn_hard_reg_usage ();
    4356      1517129 :   final_end_function ();
    4357              : 
    4358              :   /* The IA-64 ".handlerdata" directive must be issued before the ".endp"
    4359              :      directive that closes the procedure descriptor.  Similarly, for x64 SEH.
    4360              :      Otherwise it's not strictly necessary, but it doesn't hurt either.  */
    4361      2968890 :   output_function_exception_table (crtl->has_bb_partition ? 1 : 0);
    4362              : 
    4363      1517129 :   assemble_end_function (current_function_decl, fnname);
    4364              : 
    4365              :   /* Free up reg info memory.  */
    4366      1517129 :   free_reg_info ();
    4367              : 
    4368      1517129 :   if (! quiet_flag)
    4369            0 :     fflush (asm_out_file);
    4370              : 
    4371              :   /* Note that for those inline functions where we don't initially
    4372              :      know for certain that we will be generating an out-of-line copy,
    4373              :      the first invocation of this routine (rest_of_compilation) will
    4374              :      skip over this code by doing a `goto exit_rest_of_compilation;'.
    4375              :      Later on, wrapup_global_declarations will (indirectly) call
    4376              :      rest_of_compilation again for those inline functions that need
    4377              :      to have out-of-line copies generated.  During that call, we
    4378              :      *will* be routed past here.  */
    4379              : 
    4380      1517129 :   timevar_push (TV_SYMOUT);
    4381      1517129 :   if (!DECL_IGNORED_P (current_function_decl))
    4382      1510358 :     debug_hooks->function_decl (current_function_decl);
    4383      1517129 :   timevar_pop (TV_SYMOUT);
    4384              : 
    4385              :   /* Release the blocks that are linked to DECL_INITIAL() to free the memory.  */
    4386      1517129 :   DECL_INITIAL (current_function_decl) = error_mark_node;
    4387              : 
    4388      1517129 :   if (DECL_STATIC_CONSTRUCTOR (current_function_decl)
    4389      1517129 :       && targetm.have_ctors_dtors)
    4390        23347 :     targetm.asm_out.constructor (XEXP (DECL_RTL (current_function_decl), 0),
    4391              :                                  decl_init_priority_lookup
    4392        23347 :                                    (current_function_decl));
    4393      1517129 :   if (DECL_STATIC_DESTRUCTOR (current_function_decl)
    4394      1517129 :       && targetm.have_ctors_dtors)
    4395         1661 :     targetm.asm_out.destructor (XEXP (DECL_RTL (current_function_decl), 0),
    4396              :                                 decl_fini_priority_lookup
    4397         1661 :                                   (current_function_decl));
    4398      1517129 :   return 0;
    4399              : }
    4400              : 
    4401              : namespace {
    4402              : 
    4403              : const pass_data pass_data_final =
    4404              : {
    4405              :   RTL_PASS, /* type */
    4406              :   "final", /* name */
    4407              :   OPTGROUP_NONE, /* optinfo_flags */
    4408              :   TV_FINAL, /* tv_id */
    4409              :   0, /* properties_required */
    4410              :   0, /* properties_provided */
    4411              :   0, /* properties_destroyed */
    4412              :   0, /* todo_flags_start */
    4413              :   0, /* todo_flags_finish */
    4414              : };
    4415              : 
    4416              : class pass_final : public rtl_opt_pass
    4417              : {
    4418              : public:
    4419       297180 :   pass_final (gcc::context *ctxt)
    4420       594360 :     : rtl_opt_pass (pass_data_final, ctxt)
    4421              :   {}
    4422              : 
    4423              :   /* opt_pass methods: */
    4424      1517129 :   unsigned int execute (function *) final override
    4425              :   {
    4426      1517129 :     return rest_of_handle_final ();
    4427              :   }
    4428              : 
    4429              : }; // class pass_final
    4430              : 
    4431              : } // anon namespace
    4432              : 
    4433              : rtl_opt_pass *
    4434       297180 : make_pass_final (gcc::context *ctxt)
    4435              : {
    4436       297180 :   return new pass_final (ctxt);
    4437              : }
    4438              : 
    4439              : 
    4440              : static unsigned int
    4441      1517128 : rest_of_handle_shorten_branches (void)
    4442              : {
    4443              :   /* Shorten branches.  */
    4444            0 :   shorten_branches (get_insns ());
    4445      1517128 :   return 0;
    4446              : }
    4447              : 
    4448              : namespace {
    4449              : 
    4450              : const pass_data pass_data_shorten_branches =
    4451              : {
    4452              :   RTL_PASS, /* type */
    4453              :   "shorten", /* name */
    4454              :   OPTGROUP_NONE, /* optinfo_flags */
    4455              :   TV_SHORTEN_BRANCH, /* tv_id */
    4456              :   0, /* properties_required */
    4457              :   0, /* properties_provided */
    4458              :   0, /* properties_destroyed */
    4459              :   0, /* todo_flags_start */
    4460              :   0, /* todo_flags_finish */
    4461              : };
    4462              : 
    4463              : class pass_shorten_branches : public rtl_opt_pass
    4464              : {
    4465              : public:
    4466       297180 :   pass_shorten_branches (gcc::context *ctxt)
    4467       594360 :     : rtl_opt_pass (pass_data_shorten_branches, ctxt)
    4468              :   {}
    4469              : 
    4470              :   /* opt_pass methods: */
    4471      1517128 :   unsigned int execute (function *) final override
    4472              :     {
    4473      1517128 :       return rest_of_handle_shorten_branches ();
    4474              :     }
    4475              : 
    4476              : }; // class pass_shorten_branches
    4477              : 
    4478              : } // anon namespace
    4479              : 
    4480              : rtl_opt_pass *
    4481       297180 : make_pass_shorten_branches (gcc::context *ctxt)
    4482              : {
    4483       297180 :   return new pass_shorten_branches (ctxt);
    4484              : }
    4485              : 
    4486              : 
    4487              : static unsigned int
    4488      1517944 : rest_of_clean_state (void)
    4489              : {
    4490      1517944 :   rtx_insn *insn, *next;
    4491      1517944 :   FILE *final_output = NULL;
    4492      1517944 :   int save_unnumbered = flag_dump_unnumbered;
    4493      1517944 :   int save_noaddr = flag_dump_noaddr;
    4494              : 
    4495      1517944 :   if (flag_dump_final_insns)
    4496              :     {
    4497         4002 :       final_output = fopen (flag_dump_final_insns, "a");
    4498         4002 :       if (!final_output)
    4499              :         {
    4500            0 :           error ("could not open final insn dump file %qs: %m",
    4501              :                  flag_dump_final_insns);
    4502            0 :           flag_dump_final_insns = NULL;
    4503              :         }
    4504              :       else
    4505              :         {
    4506         4002 :           flag_dump_noaddr = flag_dump_unnumbered = 1;
    4507         4002 :           if (flag_compare_debug_opt || flag_compare_debug)
    4508         3930 :             dump_flags |= TDF_NOUID | TDF_COMPARE_DEBUG;
    4509         4002 :           dump_function_header (final_output, current_function_decl,
    4510              :                                 dump_flags);
    4511         4002 :           final_insns_dump_p = true;
    4512              : 
    4513       158550 :           for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
    4514       154548 :             if (LABEL_P (insn))
    4515         5029 :               INSN_UID (insn) = CODE_LABEL_NUMBER (insn);
    4516              :             else
    4517              :               {
    4518       149519 :                 if (NOTE_P (insn))
    4519        74345 :                   set_block_for_insn (insn, NULL);
    4520       149519 :                 INSN_UID (insn) = 0;
    4521              :               }
    4522              :         }
    4523              :     }
    4524              : 
    4525              :   /* It is very important to decompose the RTL instruction chain here:
    4526              :      debug information keeps pointing into CODE_LABEL insns inside the function
    4527              :      body.  If these remain pointing to the other insns, we end up preserving
    4528              :      whole RTL chain and attached detailed debug info in memory.  */
    4529    265264572 :   for (insn = get_insns (); insn; insn = next)
    4530              :     {
    4531    263746628 :       next = NEXT_INSN (insn);
    4532    263746628 :       SET_NEXT_INSN (insn) = NULL;
    4533    263746628 :       SET_PREV_INSN (insn) = NULL;
    4534              : 
    4535    263746628 :       rtx_insn *call_insn = insn;
    4536    263746628 :       rtx_sequence *seq;
    4537    263746628 :       if (NONJUMP_INSN_P (call_insn)
    4538    263746628 :           && (seq = dyn_cast <rtx_sequence *> (PATTERN (call_insn))))
    4539            0 :         call_insn = seq->insn (0);
    4540    263746628 :       if (CALL_P (call_insn))
    4541              :         {
    4542      6299073 :           rtx note
    4543      6299073 :             = find_reg_note (call_insn, REG_CALL_ARG_LOCATION, NULL_RTX);
    4544      6299073 :           if (note)
    4545      3287617 :             remove_note (call_insn, note);
    4546              :         }
    4547              : 
    4548    263746628 :       if (final_output
    4549       154548 :           && (!NOTE_P (insn)
    4550        74345 :               || (NOTE_KIND (insn) != NOTE_INSN_VAR_LOCATION
    4551              :                   && NOTE_KIND (insn) != NOTE_INSN_BEGIN_STMT
    4552        74345 :                   && NOTE_KIND (insn) != NOTE_INSN_INLINE_ENTRY
    4553              :                   && NOTE_KIND (insn) != NOTE_INSN_BLOCK_BEG
    4554              :                   && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END
    4555              :                   && NOTE_KIND (insn) != NOTE_INSN_DELETED_DEBUG_LABEL)))
    4556       119643 :         print_rtl_single (final_output, insn);
    4557              :     }
    4558              : 
    4559      1517944 :   if (final_output)
    4560              :     {
    4561         4002 :       flag_dump_noaddr = save_noaddr;
    4562         4002 :       flag_dump_unnumbered = save_unnumbered;
    4563         4002 :       final_insns_dump_p = false;
    4564              : 
    4565         4002 :       if (fclose (final_output))
    4566              :         {
    4567            0 :           error ("could not close final insn dump file %qs: %m",
    4568              :                  flag_dump_final_insns);
    4569            0 :           flag_dump_final_insns = NULL;
    4570              :         }
    4571              :     }
    4572              : 
    4573      1517944 :   flag_rerun_cse_after_global_opts = 0;
    4574      1517944 :   reload_completed = 0;
    4575      1517944 :   post_ra_split_completed = false;
    4576      1517944 :   epilogue_completed = 0;
    4577              : #ifdef STACK_REGS
    4578      1517944 :   regstack_completed = 0;
    4579              : #endif
    4580              : 
    4581              :   /* Clear out the insn_length contents now that they are no
    4582              :      longer valid.  */
    4583      1517944 :   init_insn_lengths ();
    4584              : 
    4585              :   /* Show no temporary slots allocated.  */
    4586      1517944 :   init_temp_slots ();
    4587              : 
    4588      1517944 :   free_bb_for_insn ();
    4589              : 
    4590      1517944 :   if (cfun->gimple_df)
    4591      1517902 :     delete_tree_ssa (cfun);
    4592              : 
    4593              :   /* We can reduce stack alignment on call site only when we are sure that
    4594              :      the function body just produced will be actually used in the final
    4595              :      executable.  */
    4596      1517944 :   if (flag_ipa_stack_alignment
    4597      1517944 :       && decl_binds_to_current_def_p (current_function_decl))
    4598              :     {
    4599      1263406 :       unsigned int pref = crtl->preferred_stack_boundary;
    4600      1263406 :       if (crtl->stack_alignment_needed > crtl->preferred_stack_boundary)
    4601              :         pref = crtl->stack_alignment_needed;
    4602      1263406 :       cgraph_node::rtl_info (current_function_decl)
    4603      1263406 :         ->preferred_incoming_stack_boundary = pref;
    4604              :     }
    4605              : 
    4606              :   /* Make sure volatile mem refs aren't considered valid operands for
    4607              :      arithmetic insns.  We must call this here if this is a nested inline
    4608              :      function, since the above code leaves us in the init_recog state,
    4609              :      and the function context push/pop code does not save/restore volatile_ok.
    4610              : 
    4611              :      ??? Maybe it isn't necessary for expand_start_function to call this
    4612              :      anymore if we do it here?  */
    4613              : 
    4614      1517944 :   init_recog_no_volatile ();
    4615              : 
    4616              :   /* We're done with this function.  Free up memory if we can.  */
    4617      1517944 :   free_after_parsing (cfun);
    4618      1517944 :   free_after_compilation (cfun);
    4619      1517944 :   return 0;
    4620              : }
    4621              : 
    4622              : namespace {
    4623              : 
    4624              : const pass_data pass_data_clean_state =
    4625              : {
    4626              :   RTL_PASS, /* type */
    4627              :   "*clean_state", /* name */
    4628              :   OPTGROUP_NONE, /* optinfo_flags */
    4629              :   TV_FINAL, /* tv_id */
    4630              :   0, /* properties_required */
    4631              :   0, /* properties_provided */
    4632              :   PROP_rtl, /* properties_destroyed */
    4633              :   0, /* todo_flags_start */
    4634              :   0, /* todo_flags_finish */
    4635              : };
    4636              : 
    4637              : class pass_clean_state : public rtl_opt_pass
    4638              : {
    4639              : public:
    4640       297180 :   pass_clean_state (gcc::context *ctxt)
    4641       594360 :     : rtl_opt_pass (pass_data_clean_state, ctxt)
    4642              :   {}
    4643              : 
    4644              :   /* opt_pass methods: */
    4645      1517944 :   unsigned int execute (function *) final override
    4646              :     {
    4647      1517944 :       return rest_of_clean_state ();
    4648              :     }
    4649              : 
    4650              : }; // class pass_clean_state
    4651              : 
    4652              : } // anon namespace
    4653              : 
    4654              : rtl_opt_pass *
    4655       297180 : make_pass_clean_state (gcc::context *ctxt)
    4656              : {
    4657       297180 :   return new pass_clean_state (ctxt);
    4658              : }
    4659              : 
    4660              : /* Return true if INSN is a call to the current function.  */
    4661              : 
    4662              : static bool
    4663       823513 : self_recursive_call_p (rtx_insn *insn)
    4664              : {
    4665       823513 :   tree fndecl = get_call_fndecl (insn);
    4666       823513 :   return (fndecl == current_function_decl
    4667       823513 :           && decl_binds_to_current_def_p (fndecl));
    4668              : }
    4669              : 
    4670              : /* Collect hard register usage for the current function.  */
    4671              : 
    4672              : static void
    4673       956327 : collect_fn_hard_reg_usage (void)
    4674              : {
    4675       956327 :   rtx_insn *insn;
    4676              : #ifdef STACK_REGS
    4677       956327 :   int i;
    4678              : #endif
    4679       956327 :   struct cgraph_rtl_info *node;
    4680       956327 :   HARD_REG_SET function_used_regs;
    4681              : 
    4682              :   /* ??? To be removed when all the ports have been fixed.  */
    4683       956327 :   if (!targetm.call_fusage_contains_non_callee_clobbers)
    4684       647103 :     return;
    4685              : 
    4686              :   /* Be conservative - mark fixed and global registers as used.  */
    4687       956327 :   function_used_regs = fixed_reg_set;
    4688              : 
    4689              : #ifdef STACK_REGS
    4690              :   /* Handle STACK_REGS conservatively, since the df-framework does not
    4691              :      provide accurate information for them.  */
    4692              : 
    4693      8606943 :   for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
    4694      7650616 :     SET_HARD_REG_BIT (function_used_regs, i);
    4695              : #endif
    4696              : 
    4697     52651176 :   for (insn = get_insns (); insn != NULL_RTX; insn = next_insn (insn))
    4698              :     {
    4699     52341952 :       HARD_REG_SET insn_used_regs;
    4700              : 
    4701     52341952 :       if (!NONDEBUG_INSN_P (insn))
    4702     34929166 :         continue;
    4703              : 
    4704     17412786 :       auto call = dyn_cast<rtx_call_insn *> (insn);
    4705       823513 :       if (call && !self_recursive_call_p (call))
    4706       820278 :         function_used_regs
    4707      1640556 :           |= insn_callee_abi (call).full_and_partial_reg_clobbers ();
    4708              : 
    4709     17412786 :       find_all_hard_reg_sets (insn, &insn_used_regs, false);
    4710     17412786 :       function_used_regs |= insn_used_regs;
    4711              : 
    4712     34825572 :       if (hard_reg_set_subset_p (crtl->abi->full_and_partial_reg_clobbers (),
    4713              :                                  function_used_regs))
    4714       647103 :         return;
    4715              :     }
    4716              : 
    4717              :   /* Mask out fully-saved registers, so that they don't affect equality
    4718              :      comparisons between function_abis.  */
    4719       309224 :   function_used_regs &= crtl->abi->full_and_partial_reg_clobbers ();
    4720              : 
    4721       309224 :   node = cgraph_node::rtl_info (current_function_decl);
    4722       309224 :   gcc_assert (node != NULL);
    4723              : 
    4724       309224 :   node->function_used_regs = function_used_regs;
    4725              : }
    4726              : 
    4727              : #if CHECKING_P
    4728              : 
    4729              : namespace selftest {
    4730              : 
    4731              : static void
    4732            4 : test_parse_bracketed_operand ()
    4733              : {
    4734            4 :   const struct
    4735              :   {
    4736              :     const char *text;
    4737              :     const char *modifier;
    4738              :     unsigned long opnums[2];
    4739              :     unsigned int count;
    4740            4 :   } valid[] = {
    4741              :     { "[10]", "", { 10 }, 1 },
    4742              :     { "[fmt:11]", "fmt", { 11 }, 1 },
    4743              :     { "[gpr,zero:13]", "gpr,zero", { 13 }, 1 },
    4744              :     { "[fmt:13,14]", "fmt", { 13, 14 }, 2 },
    4745              :     { "[999999999999999999999999999999999999]", "", { ULONG_MAX }, 1 }
    4746              :   };
    4747            4 :   bracketed_operand operand;
    4748           24 :   for (const auto &test : valid)
    4749              :     {
    4750           20 :       const char *p = test.text;
    4751           20 :       ASSERT_TRUE (parse_bracketed_operand (&p, operand));
    4752           20 :       ASSERT_TRUE (operand.modifier == test.modifier);
    4753           40 :       ASSERT_EQ (test.count, operand.opnums.length ());
    4754           44 :       for (unsigned int i = 0; i < test.count; ++i)
    4755           24 :         ASSERT_EQ (test.opnums[i], operand.opnums[i]);
    4756           20 :       ASSERT_EQ ('\0', *p);
    4757              :     }
    4758            4 :   const char *invalid[] = {
    4759              :     "[fmt]12", "[fmt:1,]", "[fmt]", "[fmt:]", "[]0", "[0,1]",
    4760              :     "[fmt:12x]", "[fmt:1", "[:1]", "[,fmt:1]", "[fmt,:1]", "[fmt,,part:1]"
    4761              :   };
    4762           52 :   for (const char *text : invalid)
    4763              :     {
    4764           48 :       const char *p = text;
    4765           48 :       ASSERT_FALSE (parse_bracketed_operand (&p, operand));
    4766              :     }
    4767            4 : }
    4768              : 
    4769              : /* The same syntax must be understood by the operand reference scanner.  */
    4770              : 
    4771              : static void
    4772            4 : test_referenced_operands ()
    4773              : {
    4774            4 :   const struct
    4775              :   {
    4776              :     const char *text;
    4777              :     unsigned int mask;
    4778            4 :   } tests[] = {
    4779              :     { "%[0] %[fmt:1,2]", 7 },
    4780              :     { "%%[0] %%[fmt:1,2]", 0 },
    4781              :     { "%[1]0 %2", 6 },
    4782              :     { "%0 %a1 %cc2", 7 },
    4783              :     { "%[fmt:2,2] %[99]", 4 },
    4784              :     { "%[fmt:1,]", 0 },
    4785              :     { "%", 0 }
    4786              :   };
    4787           32 :   for (const auto &test : tests)
    4788              :     {
    4789           28 :       bool used[3];
    4790           28 :       get_referenced_operands (test.text, used, 3);
    4791          140 :       for (unsigned int i = 0; i < 3; ++i)
    4792           84 :         ASSERT_EQ ((test.mask & (1U << i)) != 0, used[i]);
    4793              :     }
    4794            4 : }
    4795              : 
    4796              : static void
    4797            4 : test_output_operand_modifier_operand ()
    4798              : {
    4799            4 :   rtx operands[] = { GEN_INT (10), gen_rtx_REG (QImode, 0) };
    4800            4 :   auto_vec<unsigned long, 2> opnums;
    4801            4 :   opnums.safe_push (1);
    4802            4 :   opnums.safe_push (0);
    4803            4 :   current_modifier_operands = operands;
    4804            4 :   current_modifier_opnums = &opnums;
    4805            4 :   rtx x = output_operand_modifier_operand (PRINT_OPERAND_MODIFIER_BASE, 0);
    4806            4 :   ASSERT_TRUE (REG_P (x));
    4807            4 :   ASSERT_EQ (QImode, GET_MODE (x));
    4808            4 :   ASSERT_EQ (operands[0], output_operand_modifier_operand
    4809              :              (PRINT_OPERAND_MODIFIER_BASE, 1));
    4810            4 :   ASSERT_EQ (nullptr, output_operand_modifier_operand
    4811              :              (PRINT_OPERAND_MODIFIER_BASE, 2));
    4812            4 :   current_modifier_operands = nullptr;
    4813            4 :   current_modifier_opnums = nullptr;
    4814            4 : }
    4815              : 
    4816              : void
    4817            4 : final_cc_tests ()
    4818              : {
    4819            4 :   test_parse_bracketed_operand ();
    4820            4 :   test_referenced_operands ();
    4821            4 :   test_output_operand_modifier_operand ();
    4822            4 : }
    4823              : 
    4824              : } // namespace selftest
    4825              : 
    4826              : #endif /* CHECKING_P */
        

Generated by: LCOV version 2.5.0-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.