gcc 源码分析:从IR-RTL 到汇编输出

在完成了IR-RTL的优化与寄存器分配后

就来到汇编代码的输出:

实现如下:

class pass_final : public rtl_opt_pass
{
public:
pass_final (gcc::context *ctxt)
: rtl_opt_pass (pass_data_final, ctxt)
{}

  /* opt_pass methods: */
unsigned int execute (function *) final override
{
return rest_of_handle_final ();
}

}; // class pass_final

} // anon namespace

rest_of_handle_final (void)
{
const char *fnname = get_fnname_from_decl (current_function_decl);

  /* Turn debug markers into notes if the var-tracking pass has not
been invoked.  */
if (!flag_var_tracking && MAY_HAVE_DEBUG_MARKER_INSNS)
delete_vta_debug_insns (false);

  assemble_start_function (current_function_decl, fnname);
rtx_insn *first = get_insns ();
int seen = 0;
final_start_function_1 (&first, asm_out_file, &seen, optimize);
final_1 (first, asm_out_file, seen, optimize);
if (flag_ipa_ra
&& !lookup_attribute ("noipa", DECL_ATTRIBUTES (current_function_decl))
/* Functions with naked attributes are supported only with basic asm
statements in the body, thus for supported use cases the information
on clobbered registers is not available.  */
&& !lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl)))
collect_fn_hard_reg_usage ();
final_end_function ();

  /* The IA-64 ".handlerdata" directive must be issued before the ".endp"
directive that closes the procedure descriptor.  Similarly, for x64 SEH.
Otherwise it's not strictly necessary, but it doesn't hurt either.  */
output_function_exception_table (crtl->has_bb_partition ? 1 : 0);

  assemble_end_function (current_function_decl, fnname);

  /* Free up reg info memory.  */
free_reg_info ();

  if (! quiet_flag)
fflush (asm_out_file);

  /* Note that for those inline functions where we don't initially
know for certain that we will be generating an out-of-line copy,
the first invocation of this routine (rest_of_compilation) will
skip over this code by doing a `goto exit_rest_of_compilation;'.
Later on, wrapup_global_declarations will (indirectly) call
rest_of_compilation again for those inline functions that need
to have out-of-line copies generated.  During that call, we
*will* be routed past here.  */

  timevar_push (TV_SYMOUT);
if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->function_decl (current_function_decl);
timevar_pop (TV_SYMOUT);

  /* Release the blocks that are linked to DECL_INITIAL() to free the memory.  */
DECL_INITIAL (current_function_decl) = error_mark_node;

  if (DECL_STATIC_CONSTRUCTOR (current_function_decl)
&& targetm.have_ctors_dtors)
targetm.asm_out.constructor (XEXP (DECL_RTL (current_function_decl), 0),
decl_init_priority_lookup
(current_function_decl));
if (DECL_STATIC_DESTRUCTOR (current_function_decl)
&& targetm.have_ctors_dtors)
targetm.asm_out.destructor (XEXP (DECL_RTL (current_function_decl), 0),
decl_fini_priority_lookup
(current_function_decl));
return 0;
}

static void
final_1 (rtx_insn *first, FILE *file, int seen, int optimize_p)

{
rtx_insn *insn, *next;

  /* Used for -dA dump.  */
basic_block *start_to_bb = NULL;
basic_block *end_to_bb = NULL;
int bb_map_size = 0;
int bb_seqn = 0;

  last_ignored_compare = 0;

  init_recog ();

  CC_STATUS_INIT;

  if (flag_debug_asm)
{
basic_block bb;

      bb_map_size = get_max_uid () + 1;
start_to_bb = XCNEWVEC (basic_block, bb_map_size);
end_to_bb = XCNEWVEC (basic_block, bb_map_size);

      /* There is no cfg for a thunk.  */
if (!cfun->is_thunk)
FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
end_to_bb[INSN_UID (BB_END (bb))] = bb;
}
}

  /* Output the insns.  */
for (insn = first; insn;)
{
if (HAVE_ATTR_length)
{
if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
{
/* This can be triggered by bugs elsewhere in the compiler if
new insns are created after init_insn_lengths is called.  */
gcc_assert (NOTE_P (insn));
insn_current_address = -1;
}
else
insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
/* final can be seen as an iteration of shorten_branches that
does nothing (since a fixed point has already been reached).  */
insn_last_address = insn_current_address;
}

      dump_basic_block_info (file, insn, start_to_bb, end_to_bb,
bb_map_size, &bb_seqn);
insn = final_scan_insn (insn, file, optimize_p, 0, &seen);
}

  maybe_output_next_view (&seen);

  if (flag_debug_asm)
{
free (start_to_bb);
free (end_to_bb);
}

  /* Remove CFI notes, to avoid compare-debug failures.  */
