GCC Middle and Back End API Reference
final.c File Reference

Data Structures

struct  label_alignment
struct  debug_prefix_map

Typedefs

typedef struct debug_prefix_map debug_prefix_map

Functions

static int asm_insn_count (rtx)
static void profile_function (FILE *)
static void profile_after_prologue (FILE *)
static bool notice_source_line (rtx, bool *)
static rtx walk_alter_subreg (rtx *, bool *)
static void output_asm_name (void)
static void output_alternate_entry_point (FILE *, rtx)
static tree get_mem_expr_from_op (rtx, int *)
static void output_asm_operand_names (rtx *, int *, int)
static void leaf_renumber_regs (rtx)
static int alter_cond (rtx)
static int final_addr_vec_align (rtx)
static int align_fuzz (rtx, rtx, int, unsigned)
void init_final ()
void default_function_pro_epilogue (FILE *file, HOST_WIDE_INT size)
void default_function_switched_text_sections (FILE *file, tree decl, bool new_is_cold)
void no_asm_to_stream ()
void app_enable ()
void app_disable ()
int dbr_sequence_length ()
void init_insn_lengths ()
static int get_attr_length_1 (rtx insn, int(*fallback_fn)(rtx))
int get_attr_length ()
int get_attr_min_length ()
int default_label_align_after_barrier_max_skip ()
int default_loop_align_max_skip ()
int default_label_align_max_skip ()
int default_jump_align_max_skip ()
static int final_addr_vec_align ()
int label_to_alignment ()
int label_to_max_skip ()
static int align_fuzz ()
int insn_current_reference_address ()
unsigned int compute_alignments ()
static void grow_label_align ()
void update_alignments ()
rtl_opt_passmake_pass_compute_alignments ()
void shorten_branches ()
static int asm_insn_count ()
int asm_str_count ()
void add_debug_prefix_map ()
const char * remap_debug_filename ()
static bool dwarf2_debug_info_emitted_p ()
static tree choose_inner_scope ()
static void change_scope ()
static void reemit_insn_block_notes ()
void final_start_function (rtx first, FILE *file, int optimize_p)
static void profile_after_prologue ()
static void profile_function ()
void final_end_function ()
static void dump_basic_block_info (FILE *file, rtx insn, basic_block *start_to_bb, basic_block *end_to_bb, int bb_map_size, int *bb_seqn)
void final ()
const char * get_insn_template ()
static void output_alternate_entry_point ()
static rtx call_from_call_insn ()
rtx final_scan_insn (rtx insn, FILE *file, int optimize_p, int nopeepholes, int *seen)
static bool notice_source_line ()
void cleanup_subreg_operands ()
rtx alter_subreg ()
static rtx walk_alter_subreg ()
static int alter_cond ()
void output_operand_lossage ()
static tree get_mem_expr_from_op ()
static void output_asm_operand_names ()
static const char * do_assembler_dialects ()
void output_asm_insn ()
void output_asm_label ()
static int mark_symbol_ref_as_used ()
void mark_symbol_refs_as_used ()
void output_operand ()
void output_address ()
void output_addr_const ()
void output_quoted_string ()
void fprint_whex ()
static int sprint_ul_rev ()
void fprint_ul ()
int sprint_ul ()
void asm_fprintf ()
int leaf_function_p ()
int final_forward_branch_p ()
int only_leaf_regs_used ()
static void leaf_renumber_regs ()
void leaf_renumber_regs_insn ()
static unsigned int rest_of_handle_final ()
rtl_opt_passmake_pass_final ()
static unsigned int rest_of_handle_shorten_branches ()
rtl_opt_passmake_pass_shorten_branches ()
static unsigned int rest_of_clean_state ()
rtl_opt_passmake_pass_clean_state ()

Variables

static rtx debug_insn
rtx current_output_insn
static int last_linenum
static int last_discriminator
static int discriminator
static int high_block_linenum
static int high_function_linenum
static const char * last_filename
static const char * override_filename
static int override_linenum
static bool force_source_line = false
const int length_unit_log
rtx this_is_asm_operands
static unsigned int insn_noperands
static rtx last_ignored_compare = 0
static int insn_counter = 0
CC_STATUS cc_status
CC_STATUS cc_prev_status
static int block_depth
static int app_on
rtx final_sequence
static int dialect_number
rtx current_insn_predicate
bool final_insns_dump_p
static bool need_profile_function
static int * insn_lengths
vec< int > insn_addresses_
static int insn_lengths_max_uid
int insn_current_address
int insn_last_address
int insn_current_align
static rtxuid_align
static int * uid_shuid
static struct label_alignmentlabel_align
static int min_labelno
static int max_labelno
static debug_prefix_mapdebug_prefix_maps

Typedef Documentation

   ??? This is probably the wrong place for these.  
   Structure recording the mapping from source file and directory
   names at compile time to those to be embedded in debug
   information.  

