GCC Middle and Back End API Reference
rtl.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "ggc.h"
#include "diagnostic-core.h"
#include "rtl.def"
#include "insn-notes.def"
#include "reg-notes.def"
Include dependency graph for rtl.c:

Macros

#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   sizeof FORMAT - 1 ,
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   NAME ,
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   FORMAT ,
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   CLASS,
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)
#define DEF_INSN_NOTE(NAME)   #NAME,
#define DEF_REG_NOTE(NAME)   #NAME,

Functions

rtvec rtvec_alloc ()
rtvec shallow_copy_rtvec ()
unsigned int rtx_size ()
rtx rtx_alloc_stat ()
bool shared_const_p ()
rtx copy_rtx ()
rtx shallow_copy_rtx_stat ()
int rtx_equal_p_cb ()
int rtx_equal_p ()
hashval_t iterative_hash_rtx ()
void dump_rtx_statistics ()

Variables

const unsigned char rtx_length [NUM_RTX_CODE]
const char *const rtx_name [NUM_RTX_CODE]
const char *const rtx_format [NUM_RTX_CODE]
enum rtx_class rtx_class [NUM_RTX_CODE]
const unsigned char rtx_code_size [NUM_RTX_CODE]
const char *const note_insn_name [NOTE_INSN_MAX]
const char *const reg_note_name [REG_NOTE_MAX]
static int rtx_alloc_counts [(int) LAST_AND_UNUSED_RTX_CODE]
static int rtx_alloc_sizes [(int) LAST_AND_UNUSED_RTX_CODE]
static int rtvec_alloc_counts
static int rtvec_alloc_sizes
int generating_concat_p
int currently_expanding_to_rtl

Macro Definition Documentation

#define DEF_INSN_NOTE (   NAME)    #NAME,
#define DEF_REG_NOTE (   NAME)    #NAME,
#define DEF_RTL_EXPR (   ENUM,
  NAME,
  FORMAT,
  CLASS 
)    sizeof FORMAT - 1 ,

RTL utility routines. Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. This file is compiled twice: once for the generator programs once for the compiler. Indexed by rtx code, gives number of operands for an rtx with that code. Does NOT include rtx header data (code and links).

Indexed by rtx code, gives the name of that kind of rtx, as a C string.

#define DEF_RTL_EXPR (   ENUM,
  NAME,
  FORMAT,
  CLASS 
)    NAME ,

RTL utility routines. Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. This file is compiled twice: once for the generator programs once for the compiler. Indexed by rtx code, gives number of operands for an rtx with that code. Does NOT include rtx header data (code and links).

Indexed by rtx code, gives the name of that kind of rtx, as a C string.

#define DEF_RTL_EXPR (   ENUM,
  NAME,
  FORMAT,
  CLASS 
)    FORMAT ,

RTL utility routines. Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. This file is compiled twice: once for the generator programs once for the compiler. Indexed by rtx code, gives number of operands for an rtx with that code. Does NOT include rtx header data (code and links).

Indexed by rtx code, gives the name of that kind of rtx, as a C string.

#define DEF_RTL_EXPR (   ENUM,
  NAME,
  FORMAT,
  CLASS 
)    CLASS,

RTL utility routines. Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. This file is compiled twice: once for the generator programs once for the compiler. Indexed by rtx code, gives number of operands for an rtx with that code. Does NOT include rtx header data (code and links).

Indexed by rtx code, gives the name of that kind of rtx, as a C string.