for (insn = first; insn; insn = next)
{
next = NEXT_INSN (insn);
if (NOTE_P (insn)
&& (NOTE_KIND (insn) == NOTE_INSN_CFI
|| NOTE_KIND (insn) == NOTE_INSN_CFI_LABEL))
delete_insn (insn);
}
}

rtx_insn *
final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p,
int nopeepholes, int *seen)

{
static int *enclosing_seen;
static int recursion_counter;

  gcc_assert (seen || recursion_counter);
gcc_assert (!recursion_counter || !seen || seen == enclosing_seen);

  if (!recursion_counter++)
enclosing_seen = seen;
else if (!seen)
seen = enclosing_seen;

  rtx_insn *ret = final_scan_insn_1 (insn, file, optimize_p, nopeepholes, seen);

  if (!--recursion_counter)
enclosing_seen = NULL;

  return ret;
}

static rtx_insn *
final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
int nopeepholes ATTRIBUTE_UNUSED, int *seen)

{
rtx_insn *next;
rtx_jump_table_data *table;

  insn_counter++;

  /* Ignore deleted insns.  These can occur when we split insns (due to a
template of "#") while not optimizing.  */
if (insn->deleted ())
return NEXT_INSN (insn);

  switch (GET_CODE (insn))
{
case NOTE:
switch (NOTE_KIND (insn))
{
case NOTE_INSN_DELETED:
case NOTE_INSN_UPDATE_SJLJ_CONTEXT:
break;

    case NOTE_INSN_SWITCH_TEXT_SECTIONS:
maybe_output_next_view (seen);

      output_function_exception_table (0);

      if (targetm.asm_out.unwind_emit)
targetm.asm_out.unwind_emit (asm_out_file, insn);

      in_cold_section_p = !in_cold_section_p;

      gcc_checking_assert (in_cold_section_p);
if (in_cold_section_p)
cold_function_name
= clone_function_name (current_function_decl, "cold");

      if (dwarf2out_do_frame ())
{
dwarf2out_switch_text_section ();
if (!dwarf2_debug_info_emitted_p (current_function_decl)
&& !DECL_IGNORED_P (current_function_decl))
debug_hooks->switch_text_section ();
}
else if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->switch_text_section ();
if (DECL_IGNORED_P (current_function_decl) && last_linenum
&& last_filename)
debug_hooks->set_ignored_loc (last_linenum, last_columnnum,
last_filename);

      switch_to_section (current_function_section ());
targetm.asm_out.function_switched_text_sections (asm_out_file,
current_function_decl,
in_cold_section_p);
/* Emit a label for the split cold section.  Form label name by
suffixing "cold" to the original function's name.  */
if (in_cold_section_p)
{
#ifdef ASM_DECLARE_COLD_FUNCTION_NAME
ASM_DECLARE_COLD_FUNCTION_NAME (asm_out_file,
IDENTIFIER_POINTER
(cold_function_name),
current_function_decl);
#else
ASM_OUTPUT_LABEL (asm_out_file,
IDENTIFIER_POINTER (cold_function_name));
#endif
if (dwarf2out_do_frame ()
&& cfun->fde->dw_fde_second_begin != NULL)
ASM_OUTPUT_LABEL (asm_out_file, cfun->fde->dw_fde_second_begin);
}
break;

    case NOTE_INSN_BASIC_BLOCK:
if (need_profile_function)
{
profile_function (asm_out_file);
need_profile_function = false;
}

      if (targetm.asm_out.unwind_emit)
targetm.asm_out.unwind_emit (asm_out_file, insn);

      break;

    case NOTE_INSN_EH_REGION_BEG:
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LEHB",
NOTE_EH_HANDLER (insn));
break;

    case NOTE_INSN_EH_REGION_END:
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LEHE",
NOTE_EH_HANDLER (insn));
break;

    case NOTE_INSN_PROLOGUE_END:
targetm.asm_out.function_end_prologue (file);
profile_after_prologue (file);

      if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE)
{
*seen |= SEEN_EMITTED;
force_source_line = true;
}
else
*seen |= SEEN_NOTE;

      break;

    case NOTE_INSN_EPILOGUE_BEG:
if (!DECL_IGNORED_P (current_function_decl))
(*debug_hooks->begin_epilogue) (last_linenum, last_filename);
targetm.asm_out.function_begin_epilogue (file);
break;

    case NOTE_INSN_CFI:
dwarf2out_emit_cfi (NOTE_CFI (insn));
break;

    case NOTE_INSN_CFI_LABEL:
ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LCFI",
NOTE_LABEL_NUMBER (insn));
break;

    case NOTE_INSN_FUNCTION_BEG:
if (need_profile_function)
{
profile_function (asm_out_file);
need_profile_function = false;
}

      app_disable ();
if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->end_prologue (last_linenum, last_filename);

      if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE)
{
*seen |= SEEN_EMITTED;
force_source_line = true;
}
else
*seen |= SEEN_NOTE;

      break;

    case NOTE_INSN_BLOCK_BEG:
if (debug_info_level >= DINFO_LEVEL_NORMAL
|| dwarf_debuginfo_p ()
|| write_symbols == VMS_DEBUG)
{
int n = BLOCK_NUMBER (NOTE_BLOCK (insn));

          app_disable ();
++block_depth;
high_block_linenum = last_linenum;

          /* Output debugging info about the symbol-block beginning.  */
if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->begin_block (last_linenum, n, NOTE_BLOCK (insn));

          /* Mark this block as output.  */
TREE_ASM_WRITTEN (NOTE_BLOCK (insn)) = 1;
BLOCK_IN_COLD_SECTION_P (NOTE_BLOCK (insn)) = in_cold_section_p;
}
break;

    case NOTE_INSN_BLOCK_END:
maybe_output_next_view (seen);

      if (debug_info_level >= DINFO_LEVEL_NORMAL
|| dwarf_debuginfo_p ()
|| write_symbols == VMS_DEBUG)
{
int n = BLOCK_NUMBER (NOTE_BLOCK (insn));

          app_disable ();

          /* End of a symbol-block.  */
--block_depth;
gcc_assert (block_depth >= 0);

          if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->end_block (high_block_linenum, n);
gcc_assert (BLOCK_IN_COLD_SECTION_P (NOTE_BLOCK (insn))
== in_cold_section_p);
}
break;

    case NOTE_INSN_DELETED_LABEL:
/* Emit the label.  We may have deleted the CODE_LABEL because
the label could be proved to be unreachable, though still
referenced (in the form of having its address taken.  */
ASM_OUTPUT_DEBUG_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
break;

    case NOTE_INSN_DELETED_DEBUG_LABEL:
/* Similarly, but need to use different namespace for it.  */
if (CODE_LABEL_NUMBER (insn) != -1)
ASM_OUTPUT_DEBUG_LABEL (file, "LDL", CODE_LABEL_NUMBER (insn));
break;

    case NOTE_INSN_VAR_LOCATION:
if (!DECL_IGNORED_P (current_function_decl))
{
debug_hooks->var_location (insn);
set_next_view_needed (seen);
}
break;

    case NOTE_INSN_BEGIN_STMT:
gcc_checking_assert (cfun->debug_nonbind_markers);
if (!DECL_IGNORED_P (current_function_decl)
&& notice_source_line (insn, NULL))
{
output_source_line:
(*debug_hooks->source_line) (last_linenum, last_columnnum,
last_filename, last_discriminator,
true);
clear_next_view_needed (seen);
}
break;

    case NOTE_INSN_INLINE_ENTRY:
gcc_checking_assert (cfun->debug_nonbind_markers);
if (!DECL_IGNORED_P (current_function_decl)
&& notice_source_line (insn, NULL))
{
(*debug_hooks->inline_entry) (LOCATION_BLOCK
(NOTE_MARKER_LOCATION (insn)));
goto output_source_line;
}
break;

    default:
gcc_unreachable ();
break;
}
break;

    case BARRIER:
break;

    case CODE_LABEL:
/* The target port might emit labels in the output function for
some insn, e.g. sh.cc output_branchy_insn.  */
if (CODE_LABEL_NUMBER (insn) <= max_labelno)
{
align_flags alignment = LABEL_TO_ALIGNMENT (insn);
if (alignment.levels[0].log && NEXT_INSN (insn))
{
#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
/* Output both primary and secondary alignment.  */
ASM_OUTPUT_MAX_SKIP_ALIGN (file, alignment.levels[0].log,
alignment.levels[0].maxskip);
ASM_OUTPUT_MAX_SKIP_ALIGN (file, alignment.levels[1].log,
alignment.levels[1].maxskip);
#else
#ifdef ASM_OUTPUT_ALIGN_WITH_NOP
ASM_OUTPUT_ALIGN_WITH_NOP (file, alignment.levels[0].log);
#else
ASM_OUTPUT_ALIGN (file, alignment.levels[0].log);
#endif
#endif
}
}
CC_STATUS_INIT;

      if (!DECL_IGNORED_P (current_function_decl) && LABEL_NAME (insn))