Function Documentation

void add_debug_prefix_map ( )
   Record a debug file prefix mapping.  ARG is the argument to
   -fdebug-prefix-map and must be of the form OLD=NEW.  

References emit_note_before().

static int align_fuzz ( rtx  ,
rtx  ,
int  ,
unsigned   
)
static
static int align_fuzz ( )
static
   The differences in addresses
   between a branch and its target might grow or shrink depending on
   the alignment the start insn of the range (the branch for a forward
   branch or the label for a backward branch) starts out on; if these
   differences are used naively, they can even oscillate infinitely.
   We therefore want to compute a 'worst case' address difference that
   is independent of the alignment the start insn of the range end
   up on, and that is at least as large as the actual difference.
   The function align_fuzz calculates the amount we have to add to the
   naively computed difference, by traversing the part of the alignment
   chain of the start insn of the range that is in front of the end insn
   of the range, and considering for each alignment the maximum amount
   that it might contribute to a size increase.

   For casesi tables, we also want to know worst case minimum amounts of
   address difference, in case a machine description wants to introduce
   some common offset that is added to all offsets in a table.
   For this purpose, align_fuzz with a growth argument of 0 computes the
   appropriate adjustment.  
   Compute the maximum delta by which the difference of the addresses of
   START and END might grow / shrink due to a different address for start
   which changes the size of alignment insns between START and END.
   KNOWN_ALIGN_LOG is the alignment known for START.
   GROWTH should be ~0 if the objective is to compute potential code size
   increase, and 0 if the objective is to compute potential shrink.
   The return value is undefined for any other value of GROWTH.  
static int alter_cond ( rtx  )
static
static int alter_cond ( )
static
   Given BODY, the body of a jump instruction, alter the jump condition
   as required by the bits that are set in cc_status.flags.
   Not all of the bits there can be handled at this level in all cases.

   The value is normally 0.
   1 means that the condition has become always true.
   -1 means that the condition has become always false.
   2 means that COND has been altered.  
           Jump becomes unconditional.  
           Jump becomes no-op.  
           Jump becomes unconditional.  
           Jump becomes no-op.  
           Jump becomes unconditional.  
           Jump becomes no-op.  
       The flags are valid if signed condition operators are converted
       to unsigned.  
rtx alter_subreg ( )
   If X is a SUBREG, try to replace it with a REG or a MEM, based on
   the thing it is a subreg of.  Do it anyway if FINAL_P.  
     simplify_subreg does not remove subreg from volatile references.
     We are required to.  
         For paradoxical subregs on big-endian machines, SUBREG_BYTE
         contains 0 instead of the proper offset.  See simplify_subreg.  
             Simplify_subreg can't handle some REG cases, but we have to.  

Referenced by output_asm_insn().

void app_disable ( void  )
   Disable APP processing of subsequent output.
   Called from varasm.c before most kinds of output.  
void app_enable ( void  )
   Enable APP processing of subsequent output.
   Used before the output from an `asm' statement.  
void asm_fprintf ( )
   A poor man's fprintf, with the added features of %I, %R, %L, and %U.
   %R prints the value of REGISTER_PREFIX.
   %L prints the value of LOCAL_LABEL_PREFIX.
   %U prints the value of USER_LABEL_PREFIX.
   %I prints the value of IMMEDIATE_PREFIX.
   %O runs ASM_OUTPUT_OPCODE to transform what follows in the string.
   Also supported are %d, %i, %u, %x, %X, %o, %c, %s and %%.

   We handle alternate assembler dialects here, just like output_asm_insn.  
               This is a prefix to the 'd', 'i', 'u', 'x', 'X', and
               'o' cases, but we do not check for those cases.  It
               means that the value is a HOST_WIDE_INT, which may be
               either `long' or `long long'.  
               Uppercase letters are reserved for general use by asm_fprintf
               and so are not available to target specific code.  In order to
               prevent the ASM_FPRINTF_EXTENSIONS macro from using them then,
               they are defined here.  As they get turned into real extensions
               to asm_fprintf they should be removed from this list.  
static int asm_insn_count ( rtx  )
static
static int asm_insn_count ( )
static
   Given the body of an INSN known to be generated by an ASM statement, return
   the number of machine instructions likely to be generated for this insn.
   This is used to compute its length.  
int asm_str_count ( )
   Return the number of machine instructions likely to be generated for the
   inline-asm template. 
static rtx call_from_call_insn ( )
static
   Given a CALL_INSN, find and return the nested CALL. 
static void change_scope ( )
static
   Emit lexical block notes needed to change scope from S1 to S2.  
     Close scopes.  
     Open scopes.  
static tree choose_inner_scope ( )
static
   Return scope resulting from combination of S1 and S2.  

References cfun, and function::decl.