#define DEF_RTL_EXPR (   ENUM,
  NAME,
  FORMAT,
  CLASS 
)
Value:
(((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \
|| (ENUM) == CONST_FIXED) \
? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \
: RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (rtunion)),

RTL utility routines. Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. This file is compiled twice: once for the generator programs once for the compiler. Indexed by rtx code, gives number of operands for an rtx with that code. Does NOT include rtx header data (code and links).

Indexed by rtx code, gives the name of that kind of rtx, as a C string.


Function Documentation

rtx copy_rtx ( )

Create a new copy of an rtx. Recursively copies the operands of the rtx, except for those few rtx codes that are sharable.

     SCRATCH must be shared because they represent distinct values.   
     Share clobbers of hard registers (like cc0), but do not share pseudo reg
     clobbers or clobbers of hard registers that originated as pseudos.
     This is needed to allow safe register renaming.   
     A MEM with a constant address is not sharable.  The problem is that
     the constant address may need to be reloaded.  If the mem is shared,
     then reloading one copy of this mem will cause all copies to appear
     to have been reloaded.   
 Copy the various flags, fields, and other information.  We assume
 that all fields need copying, and then clear the fields that should
 not be copied.  That is the sensible default behavior, and forces
 us to explicitly document why we are *not* copying a flag.   
 We do not copy the USED flag, which is used as a mark bit during
 walks over the RTL.   
       These are left unchanged.   

Referenced by all_zeros_p(), assign_stack_slot_num_and_sort_pseudos(), cond_exec_find_if_block(), expand_float(), find_comparison_args(), find_reloads_toplev(), find_shift_sequence(), insert_restore(), replace_reg_with_saved_mem(), resolve_subreg_use(), save_call_clobbered_regs(), set_initial_elim_offsets(), set_label_offsets(), split_edge_and_insert(), try_back_substitute_reg(), and try_fwprop_subst().

void dump_rtx_statistics ( void  )
hashval_t iterative_hash_rtx ( )

Iteratively hash rtx X.

Referenced by output_index_string_offset().

rtvec rtvec_alloc ( )

Allocate an rtx vector of N elements. Store the length, and initialize all elements to zero.

Clear out the vector.

References rtvec_alloc_counts, and rtvec_alloc_sizes.

Referenced by attr_copy_rtx(), check_defs(), copy_boolean(), insn_invalid_p(), maybe_emit_atomic_exchange(), and write_header().

rtx rtx_alloc_stat ( )

Allocate an rtx of code CODE. The CODE is stored in the rtx; all the rest is initialized to zero.

We want to clear everything up to the FLD array. Normally, this is one int, but we don't want to assume that and it isn't very portable anyway; this is.

int rtx_equal_p ( )

Return 1 if X and Y are identical-looking rtx's. This is the Lisp function EQUAL for rtx arguments. Whenever changing this function check if rtx_equal_p_cb above doesn't need changing as well.

 Rtx's of different codes cannot be equal.   
 (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
 (REG:SI x) and (REG:HI x) are NOT equivalent.   
 MEMs referring to different address space are not equivalent.   
 Some RTL can be compared nonrecursively.   
 Compare the elements.  If any pair of corresponding elements
 fail to match, return 0 for the whole thing.   
         Two vectors must have the same length.   
         And the corresponding elements must match.   
         These are just backpointers, so they don't matter.   
         It is believed that rtx's at this level will never
         contain anything but integers and other rtx's,
         except for within LABEL_REFs and SYMBOL_REFs.   

Referenced by add_AT_string(), add_equal_note(), attr_string(), can_reload_into(), canon_condition(), check_cond_move_block(), compress_float_constant(), copy_replacements_1(), count_reg_usage(), dataflow_set_init(), do_output_reload(), find_call_stack_args(), find_reg_note(), find_variable_location_part(), get_last_value_validate(), invert_exp_1(), kill_clobbered_value(), make_extraction(), maybe_fix_stack_asms(), maybe_propagate_label_ref(), merge_dir(), move2add_valid_value_p(), noce_try_addcc(), prev_nonnote_insn(), prev_nonnote_nondebug_insn(), referenced_in_one_insn_in_loop_p(), simplify_relational_operation_1(), and try_back_substitute_reg().

int rtx_equal_p_cb ( )

Same as rtx_equal_p, but call CB on each pair of rtx if CB is not NULL. When the callback returns true, we continue with the new pair. Whenever changing this function check if rtx_equal_p below doesn't need changing as well.

 Invoke the callback first.   
 Rtx's of different codes cannot be equal.   
 (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
 (REG:SI x) and (REG:HI x) are NOT equivalent.   
 MEMs referring to different address space are not equivalent.   
 Some RTL can be compared nonrecursively.   
 Compare the elements.  If any pair of corresponding elements
 fail to match, return 0 for the whole thing.   
         Two vectors must have the same length.   
         And the corresponding elements must match.   
         These are just backpointers, so they don't matter.   
         It is believed that rtx's at this level will never
         contain anything but integers and other rtx's,
         except for within LABEL_REFs and SYMBOL_REFs.   

References CASE_CONST_UNIQUE, DEBUG_IMPLICIT_PTR_DECL, DEBUG_PARAMETER_REF_DECL, ENTRY_VALUE_EXP, REGNO, XEXP, and XSTR.

unsigned int rtx_size ( )

Return the number of bytes occupied by rtx value X.

rtvec shallow_copy_rtvec ( )

Create a bitwise copy of VEC.

References GET_CODE, RTX_CODE_SIZE, RTX_HDR_SIZE, and SYMBOL_REF_HAS_BLOCK_INFO_P.

rtx shallow_copy_rtx_stat ( )

Create a new copy of an rtx. Only copy just one level.

bool shared_const_p ( )

Return true if ORIG is a sharable CONST.

CONST can be shared if it contains a SYMBOL_REF. If it contains a LABEL_REF, it isn't sharable.

References CASE_CONST_ANY, copy(), GET_CODE, and RTX_CODE.


Variable Documentation

int currently_expanding_to_rtl

Nonzero when we are expanding trees to RTL.

int generating_concat_p

Nonzero when we are generating CONCATs.

Referenced by push_function_context(), and tree_conflicts_with_clobbers_p().

const char* const note_insn_name[NOTE_INSN_MAX]

Names for kinds of NOTEs and REG_NOTEs.

const char* const reg_note_name[REG_NOTE_MAX]

Names for REG_NOTE's in EXPR_LIST insn's.

int rtvec_alloc_counts
static

Referenced by rtvec_alloc().

int rtvec_alloc_sizes
static

Referenced by rtvec_alloc().

int rtx_alloc_counts[(int) LAST_AND_UNUSED_RTX_CODE]
static
int rtx_alloc_sizes[(int) LAST_AND_UNUSED_RTX_CODE]
static

Indexed by rtx code, gives a character representing the "class" of that rtx code. See rtl.def for documentation on the defined classes.

const unsigned char rtx_code_size[NUM_RTX_CODE]

Indexed by rtx code, gives the size of the rtx in bytes.

const char* const rtx_format[NUM_RTX_CODE]

Indexed by rtx code, gives a sequence of operand-types for rtx's of that code. The sequence is a C string in which each character describes one operand.

const unsigned char rtx_length[NUM_RTX_CODE]
const char* const rtx_name[NUM_RTX_CODE]

Referenced by change_cfi_row(), and connect_traces().