debug_hooks->label (as_a <rtx_code_label *> (insn));

      app_disable ();

      /* If this label is followed by a jump-table, make sure we put
the label in the read-only section.  Also possibly write the
label and jump table together.  */
table = jump_table_for_label (as_a <rtx_code_label *> (insn));
if (table)
{
#if defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC)
/* In this case, the case vector is being moved by the
target, so don't output the label at all.  Leave that
to the back end macros.  */
#else
if (! JUMP_TABLES_IN_TEXT_SECTION)
{
int log_align;

          switch_to_section (targetm.asm_out.function_rodata_section
(current_function_decl,
jumptable_relocatable ()));

#ifdef ADDR_VEC_ALIGN
log_align = ADDR_VEC_ALIGN (table);
#else
log_align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT);
#endif
ASM_OUTPUT_ALIGN (file, log_align);
}
else
switch_to_section (current_function_section ());

#ifdef ASM_OUTPUT_CASE_LABEL
ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn), table);
#else
targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
#endif
#endif
break;
}
if (LABEL_ALT_ENTRY_P (insn))
output_alternate_entry_point (file, insn);
else
targetm.asm_out.internal_label (file, "L", CODE_LABEL_NUMBER (insn));
break;

    default:
{
rtx body = PATTERN (insn);
int insn_code_number;
const char *templ;
bool is_stmt, *is_stmt_p;

    if (MAY_HAVE_DEBUG_MARKER_INSNS && cfun->debug_nonbind_markers)
{
is_stmt = false;
is_stmt_p = NULL;
}
else
is_stmt_p = &is_stmt;

    /* Reset this early so it is correct for ASM statements.  */
current_insn_predicate = NULL_RTX;

    /* An INSN, JUMP_INSN or CALL_INSN.
First check for special kinds that recog doesn't recognize.  */

    if (GET_CODE (body) == USE /* These are just declarations.  */
|| GET_CODE (body) == CLOBBER)
break;

    /* Detect insns that are really jump-tables
and output them as such.  */

        if (JUMP_TABLE_DATA_P (insn))
{
#if !(defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC))
int vlen, idx;
#endif

        if (! JUMP_TABLES_IN_TEXT_SECTION)
switch_to_section (targetm.asm_out.function_rodata_section
(current_function_decl,
jumptable_relocatable ()));
else
switch_to_section (current_function_section ());

        app_disable ();

#if defined(ASM_OUTPUT_ADDR_VEC) || defined(ASM_OUTPUT_ADDR_DIFF_VEC)
if (GET_CODE (body) == ADDR_VEC)
{
#ifdef ASM_OUTPUT_ADDR_VEC
ASM_OUTPUT_ADDR_VEC (PREV_INSN (insn), body);
#else
gcc_unreachable ();
#endif
}
else
{
#ifdef ASM_OUTPUT_ADDR_DIFF_VEC
ASM_OUTPUT_ADDR_DIFF_VEC (PREV_INSN (insn), body);
#else
gcc_unreachable ();
#endif
}
#else
vlen = XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC);
for (idx = 0; idx < vlen; idx++)
{
if (GET_CODE (body) == ADDR_VEC)
{
#ifdef ASM_OUTPUT_ADDR_VEC_ELT
ASM_OUTPUT_ADDR_VEC_ELT
(file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0)));
#else
gcc_unreachable ();
#endif
}
else
{
#ifdef ASM_OUTPUT_ADDR_DIFF_ELT
ASM_OUTPUT_ADDR_DIFF_ELT
(file,
body,
CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
CODE_LABEL_NUMBER (XEXP (XEXP (body, 0), 0)));
#else
gcc_unreachable ();
#endif
}
}
#ifdef ASM_OUTPUT_CASE_END
ASM_OUTPUT_CASE_END (file,
CODE_LABEL_NUMBER (PREV_INSN (insn)),
insn);
#endif
#endif

        switch_to_section (current_function_section ());

        if (debug_variable_location_views
&& !DECL_IGNORED_P (current_function_decl))
debug_hooks->var_location (insn);

        break;
}
/* Output this line note if it is the first or the last line
note in a row.  */
if (!DECL_IGNORED_P (current_function_decl)
&& notice_source_line (insn, is_stmt_p))
{
if (flag_verbose_asm)
asm_show_source (last_filename, last_linenum);
(*debug_hooks->source_line) (last_linenum, last_columnnum,
last_filename, last_discriminator,
is_stmt);
clear_next_view_needed (seen);
}
else
maybe_output_next_view (seen);

    gcc_checking_assert (!DEBUG_INSN_P (insn));

    if (GET_CODE (body) == PARALLEL
&& GET_CODE (XVECEXP (body, 0, 0)) == ASM_INPUT)
body = XVECEXP (body, 0, 0);

    if (GET_CODE (body) == ASM_INPUT)
{
const char *string = XSTR (body, 0);

        /* There's no telling what that did to the condition codes.  */
CC_STATUS_INIT;

        if (string[0])
{
expanded_location loc;

        app_enable ();
loc = expand_location (ASM_INPUT_SOURCE_LOCATION (body));
if (*loc.file && loc.line)
fprintf (asm_out_file, "%s %i \"%s\" 1\n",
ASM_COMMENT_START, loc.line, loc.file);
fprintf (asm_out_file, "\t%s\n", string);
#if HAVE_AS_LINE_ZERO
if (*loc.file && loc.line)
fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
#endif
}
break;
}

    /* Detect `asm' construct with operands.  */