void cleanup_subreg_operands ( )
   For each operand in INSN, simplify (subreg (reg)) so that it refers
   directly to the desired hard register.  
         The following test cannot use recog_data.operand when testing
         for a SUBREG: the underlying object might have been changed
         already if we are inside a match_operator expression that
         matches the else clause.  Instead we test the underlying
         expression directly.  
unsigned int compute_alignments ( void  )
   Compute branch alignments based on frequency information in the
   CFG.  
     If not optimizing or optimizing for size, don't assign any alignments.  
         There are two purposes to align block with no fallthru incoming edge:
         1) to avoid fetch stalls when branch destination is near cache boundary
         2) to improve cache efficiency in case the previous block is not executed
            (so it does not need to be in the cache).

         We to catch first case, we align frequently executed blocks.
         To catch the second, we align blocks that are executed more frequently
         than the predecessor and the predecessor is likely to not be executed
         when function is called.  
         In case block is frequent and reached mostly by non-fallthru edge,
         align it.  It is most likely a first block of loop.  

References edge_def::flags.

int dbr_sequence_length ( void  )
   Return the number of slots filled in the current
   delayed branch sequence (we don't count the insn needing the
   delay slot).   Zero if not in a delayed branch sequence.  

References label_alignment::alignment, and label_alignment::max_skip.

void default_function_pro_epilogue ( FILE *  file,
HOST_WIDE_INT  size 
)
   Default target function prologue and epilogue assembler output.

   If not overridden for epilogue code, then the function body itself
   contains return instructions wherever needed.  

Referenced by reemit_insn_block_notes().

void default_function_switched_text_sections ( FILE *  ,
tree  ,
bool   
)
   Default target function switched text sections.  

References app_on, and asm_out_file.

int default_jump_align_max_skip ( )
int default_label_align_after_barrier_max_skip ( )
int default_label_align_max_skip ( )
int default_loop_align_max_skip ( )
static const char* do_assembler_dialects ( )
static
   Helper function to parse assembler dialects in the asm string.
   This is called from output_asm_insn and asm_fprintf.  
           If we want the first dialect, do nothing.  Otherwise, skip
           DIALECT_NUMBER of strings ending with '|'.  
                   Skip over any character after a percent sign.  
             Skip to close brace.  
                 Skip over any character after a percent sign.  
static void dump_basic_block_info ( FILE *  file,
rtx  insn,
basic_block start_to_bb,
basic_block end_to_bb,
int  bb_map_size,
int *  bb_seqn 
)
static
   Dumper helper for basic block information. FILE is the assembly
   output file, and INSN is the instruction being emitted.  
static bool dwarf2_debug_info_emitted_p ( )
static
   Return true if DWARF2 debug info can be emitted for DECL.  
void final ( )
   Output assembler code for some insns: all or part of a function.
   For description of args, see `final_start_function', above.  
     Used for -dA dump.  
         If CC tracking across branches is enabled, record the insn which
         jumps to each branch only reached from one place.  
         There is no cfg for a thunk.  
     Output the insns.  
                 This can be triggered by bugs elsewhere in the compiler if
                 new insns are created after init_insn_lengths is called.  
     Remove CFI notes, to avoid compare-debug failures.  

References targetm.

static int final_addr_vec_align ( rtx  )
static
static int final_addr_vec_align ( )
static
void final_end_function ( void  )
   Output assembler code for the end of a function.
   For clarity, args are same as those of `final_start_function'
   even though not all of them are needed.  
     Finally, output the function epilogue:
     code to restore the stack frame and return to the caller.  
     And debug output.  
int final_forward_branch_p ( )
   Return 1 if branch is a forward branch.
   Uses insn_shuid array, so it works only in the final pass.  May be used by
   output templates to customary add branch prediction hints.
     We've hit some insns that does not have id information available.  

References RTL_PASS.

rtx final_scan_insn ( rtx  insn,
FILE *  file,
int  optimize_p,
int  nopeepholes,
int *  seen 
)
   The final scan for one insn, INSN.
   Args are same as in `final', except that INSN
   is the insn being scanned.
   Value returned is the next insn to be scanned.

   NOPEEPHOLES is the flag to disallow peephole processing (currently
   used for within delayed branch sequence output).

   SEEN is used to track the end of the prologue, for emitting
   debug information.  We force the emission of a line note after
   both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG, or
   at the beginning of the second basic block, whichever comes
   first.  
     Ignore deleted insns.  These can occur when we split insns (due to a
     template of "#") while not optimizing.  
                 Output debugging info about the symbol-block beginning.  
                 Mark this block as output.  
                 End of a symbol-block.  
             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.  
             Similarly, but need to use different namespace for it.  
         The target port might emit labels in the output function for
         some insn, e.g. sh.c output_branchy_insn.  
         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.  
             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.  
           Reset this early so it is correct for ASM statements.  
           An INSN, JUMP_INSN or CALL_INSN.
           First check for special kinds that recog doesn't recognize.  
             If there is a REG_CC_SETTER note on this insn, it means that
             the setting of the condition code was done in the delay slot
             of the insn that branched here.  So recover the cc status
             from the insn that set it.  
           Detect insns that are really jump-tables
           and output them as such.  
           Output this line note if it is the first or the last line
           note in a row.  
               There's no telling what that did to the condition codes.  
           Detect `asm' construct with operands.  
               There's no telling what that did to the condition codes.  
               Get out the operand values.  
               Inhibit dying on what would otherwise be compiler bugs.  
               Output the insn using them.  
               A delayed-branch sequence 
               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.  
                   We loop in case any instruction in a delay slot gets
                   split.  
               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.  
           We have a real machine instruction as rtl.  
           Check for redundant test and compare instructions
           (when the condition codes are already set up as desired).
           This is done only when optimizing; if not optimizing,
           it should be possible for the user to alter a variable
           with the debugger in between statements
           and the next statement should reexamine the variable
           to compute the condition codes.  
                       Don't delete insn if it has an addressing side-effect.  
                           or if anything in it is volatile.  
                           We don't really delete the insn; just ignore it.  
           If this is a conditional branch, maybe modify it
           if the cc's are in a nonstandard state
           so that it accomplishes the same thing that it would
           do straightforwardly if the cc's were set up normally.  
               This function may alter the contents of its argument
               and clear some of the cc_status.flags bits.
               It may also return 1 meaning condition now always true
               or -1 meaning condition now always false
               or 2 meaning condition nontrivial but altered.  
               If condition now has fixed value, replace the IF_THEN_ELSE
               with its then-operand or its else-operand.  
               The jump is now either unconditional or a no-op.
               If it has become a no-op, don't try to output it.
               (It would not be recognized.)  
                 Replace (set (pc) (return)) with (return).  
               Rerecognize the instruction if it has changed.  
           If this is a conditional trap, maybe modify it if the cc's
           are in a nonstandard state so that it accomplishes the same
           thing that it would do straightforwardly if the cc's were
           set up normally.  
               This function may alter the contents of its argument
               and clear some of the cc_status.flags bits.
               It may also return 1 meaning condition now always true
               or -1 meaning condition now always false
               or 2 meaning condition nontrivial but altered.  
               If TRAP_CONDITION has become always false, delete the
               instruction.  
               If TRAP_CONDITION has become always true, replace
               TRAP_CONDITION with const_true_rtx.  
               Rerecognize the instruction if it has changed.  
           Make same adjustments to instructions that examine the
           condition codes without jumping and instructions that
           handle conditional moves (if this machine has either one).  
           Do machine-specific peephole optimizations if desired.  
               When peepholing, if there were notes within the peephole,
               emit them before the peephole.  
                   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.  
               PEEPHOLE might have changed this.  
           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.  
           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.  
           Some target machines need to prescan each insn before
           it is output.  
           Update `cc_status' for this instruction.
           The instruction's output routine may change it further.
           If the output routine for a jump insn needs to depend
           on the cc status, it should look at cc_prev_status.  
           Find the proper template for this 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.  
               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.  
           If the template is the string "#", it means that this insn must
           be split.  
               If we didn't split the insn, go away.  
               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.  
           ??? 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.  
           Output assembler code from the template.  
           Some target machines need to postscan each insn after
           it is output.  

References debug_hooks.

void final_start_function ( rtx  first,
FILE *  file,
int  optimize_p 
)
   Output assembler code for the start of a function,
   and initialize some of the variables in this file
   for the new function.  The label for the function and associated
   assembler pseudo-ops have already been output in `assemble_start_function'.

   FIRST is the first insn of the rtl for the function being compiled.
   FILE is the file to write assembler code to.
   OPTIMIZE_P is nonzero if we should eliminate redundant
     test and compare insns.  
     The Sun386i and perhaps other machines don't work right
     if the profiling code comes after the prologue.  
     If debugging, assign block numbers to all of the blocks in this
     function.  
         We never actually put out begin/end notes for the top-level
         block in the function.  But, conceptually, that block is
         always needed.  
         Issue a warning 
     First output the function prologue: code to set up the stack frame.  
     If the machine represents the prologue as RTL, the profiling code must
     be emitted when NOTE_INSN_PROLOGUE_END is scanned.  

References assemble_integer(), data_section, floor_log2(), switch_to_section(), and targetm.

void fprint_ul ( )
   Write an unsigned long as decimal to a file, fast. 
     python says: len(str(2**64)) == 20 
     It's probably too small to bother with string reversal and fputs. 

References df_regs_ever_live_p(), and global_regs.

void fprint_whex ( )
   Write a HOST_WIDE_INT number in hex form 0x1234, fast. 

References get_insns().

Referenced by dw2_asm_output_data_uleb128_raw().

int get_attr_length ( )
   Obtain the current length of an insn.  If branch shortening has been done,
   get its actual length.  Otherwise, get its maximum length.  