if (asm_noperands (body) >= 0)
{
unsigned int noperands = asm_noperands (body);
rtx *ops = XALLOCAVEC (rtx, noperands);
const char *string;
location_t loc;
expanded_location expanded;

        /* There's no telling what that did to the condition codes.  */
CC_STATUS_INIT;

        /* Get out the operand values.  */
string = decode_asm_operands (body, ops, NULL, NULL, NULL, &loc);
/* Inhibit dying on what would otherwise be compiler bugs.  */
insn_noperands = noperands;
this_is_asm_operands = insn;
expanded = expand_location (loc);

#ifdef FINAL_PRESCAN_INSN
FINAL_PRESCAN_INSN (insn, ops, insn_noperands);
#endif

        /* Output the insn using them.  */
if (string[0])
{
app_enable ();
if (expanded.file && expanded.line)
fprintf (asm_out_file, "%s %i \"%s\" 1\n",
ASM_COMMENT_START, expanded.line, expanded.file);
output_asm_insn (string, ops);
#if HAVE_AS_LINE_ZERO
if (expanded.file && expanded.line)
fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
#endif
}

        if (targetm.asm_out.final_postscan_insn)
targetm.asm_out.final_postscan_insn (file, insn, ops,
insn_noperands);

        this_is_asm_operands = 0;
break;
}

    app_disable ();

    if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (body))
{
/* A delayed-branch sequence */
int i;

        final_sequence = seq;

        /* The first insn in this SEQUENCE might be a JUMP_INSN that will
force the restoration of a comparison that was previously
thought unnecessary.  If that happens, cancel this sequence
and cause that insn to be restored.  */

        next = final_scan_insn (seq->insn (0), file, 0, 1, seen);
if (next != seq->insn (1))
{
final_sequence = 0;
return next;
}

        for (i = 1; i < seq->len (); i++)
{
rtx_insn *insn = seq->insn (i);
rtx_insn *next = NEXT_INSN (insn);
/* We loop in case any instruction in a delay slot gets
split.  */
do
insn = final_scan_insn (insn, file, 0, 1, seen);
while (insn != next);
}
#ifdef DBR_OUTPUT_SEQEND
DBR_OUTPUT_SEQEND (file);
#endif
final_sequence = 0;

        /* If the insn requiring the delay slot was a CALL_INSN, the
insns in the delay slot are actually executed before the
called function.  Hence we don't preserve any CC-setting
actions in these insns and the CC must be marked as being
clobbered by the function.  */
if (CALL_P (seq->insn (0)))
{
CC_STATUS_INIT;
}
break;
}

    /* We have a real machine instruction as rtl.  */

    body = PATTERN (insn);

    /* Do machine-specific peephole optimizations if desired.  */

    if (HAVE_peephole && optimize_p && !flag_no_peephole && !nopeepholes)
{
rtx_insn *next = peephole (insn);
/* When peepholing, if there were notes within the peephole,
emit them before the peephole.  */
if (next != 0 && next != NEXT_INSN (insn))
{
rtx_insn *note, *prev = PREV_INSN (insn);

        for (note = NEXT_INSN (insn); note != next;
note = NEXT_INSN (note))
final_scan_insn (note, file, optimize_p, nopeepholes, seen);

        /* Put the notes in the proper position for a later
rescan.  For example, the SH target can do this
when generating a far jump in a delayed branch
sequence.  */
note = NEXT_INSN (insn);
SET_PREV_INSN (note) = prev;
SET_NEXT_INSN (prev) = note;
SET_NEXT_INSN (PREV_INSN (next)) = insn;
SET_PREV_INSN (insn) = PREV_INSN (next);
SET_NEXT_INSN (insn) = next;
SET_PREV_INSN (next) = insn;
}

        /* PEEPHOLE might have changed this.  */
body = PATTERN (insn);
}

    /* Try to recognize the instruction.
If successful, verify that the operands satisfy the
constraints for the instruction.  Crash if they don't,
since `reload' should have changed them so that they do.  */

    insn_code_number = recog_memoized (insn);
cleanup_subreg_operands (insn);

    /* Dump the insn in the assembly for debugging (-dAP).
If the final dump is requested as slim RTL, dump slim
RTL to the assembly file also.  */
if (flag_dump_rtl_in_asm)
{
print_rtx_head = ASM_COMMENT_START;
if (! (dump_flags & TDF_SLIM))
print_rtl_single (asm_out_file, insn);
else
dump_insn_slim (asm_out_file, insn);
print_rtx_head = "";
}

    if (! constrain_operands_cached (insn, 1))
fatal_insn_not_found (insn);

    /* Some target machines need to prescan each insn before
it is output.  */

#ifdef FINAL_PRESCAN_INSN
FINAL_PRESCAN_INSN (insn, recog_data.operand, recog_data.n_operands);
#endif

    if (targetm.have_conditional_execution ()
&& GET_CODE (PATTERN (insn)) == COND_EXEC)
current_insn_predicate = COND_EXEC_TEST (PATTERN (insn));

    current_output_insn = debug_insn = insn;

    /* Find the proper template for this insn.  */
 templ = get_insn_template (insn_code_number, insn);

    /* If the C code returns 0, it means that it is a jump insn
which follows a deleted test insn, and that test insn
needs to be reinserted.  */
if (templ == 0)
{
rtx_insn *prev;

        gcc_assert (prev_nonnote_insn (insn) == last_ignored_compare);

        /* We have already processed the notes between the setter and
the user.  Make sure we don't process them again, this is
particularly important if one of the notes is a block
scope note or an EH note.  */
for (prev = insn;
prev != last_ignored_compare;
prev = PREV_INSN (prev))
{
if (NOTE_P (prev))
delete_insn (prev);    /* Use delete_note.  */
}

        return prev;
}

    /* If the template is the string "#", it means that this insn must
be split.  */
if (templ[0] == '#' && templ[1] == '\0')
{
rtx_insn *new_rtx = try_split (body, insn, 0);

        /* If we didn't split the insn, go away.  */
if (new_rtx == insn && PATTERN (new_rtx) == body)
fatal_insn ("could not split insn", insn);

        /* If we have a length attribute, this instruction should have
been split in shorten_branches, to ensure that we would have
valid length info for the splitees.  */
gcc_assert (!HAVE_ATTR_length);

        return new_rtx;
}

    /* ??? This will put the directives in the wrong place if
get_insn_template outputs assembly directly.  However calling it
before get_insn_template breaks if the insns is split.  */
if (targetm.asm_out.unwind_emit_before_insn
&& targetm.asm_out.unwind_emit)
targetm.asm_out.unwind_emit (asm_out_file, insn);

    rtx_call_insn *call_insn = dyn_cast <rtx_call_insn *> (insn);
if (call_insn != NULL)
{
rtx x = call_from_call_insn (call_insn);
x = XEXP (x, 0);
if (x && MEM_P (x) && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
{
tree t;
x = XEXP (x, 0);
t = SYMBOL_REF_DECL (x);
if (t)
assemble_external (t);
}
}

    /* Output assembler code from the template.  */
output_asm_insn (templ, recog_data.operand);

    /* Some target machines need to postscan each insn after
it is output.  */
if (targetm.asm_out.final_postscan_insn)
targetm.asm_out.final_postscan_insn (file, insn, recog_data.operand,
recog_data.n_operands);

    if (!targetm.asm_out.unwind_emit_before_insn
&& targetm.asm_out.unwind_emit)
targetm.asm_out.unwind_emit (asm_out_file, insn);

    /* Let the debug info back-end know about this call.  We do this only
after the instruction has been emitted because labels that may be
created to reference the call instruction must appear after it.  */
if ((debug_variable_location_views || call_insn != NULL)
&& !DECL_IGNORED_P (current_function_decl))
debug_hooks->var_location (insn);

    current_output_insn = debug_insn = 0;
}
}
return NEXT_INSN (insn);
}