static int get_attr_length_1 ( rtx  insn,
int(*)(rtx fallback_fn 
)
inlinestatic
   Obtain the current length of an insn.  If branch shortening has been done,
   get its actual length.  Otherwise, use FALLBACK_FN to calculate the
   length.  
int get_attr_min_length ( )
   Obtain the current length of an insn.  If branch shortening has been done,
   get its actual length.  Otherwise, get its minimum length.  

Referenced by decls_for_scope(), and reorder_basic_blocks().

const char* get_insn_template ( )
static tree get_mem_expr_from_op ( rtx  ,
int *   
)
static
static tree get_mem_expr_from_op ( )
static
   If OP is a REG or MEM and we can find a MEM_EXPR corresponding to it
   or its address, return that expr .  Set *PADDRESSP to 1 if the expr
   corresponds to the address of the object and 0 if to the object.  
     Otherwise we have an address, so indicate it and look at the address.  
     First check if we have a decl for the address, then look at the right side
     if it is a PLUS.  Otherwise, strip off arithmetic and keep looking.
     But don't allow the address to itself be indirect.  
static void grow_label_align ( )
static
   Grow the LABEL_ALIGN array after new labels are created.  
     Range of labels grows monotonically in the function.  Failing here
     means that the initialization of array got lost.  

Referenced by update_alignments().

void init_final ( )
   Initialize data in final at the beginning of a compilation.  
void init_insn_lengths ( void  )
   Indicate that branch shortening hasn't yet been done.  
int insn_current_reference_address ( )
   Compute a worst-case reference address of a branch so that it
   can be safely used in the presence of aligned labels.  Since the
   size of the branch itself is unknown, the size of the branch is
   not included in the range.  I.e. for a forward branch, the reference
   address is the end address of the branch as known from the previous
   branch shortening pass, minus a value to account for possible size
   increase due to alignment.  For a backward branch, it is the start
   address of the branch as known from the current pass, plus a value
   to account for possible size increase due to alignment.
   NB.: Therefore, the maximum offset allowed for backward branches needs
   to exclude the branch size.  
       This can happen for example on the PA; the objective is to know the
       offset to address something in front of the start of the function.
       Thus, we can treat it like a backward branch.
       We assume here that FUNCTION_BOUNDARY / BITS_PER_UNIT is larger than
       any alignment we'd encounter, so we skip the call to align_fuzz.  
     BRANCH has no proper alignment chain set, so use SEQ.
     BRANCH also has no INSN_SHUID.  
         Forward branch.  
         Backward branch.  
int label_to_alignment ( )
   For the benefit of port specific code do this also as a function.  
int label_to_max_skip ( )
int leaf_function_p ( void  )
   Return nonzero if this function has no function calls.  

Referenced by split_live_ranges_for_shrink_wrap().

static void leaf_renumber_regs ( rtx  )
static
static void leaf_renumber_regs ( )
static
   Scan all instructions and renumber all registers into those
   available in leaf functions.  
     Renumber only the actual patterns.
     The reg-notes can contain frame pointer refs,
     and renumbering them could crash, and should not be needed.  

References current_function_decl, dump_flags, dump_function_header(), final_insns_dump_p, flag_dump_unnumbered, and get_insns().

void leaf_renumber_regs_insn ( )
   Scan IN_RTX and its subexpressions, and renumber all regs into those
   available in leaf functions.  
     Renumber all input-registers into output-registers.
     renumbered_regs would be 1 for an output-register;
     they  
         Don't renumber the same reg twice.  
         Don't try to renumber pseudo regs.  It is possible for a pseudo reg
         to reach here as part of a REG_NOTE.  
         Inside a SEQUENCE, we find insns.
         Renumber just the patterns of these insns,
         just as we do for the top-level insns.  

Referenced by sprint_ul().

rtl_opt_pass* make_pass_clean_state ( )
rtl_opt_pass* make_pass_compute_alignments ( )

References log(), and next_nonnote_insn().

rtl_opt_pass* make_pass_final ( )
rtl_opt_pass* make_pass_shorten_branches ( )
static int mark_symbol_ref_as_used ( )
static
   Helper rtx-iteration-function for mark_symbol_refs_as_used and
   output_operand.  Marks SYMBOL_REFs as referenced through use of
   assemble_external.  
     If we have a used symbol, we may have to emit assembly
     annotations corresponding to whether the symbol is external, weak
     or has non-default visibility.  

Referenced by output_asm_insn().

void mark_symbol_refs_as_used ( )
   Marks SYMBOL_REFs in x as referenced through use of assemble_external.  
void no_asm_to_stream ( )
   Default target hook that outputs nothing to a stream.  
static bool notice_source_line ( rtx  ,
bool *   
)
static
static bool notice_source_line ( )
static
   Return whether a source line note needs to be emitted before INSN.
   Sets IS_STMT to TRUE if the line should be marked as a possible
   breakpoint location.  
         If the discriminator changed, but the line number did not,
         output the line table entry with is_stmt false so the
         debugger does not treat this as a breakpoint location.  

References CC_STATUS::flags, reverse_condition(), and swap_condition().

int only_leaf_regs_used ( void  )
   On some machines, a function with no call insns
   can run faster if it doesn't create its own register window.
   When output, the leaf function should use only the "output"
   registers.  Ordinarily, the function would be compiled to use
   the "input" registers to find its arguments; it is a candidate
   for leaf treatment if it uses only the "input" registers.
   Leaf function treatment means renumbering so the function
   uses the "output" registers instead.  
   Return 1 if this function uses only the registers that can be
   safely renumbered.  
void output_addr_const ( )
   Print an integer constant expression in assembler syntax.
   Addition and subtraction are the only arithmetic
   that may appear in these expressions.  
         Fall through.  
         This used to output parentheses around the expression,
         but that does not work on the 386 (either ATT or BSD assembler).  
             We can use %d if the number is one word and positive.  
           We can't handle floating point constants;
           PRINT_OPERAND must handle them.  
         Some assemblers need integer constants to appear last (eg masm).  
         Avoid outputting things like x-x or x+5-x,
         since some assemblers can't handle that.  

Referenced by output_asm_operand_names().

void output_address ( )
   Print a memory reference operand for address X using
   machine-dependent assembler syntax.  

Referenced by output_asm_operand_names().

static void output_alternate_entry_point ( FILE *  ,
rtx   
)
static
static void output_alternate_entry_point ( )
static
   Emit the appropriate declaration for an alternate-entry-point
   symbol represented by INSN, to FILE.  INSN is a CODE_LABEL with
   LABEL_KIND != LABEL_NORMAL.

   The case fall-through in this function is intentional.  

References targetm.

void output_asm_insn ( )
   Output text from TEMPLATE to the assembler output file,
   obeying %-directions to substitute operands taken from
   the vector OPERANDS.

   %N (for N a digit) means print operand N in usual manner.
   %lN means require operand N to be a CODE_LABEL or LABEL_REF
      and print the label name with no punctuation.
   %cN means require operand N to be a constant
      and print the constant expression with no punctuation.
   %aN means expect operand N to be a memory address
      (not a memory reference!) and print a reference
      to that address.
   %nN means expect operand N to be a constant
      and print a constant expression for minus the value
      of the operand, with no other punctuation.  
     An insn may return a null string template
     in a case where no assembler code is needed.  
           %% outputs a single %.  %{, %} and %| print {, } and | respectively
           if ASSEMBLER_DIALECT defined and these characters have a special
           meaning as dialect delimiters.
           %= outputs a number which is unique to each insn in the entire
           compilation.  This is useful for making local labels that are
           referred to more than once in a given insn.  
           % followed by a letter and some digits
           outputs an operand in a special way depending on the letter.
           Letters `acln' are implemented directly.
           Other letters are passed to `output_operand' so that
           the TARGET_PRINT_OPERAND hook can define them.  
           % followed by a digit outputs an operand the default way.  
           % followed by punctuation: output something for that
           punctuation character alone, with no operand.  The
           TARGET_PRINT_OPERAND hook decides what is actually done.  
     Write out the variable names for operands, if we know them.  

References alter_subreg(), asm_out_file, for_each_rtx(), mark_symbol_ref_as_used(), and targetm.

void output_asm_label ( )
   Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol.  

Referenced by output_asm_operand_names().

static void output_asm_name ( )
static
   Output of assembler code from a template, and its subroutines.  
   Annotate the assembly with a comment describing the pattern and
   alternative used.  
         Clear this so only the first assembler insn
         of any rtl insn will get the special comment for -dp.  
static void output_asm_operand_names ( rtx ,
int *  ,
int   
)
static
static void output_asm_operand_names ( )
static
   Output operand names for assembler instructions.  OPERANDS is the
   operand vector, OPORDER is the order to write the operands, and NOPS
   is the number of operands to write.  

References asm_out_file, HOST_WIDE_INT_PRINT_DEC, insn_noperands, output_addr_const(), output_address(), output_asm_label(), output_operand(), and output_operand_lossage().

void output_operand ( )
   Print operand X using machine-dependent assembler syntax.
   CODE is a non-digit that preceded the operand-number in the % spec,
   such as 'z' if the spec was `%z3'.  CODE is 0 if there was no char
   between the % and the digits.
   When CODE is a non-letter, X is 0.

   The meanings of the letters are machine-dependent and controlled
   by TARGET_PRINT_OPERAND.  
     X must not be a pseudo reg.  

Referenced by output_asm_operand_names().

void output_operand_lossage ( )
   Report inconsistency between the assembler template and the operands.
   In an `asm', it's the user's fault; otherwise, the compiler's fault.  

Referenced by get_random_seed(), and output_asm_operand_names().

void output_quoted_string ( )
   Output a quoted string.  

Referenced by dbxout_begin_stabn(), and dbxout_begin_stabn_sline().

static void profile_after_prologue ( FILE *  )
static
static void profile_after_prologue ( )
static
static void profile_function ( FILE *  )
static
static void profile_function ( )
static
static void reemit_insn_block_notes ( )
static
   Rebuild all the NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes based
   on the scope tree and the newly reordered instructions.  
         Prevent lexical blocks from straddling section boundaries.  
         Avoid putting scope notes between jump table and its label.  
         For sequences compute scope resulting from merging all scopes
         of instructions nested inside.  
     change_scope emits before the insn, not after.  

References default_function_pro_epilogue(), HAVE_prologue, need_profile_function, profile_function(), and targetm.

const char* remap_debug_filename ( )
   Perform user-specified mapping of debug filename prefixes.  Return
   the new name corresponding to FILENAME.  
static unsigned int rest_of_clean_state ( )
static
     It is very important to decompose the RTL instruction chain here:
     debug information keeps pointing into CODE_LABEL insns inside the function
     body.  If these remain pointing to the other insns, we end up preserving
     whole RTL chain and attached detailed debug info in memory.  
     In case the function was not output,
     don't leave any temporary anonymous types
     queued up for sdb output.  
     Clear out the insn_length contents now that they are no
     longer valid.  
     Show no temporary slots allocated.  
     We can reduce stack alignment on call site only when we are sure that
     the function body just produced will be actually used in the final
     executable.  
     Make sure volatile mem refs aren't considered valid operands for
     arithmetic insns.  We must call this here if this is a nested inline
     function, since the above code leaves us in the init_recog state,
     and the function context push/pop code does not save/restore volatile_ok.

     ??? Maybe it isn't necessary for expand_start_function to call this
     anymore if we do it here?  
     We're done with this function.  Free up memory if we can.  
static unsigned int rest_of_handle_final ( )
static
   Turn the RTL into assembly.  
     Get the function's name, as described by its RTL.  This may be
     different from the DECL_NAME name used in the source file.  
     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.  
     Free up reg info memory.  
     Write DBX symbols if requested.  
     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.  
     Release the blocks that are linked to DECL_INITIAL() to free the memory.  
static unsigned int rest_of_handle_shorten_branches ( )
static
     Shorten branches.  
void shorten_branches ( )
   Make a pass over all insns and compute their actual lengths by shortening
   any branches of variable length if possible.  
   shorten_branches might be called multiple times:  for example, the SH
   port splits out-of-range conditional branches in MACHINE_DEPENDENT_REORG.
   In order to do this, it needs proper length information, which it obtains
   by calling shorten_branches.  This cannot be collapsed with
   shorten_branches itself into a single pass unless we also want to integrate
   reorg.c, since the branch splitting exposes new instructions with delay
   slots.  
     Compute maximum UID and allocate label_align / uid_shuid.  
     Free uid_shuid before reallocating it.  
     Initialize label_align and set up uid_shuid to be strictly
     monotonically rising with insn order.  
     We use max_log here to keep track of the maximum alignment we want to
     impose on the next CODE_LABEL (or the current one if we are processing
     the CODE_LABEL itself).  
             Merge in alignments computed by compute_alignments.  
             ADDR_VECs only take room if read-only data goes into the text
             section.  
     Allocate the rest of the arrays.  
     Syntax errors can lead to labels being outside of the main insn stream.
     Initialize insn_addresses, so that we get reproducible results.  
     Initialize uid_align.  We scan instructions
     from end to start, and keep in align_tab[n] the last seen insn
     that does an alignment of at least n+1, i.e. the successor
     in the alignment chain for an insn that does / has a known
     alignment of n.  
             Found an alignment label.  
     When optimizing, we start assuming minimum length, and keep increasing
     lengths as we find the need for this, till nothing changes.
     When not optimizing, we start assuming maximum lengths, and
     do a single pass to update the lengths.  
         Look for ADDR_DIFF_VECs, and initialize their minimum and maximum
         label fields.  
     Compute initial lengths, addresses, and varying flags for each insn.  
             This only takes room if read-only data goes into the text
             section.  
             Alignment is handled by ADDR_VEC_ALIGN.  
             Inside a delay slot sequence, we do not do any branch shortening
             if the shortening could change the number of delay slots
             of the branch.  
         If needed, do any adjustment.  
     Now loop over all the insns finding varying length insns.  For each,
     get the current insn length.  If it has changed, reflect the change.
     When nothing changes for a full pass, we are done.  
                 If the mode of a following jump table was changed, we
                 may need to update the alignment of this label.  
                 Avoid automatic aggregate initialization.  
                 Try to find a known alignment for rel_lab.  
                 See the comment on addr_diff_vec_flags in rtl.h for the
                 meaning of the flags values.  base: REL_LAB   vec: INSN  
                 Anything after INSN has still addresses from the last
                 pass; adjust these so that they reflect our current
                 estimate for this pass.  
                 We want to know the worst case, i.e. lowest possible value
                 for the offset of MIN_LAB.  If MIN_LAB is after REL_LAB,
                 its offset is positive, and we have to be wary of code shrink;
                 otherwise, it is negative, and we have to be vary of code
                 size increase.  
                     If INSN is between REL_LAB and MIN_LAB, the size
                     changes we are about to make can change the alignment
                     within the observed offset, therefore we have to break
                     it up into two parts that are independent.  
                 Likewise, determine the highest lowest possible value
                 for the offset of MAX_LAB.  
                     insn_current_length returns 0 for insns with a
                     non-varying length.  
             If needed, do any adjustment.  
         For a non-optimizing compile, do only a single pass.  

References targetm.

int sprint_ul ( )
   Write an unsigned long as decimal to a string, fast.
   s must be wide enough to not overflow, at least 21 chars.
   Returns the length of the string (without terminating '\0'). 
     Reverse the string. 

References leaf_renumber_regs_insn().

static int sprint_ul_rev ( )
static
   Internal function that prints an unsigned long in decimal in reverse.
   The output string IS NOT null-terminated. 
         alternate version, without modulo 
         oldval = value; 
         value /= 10; 
         s[i] = "0123456789" [oldval - 10*value]; 
         i++ 
void update_alignments ( )
   Update the already computed alignment information.  LABEL_PAIRS is a vector
   made up of pairs of labels for which the alignment information of the first
   element will be copied from that of the second element.  

References free(), get_insns(), get_max_uid(), grow_label_align(), log(), max_label_num(), and max_uid.

static rtx walk_alter_subreg ( rtx ,
bool *   
)
static
static rtx walk_alter_subreg ( )
static
   Do alter_subreg on all the SUBREGs contained in X.  

Variable Documentation

int app_on
static
   Nonzero if have enabled APP processing of our assembler output.  

Referenced by default_function_switched_text_sections().

int block_depth
static
   Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  
CC_STATUS cc_prev_status
   During output of an insn, this contains a copy of cc_status
   from before the insn.  
CC_STATUS cc_status
   This variable contains machine-dependent flags (defined in tm.h)
   set and examined by output routines
   that describe how to interpret the condition codes properly.  
rtx current_insn_predicate
   Nonnull if the insn currently being emitted was a COND_EXEC pattern.  
rtx current_output_insn
   Last insn processed by final_scan_insn.  
rtx debug_insn
static
   Last insn processed by final_scan_insn.  
debug_prefix_map* debug_prefix_maps
static
   Linked list of such structures.  
int dialect_number
static
   Number of the assembler dialect to use, starting at 0.  
int discriminator
static
   Discriminator of current block.  
bool final_insns_dump_p
   True if printing into -fdump-final-insns= dump.  

Referenced by leaf_renumber_regs().

rtx final_sequence
   If we are outputting an insn sequence, this contains the sequence rtx.
   Zero otherwise.  
bool force_source_line = false
static
   Whether to force emission of a line note before the next insn.  
int high_block_linenum
static
   Highest line number in current block.  
int high_function_linenum
static
   Likewise for function.  
vec<int> insn_addresses_
int insn_counter = 0
static
   Assign a unique number to each insn that is output.
   This can be used to generate unique local labels.  
int insn_current_address
   Address of insn being processed.  Used by `insn_current_length'.  
int insn_current_align
   known invariant alignment of insn being processed.  
int insn_last_address
   Address of insn being processed in previous iteration.  
int* insn_lengths
static
   The next two pages contain routines used to compute the length of an insn
   and to shorten branches.  
   Arrays for insn lengths, and addresses.  The latter is referenced by
   `insn_current_length'.  
int insn_lengths_max_uid
static
   Max uid for which the above arrays are valid.  
unsigned int insn_noperands
static
   Number of operands of this insn, for an `asm' with operands.  

Referenced by output_asm_operand_names().

struct label_alignment* label_align
static
int last_discriminator
static
   Last discriminator written to assembly.  
const char* last_filename
static
   Filename of last NOTE.  
rtx last_ignored_compare = 0
static
   Compare optimization flag.  
int last_linenum
static
   Line number of last NOTE.  
const int length_unit_log
int max_labelno
static
int min_labelno
static
bool need_profile_function
static
   True if profile_function should be called, but hasn't been called yet.  

Referenced by get_insn_template(), and reemit_insn_block_notes().

const char* override_filename
static
   Override filename and line number.  
int override_linenum
static
rtx this_is_asm_operands
   Nonzero while outputting an `asm' with operands.
   This means that inconsistencies are the user's fault, so don't die.
   The precise value is the insn being output, to pass to error_for_asm.  
rtx* uid_align
static
int* uid_shuid
static