const char *
get_insn_template (int code, rtx_insn *insn)

{
switch (insn_data[code].output_format)
{
case INSN_OUTPUT_FORMAT_SINGLE:
return insn_data[code].output.single;
case INSN_OUTPUT_FORMAT_MULTI:
return insn_data[code].output.multi[which_alternative];
case INSN_OUTPUT_FORMAT_FUNCTION:
gcc_assert (insn);
return (*insn_data[code].output.function) (recog_data.operand, insn);

    default:
gcc_unreachable ();
}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/web/90080.shtml
繁体地址,请注明出处:http://hk.pswp.cn/web/90080.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

STC89C52系列单片机内部结构详解

STC89C52 是基于 MCS-51 内核的增强型单片机&#xff0c;其内部结构集成了多种功能模块&#xff0c;具备强大的数据处理和控制能力&#xff0c;是嵌入式系统中常用的一种微控制器。本文将结合内部结构框图&#xff0c;详细介绍 STC89C52 的各个核心组成部分及其功能作用。一、中…

Linux防火墙管理和基础服务(FTP/SFTP)

防火墙管理# 开放端口firewalld-cmd --add-port880/tcp --permanent# 移除端口或阻止端口firewalld-cmd --remove-port880/tcp --permanent# 重启服务systemctl restart firewalld# 查看防火墙开放哪些端口&#xff08;查看当前区域的规则&#xff09;firewall-cmd --lis…

Selenium+Java 自动化测试入门到实践:从环境搭建到元素操作

在自动化测试领域&#xff0c;Selenium 凭借其强大的跨浏览器兼容性和灵活的 API&#xff0c;成为 Web 应用测试的首选工具。而 Java 作为一门稳定且广泛应用的编程语言&#xff0c;与 Selenium 结合能构建出高效、可维护的自动化测试框架。本文将从环境搭建开始&#xff0c;逐…

Hugging Face 模型的缓存和直接下载有什么区别?

Hugging Face 模型的缓存和直接下载&#xff08;下载到本地文件夹&#xff09;是两种不同的模型管理方式&#xff0c;它们在使用场景、存储结构和效率上各有优劣。 以下是它们之间的主要区别&#xff1a; Hugging Face 缓存 (Cache) 当您通过 transformers 库中的 from_pretrai…

JavaScript AJAX 实现,演示如何将 Token 添加到 Authorization

以下是一个完整的原生 JavaScript AJAX 实现&#xff0c;演示如何将 Token 添加到 Authorization 头部的示例&#xff1a;基础实现html复制代码<!DOCTYPE html> <html> <head><title>AJAX Token 示例</title><script>// 获取当前用户的 To…

开发语言的优劣势对比及主要应用领域分析

开发语言是程序员用来编写软件指令的工具。每种语言都有自己的设计哲学、语法&#xff08;规则&#xff09;和应用场景&#xff0c;但没有“放之四海而皆准”的最佳语言。以下是主流和重要开发语言的介绍&#xff0c;按主要应用领域分类&#xff1a; 一、全能型语言 (可在多个领…

Java学习-------事务失效

在 Java 开发中&#xff0c;事务是保证数据一致性和完整性的关键机制&#xff0c;尤其在涉及多步数据库操作的业务场景中不可或缺。然而&#xff0c;在实际开发过程中&#xff0c;事务常常会出现 “失效” 的情况 —— 预期的回滚没有发生&#xff0c;数据出现不一致。 Java 事…

JavaScript 01 JavaScript 是什么

1.1 JavaScript 是什么JavaScript 是一门世界上最流行的脚本语言&#xff08;基本所有平台的所有软件都会用到它&#xff09;。“1994年&#xff0c;网景公司(Netscape)发布了Navigator浏览器0.9版。这是历史上第一个比较成熟的网络浏览器&#xff0c;轰动一时。但是&#xff0…

Bun v1.2.19发布,node_modules隔离,sql比node快6倍

大家好,我是农村程序员,独立开发者,行业观察员,前端之虎陈随易。我会在这里分享关于 独立开发、编程技术、思考感悟 等内容,欢迎关注。 技术群与交朋友请在个人网站联系我,网站 1️⃣:https://chensuiyi.me,网站 2️⃣:https://me.yicode.tech。 如果你觉得本文有用…

【NLP舆情分析】基于python微博舆情分析可视化系统(flask+pandas+echarts) 视频教程 - 主页布局实现

大家好&#xff0c;我是java1234_小锋老师&#xff0c;最近写了一套【NLP舆情分析】基于python微博舆情分析可视化系统(flaskpandasecharts)视频教程&#xff0c;持续更新中&#xff0c;计划月底更新完&#xff0c;感谢支持。今天讲解主页布局实现 视频在线地址&#xff1a; …

# 微调需要准备哪些环境配置?

微调需要准备哪些环境配置&#xff1f; 如果没有 GPU&#xff0c;即便是微调较小的大语言模型&#xff08;LLMs&#xff09;&#xff0c;过程也会比较慢。如果你已经有了现成的 GPU&#xff0c;那就可以直接开工了。不过&#xff0c;并不是所有人都能负担得起 GPU—— 这种情况…

ClickHouse物化视图避坑指南:原理、数据迁移与优化

摘要ClickHouse物化视图通过预计算和自动更新机制&#xff0c;显著提升大数据分析查询性能&#xff0c;尤其适合高并发聚合场景。本文将深入解析其技术原理、生产实践中的优化策略&#xff0c;以及数据迁移的实战经验。一、物化视图核心概念ClickHouse的物化视图(Materialized …

Springboot3整合Elasticsearch8(elasticsearch-java)

1、Elasticsearch的JAVA客户端选择 Elasticsearch官方支持的客户端 客户端名称简介使用建议Elasticsearch Java API Client&#xff08;新客户端&#xff09;官方推荐的新客户端&#xff0c;基于 JSON Mapping&#xff08;如 ElasticsearchClient 类&#xff09;&#xff0c;…

OpenCV 官翻8 - 其他算法

文章目录高动态范围成像引言曝光序列源代码示例图像说明结果色调映射图像曝光融合附加资源高级图像拼接 API&#xff08;Stitcher 类&#xff09;目标代码说明相机模型试用指南图像拼接详解 (Python OpenCV >4.0.1)stitching_detailed如何使用背景减除方法目标代码代码解析结…

2025年一区SCI-回旋镖气动椭圆优化算法Boomerang Aerodynamic Ellipse-附Matlab免费代码

引言 本期介绍一种新的元启发式算法——回旋镖气动椭圆优化算法Boomerang Aerodynamic Ellipse Optimizer (BAEO)。该优化器的灵感来自于飞行中的回旋镖的空气动力学行为&#xff0c;明确地建模了释放角和发射力如何塑造其轨迹。于2025年7月最新发表在JCR 1区&#xff0c;中科…

Custom SRP - Custom Render Pipeline

https://catlikecoding.com/unity/tutorials/custom-srp/custom-render-pipeline/ 1. 新建 Render Pipeline 任何内容的渲染&#xff0c;最终都是要由 unity 决定在哪里&#xff0c;什么时候&#xff0c;以哪些参数进行渲染。根据目标效果的复杂程度&#xff0c;决定渲染的过程…

C语言面向对象编程

1.内核通用链表一、什么是 list_head&#xff1f;list_head 是 Linux 内核中自己实现的一种 双向循环链表 的结构&#xff0c;定义在 <linux/list.h> 中。它设计得非常轻巧、灵活&#xff0c;广泛用于内核模块、驱动、进程调度、网络协议栈等。它的关键思想是&#xff1a…

Spring Boot+Redis Zset:三步构建高可靠延迟队列系统

系统设计架构图---------------- ----------------- ---------------- | | | | | | | 生产者 |------>| Redis ZSet |------>| 定时任务消费者 | | (添加延迟任务) | | (延…

MCP vs 传统集成方案:REST API、GraphQL、gRPC的终极对比

MCP vs 传统集成方案&#xff1a;REST API、GraphQL、gRPC的终极对比 &#x1f31f; Hello&#xff0c;我是摘星&#xff01; &#x1f308; 在彩虹般绚烂的技术栈中&#xff0c;我是那个永不停歇的色彩收集者。 &#x1f98b; 每一个优化都是我培育的花朵&#xff0c;每一个特…

SQL语句中锁的使用与优化

一、锁机制简介1.定义在数据库中&#xff0c;除了传统的计算资源&#xff08;如CPU、RAM、I/O等&#xff09;的争用以外&#xff0c;数据也是一种供需要用户共享的资源。如何保证数据并发访问的一致性、有效性是所有数据库必须解决的一个问题&#xff0c;锁冲突也是影响数据库并…