GCC Middle and Back End API Reference
function.h File Reference
#include "hashtab.h"
#include "vec.h"
#include "machmode.h"
#include "tm.h"
#include "hard-reg-set.h"
#include "input.h"
Include dependency graph for function.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sequence_stack
struct  emit_status
struct  expr_status
struct  rtl_eh
struct  varasm_status
struct  incoming_args
struct  function_subsections
struct  frame_space
struct  rtl_data
struct  stack_usage
struct  function
struct  types_used_by_vars_entry

Macros

#define reg_rtx_no   (crtl->emit.x_reg_rtx_no)
#define seq_stack   (crtl->emit.sequence_stack)
#define REGNO_POINTER_ALIGN(REGNO)   (crtl->emit.regno_pointer_align[REGNO])
#define pending_stack_adjust   (crtl->expr.x_pending_stack_adjust)
#define inhibit_defer_pop   (crtl->expr.x_inhibit_defer_pop)
#define saveregs_value   (crtl->expr.x_saveregs_value)
#define apply_args_value   (crtl->expr.x_apply_args_value)
#define forced_labels   (crtl->expr.x_forced_labels)
#define stack_pointer_delta   (crtl->expr.x_stack_pointer_delta)
#define return_label   (crtl->x_return_label)
#define naked_return_label   (crtl->x_naked_return_label)
#define stack_slot_list   (crtl->x_stack_slot_list)
#define parm_birth_insn   (crtl->x_parm_birth_insn)
#define frame_offset   (crtl->x_frame_offset)
#define stack_check_probe_note   (crtl->x_stack_check_probe_note)
#define arg_pointer_save_area   (crtl->x_arg_pointer_save_area)
#define used_temp_slots   (crtl->x_used_temp_slots)
#define avail_temp_slots   (crtl->x_avail_temp_slots)
#define temp_slot_level   (crtl->x_temp_slot_level)
#define nonlocal_goto_handler_labels   (crtl->x_nonlocal_goto_handler_labels)
#define frame_pointer_needed   (crtl->frame_pointer_needed)
#define stack_realign_fp   (crtl->stack_realign_needed && !crtl->need_drap)
#define stack_realign_drap   (crtl->stack_realign_needed && crtl->need_drap)
#define crtl   (&x_rtl)
#define current_function_static_stack_size   (cfun->su->static_stack_size)
#define current_function_dynamic_stack_size   (cfun->su->dynamic_stack_size)
#define current_function_pushed_stack_size   (cfun->su->pushed_stack_size)
#define current_function_has_unbounded_dynamic_stack_size   (cfun->su->has_unbounded_dynamic_stack_size)
#define current_function_allocates_dynamic_stack_space
#define FOR_EACH_LOCAL_DECL(FUN, I, D)   FOR_EACH_VEC_SAFE_ELT_REVERSE ((FUN)->local_decls, I, D)
#define VA_LIST_MAX_GPR_SIZE   255
#define VA_LIST_MAX_FPR_SIZE   255
#define cfun   (cfun + 0)
#define current_function_funcdef_no   (cfun->funcdef_no)
#define current_loops   (cfun->x_current_loops)
#define dom_computed   (cfun->cfg->x_dom_computed)
#define n_bbs_in_dom_tree   (cfun->cfg->x_n_bbs_in_dom_tree)
#define VALUE_HISTOGRAMS(fun)   (fun)->value_histograms

Typedefs

typedef struct call_site_record_dcall_site_record
typedef struct temp_slottemp_slot_p
typedef struct ipa_opt_pass_dipa_opt_pass

Functions

static void add_local_decl ()
hashval_t types_used_by_vars_do_hash (const void *)
int types_used_by_vars_eq (const void *, const void *)
void types_used_by_var_decl_insert (tree type, tree var_decl)
void set_cfun (struct function *new_cfun)
void push_cfun (struct function *new_cfun)
void pop_cfun (void)
void instantiate_decl_rtl (rtx x)
struct loopsloops_for_fn ()
void set_loops_for_fn ()
void reorder_blocks (void)
void number_blocks (tree)
void clear_block_marks (tree)
tree blocks_nreverse (tree)
tree block_chainon (tree, tree)
HOST_WIDE_INT get_frame_size (void)
bool frame_offset_overflow (HOST_WIDE_INT, tree)
void free_after_parsing (struct function *)
void free_after_compilation (struct function *)
void init_varasm_status (void)
rtx get_arg_pointer_save_area (void)
const char * fndecl_name (tree)
const char * function_name (struct function *)
const char * current_function_name (void)
void do_warn_unused_parameter (tree)
bool pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, tree, bool)
bool reference_callee_copied (CUMULATIVE_ARGS *, enum machine_mode, tree, bool)
void used_types_insert (tree)
int get_next_funcdef_no (void)
int get_last_funcdef_no (void)
rtx get_hard_reg_initial_val (enum machine_mode, unsigned int)
rtx has_hard_reg_initial_val (enum machine_mode, unsigned int)
rtx get_hard_reg_initial_reg (rtx)
bool initial_value_entry (int i, rtx *, rtx *)
unsigned int emit_initial_value_sets (void)
bool optimize_function_for_size_p (struct function *)
bool optimize_function_for_speed_p (struct function *)

Variables

rtxregno_reg_rtx
struct rtl_data x_rtl
struct functioncfun
int virtuals_instantiated
int trampolines_created
htab_t types_used_by_vars_hash
vec< tree, va_gc > * types_used_by_cur_var_decl
struct machine_function *(* init_machine_status )(void)

Macro Definition Documentation

#define apply_args_value   (crtl->expr.x_apply_args_value)
#define arg_pointer_save_area   (crtl->x_arg_pointer_save_area)
#define avail_temp_slots   (crtl->x_avail_temp_slots)

Referenced by assign_stack_temp(), and assign_temp().

#define cfun   (cfun + 0)

In order to ensure that cfun is not set directly, we redefine it so that it is not an lvalue. Rather than assign to cfun, use push_cfun or set_cfun.

Referenced by add_partitioned_vars_to_ptset(), add_stmt_to_eh_lp(), add_ttypes_entry(), adjust_return_value(), ao_ref_from_mem(), calculate_bb_reg_pressure(), cgraph_release_function_body(), choose_inner_scope(), chrec_contains_undetermined(), cleanup_empty_eh_unsplit(), compute_hash_table(), compute_uninit_opnds_pos(), copy_decl_maybe_to_var(), copy_decl_no_change(), copy_ssa_name(), create_function_info_for(), debug_solution_for_var(), discard_pending_stack_adjust(), dump_live_info(), duplicate_computed_gotos(), dwarf2out_frame_debug_cfa_window_save(), ehspec_hasher::equal(), execute_function_todo(), execute_init_datastructures(), expand_omp_sections(), finalize_ssa_defs(), finalize_ssa_uses(), find_case_label_for_value(), find_rtx_in_ldst(), find_switch_asserts(), find_uses_to_rename(), fixup_noreturn_call(), fold_gimple_cond(), get_eh_region_from_lp_number_fn(), get_fi_for_callee(), get_frame_arg(), gimple_call_arg_flags(), gimple_purge_dead_eh_edges(), gimple_redirect_edge_and_branch(), gimplify_omp_workshare(), gsi_split_seq_before(), init_ssa_operands(), initialize_parameter_reductions(), insert_phi_nodes(), instrument_memory_accesses(), is_too_expensive(), load_assign_lhs_subreplacements(), lower_send_clauses(), lto_read_tree(), make_goto_expr_edges(), make_pass_tree_loop_init(), make_pass_vectorize(), make_ssa_name(), mark_ref_stored(), move_allocno_live_ranges(), move_stmt_r(), optimize_bb_for_speed_p(), optimize_function_for_speed_p(), output_eh_regions(), prepare_block_for_update(), process_bb_node_lives(), profile_function(), record_stmt_eh_region(), release_defs(), release_ssa_name(), remove_eh_handler_splicer(), remove_unnecessary_allocnos(), remove_unreachable_eh_regions(), renumber_gimple_stmt_uids(), renumber_gimple_stmt_uids_in_blocks(), replace_ssa_name(), sanitize_hot_paths(), special_builtin_state(), split_live_ranges_for_shrink_wrap(), standard_iv_increment_position(), stmt_overflow_infinity(), stringop_block_profile(), suitable_for_tail_opt_p(), tree_could_trap_p(), tree_loop_vectorize(), update_alias_info_with_stack_vars(), update_complex_components_on_edge(), vectorize_loops(), and visit_hist().

#define current_function_allocates_dynamic_stack_space
#define current_function_dynamic_stack_size   (cfun->su->dynamic_stack_size)
#define current_function_funcdef_no   (cfun->funcdef_no)

For backward compatibility... eventually these should all go away.

Referenced by final_start_function().

#define current_function_has_unbounded_dynamic_stack_size   (cfun->su->has_unbounded_dynamic_stack_size)
#define current_function_pushed_stack_size   (cfun->su->pushed_stack_size)
#define current_function_static_stack_size   (cfun->su->static_stack_size)
#define FOR_EACH_LOCAL_DECL (   FUN,
  I,
 
)    FOR_EACH_VEC_SAFE_ELT_REVERSE ((FUN)->local_decls, I, D)
#define forced_labels   (crtl->expr.x_forced_labels)
#define frame_offset   (crtl->x_frame_offset)
#define frame_pointer_needed   (crtl->frame_pointer_needed)
#define inhibit_defer_pop   (crtl->expr.x_inhibit_defer_pop)
#define n_bbs_in_dom_tree   (cfun->cfg->x_n_bbs_in_dom_tree)
#define naked_return_label   (crtl->x_naked_return_label)
#define nonlocal_goto_handler_labels   (crtl->x_nonlocal_goto_handler_labels)

Referenced by get_eh_region_from_rtx().

#define parm_birth_insn   (crtl->x_parm_birth_insn)
#define pending_stack_adjust   (crtl->expr.x_pending_stack_adjust)
#define reg_rtx_no   (crtl->emit.x_reg_rtx_no)

For backward compatibility... eventually these should all go away.

#define REGNO_POINTER_ALIGN (   REGNO)    (crtl->emit.regno_pointer_align[REGNO])
#define return_label   (crtl->x_return_label)
#define saveregs_value   (crtl->expr.x_saveregs_value)
#define seq_stack   (crtl->emit.sequence_stack)

Referenced by emit_label().

#define stack_check_probe_note   (crtl->x_stack_check_probe_note)
#define stack_pointer_delta   (crtl->expr.x_stack_pointer_delta)
#define stack_realign_drap   (crtl->stack_realign_needed && crtl->need_drap)
#define stack_realign_fp   (crtl->stack_realign_needed && !crtl->need_drap)
#define stack_slot_list   (crtl->x_stack_slot_list)
#define temp_slot_level   (crtl->x_temp_slot_level)
#define used_temp_slots   (crtl->x_used_temp_slots)
#define VA_LIST_MAX_FPR_SIZE   255
#define VA_LIST_MAX_GPR_SIZE   255

If va_list_[gf]pr_size is set to this, it means we don't know how many units need to be saved.

#define VALUE_HISTOGRAMS (   fun)    (fun)->value_histograms

Referenced by histogram_eq().


Typedef Documentation

typedef struct ipa_opt_pass_d* ipa_opt_pass
typedef struct temp_slot* temp_slot_p

Function Documentation

static void add_local_decl ( )
inlinestatic

Add the decl D to the local_decls list of FUN.

tree block_chainon ( tree  ,
tree   
)
tree blocks_nreverse ( tree  )
void clear_block_marks ( tree  )
const char* current_function_name ( void  )

Returns the name of the current function.

Referenced by find_taken_edge_computed_goto(), and pre_insert_copies().

void do_warn_unused_parameter ( tree  )
unsigned int emit_initial_value_sets ( void  )

Called from gimple_expand_cfg.

References arg_pointer_rtx, cfa_offset, and frame_pointer_rtx.

const char* fndecl_name ( tree  )

Returns the name of the current function.

bool frame_offset_overflow ( HOST_WIDE_INT  ,
tree   
)

Issue an error message and return TRUE if frame OFFSET overflows in the signed target pointer arithmetics for function FUNC. Otherwise return FALSE.

void free_after_compilation ( struct function )
void free_after_parsing ( struct function )

Save and restore status information for a nested function.

const char* function_name ( struct function )
rtx get_arg_pointer_save_area ( void  )

Save the arg pointer at the beginning of the function. The generated stack slot may not be a valid memory address, so we have to check it and fix it if necessary.

HOST_WIDE_INT get_frame_size ( void  )

Return size needed for stack frame based on slots so far allocated. This size counts from zero. It is not rounded to STACK_BOUNDARY; the caller may have to do that.

Return size needed for stack frame based on slots so far allocated. This size counts from zero. It is not rounded to PREFERRED_STACK_BOUNDARY; the caller may have to do that.

References DECL_SOURCE_LOCATION, error_at(), and TRUE.

rtx get_hard_reg_initial_reg ( rtx  )
rtx get_hard_reg_initial_val ( enum  machine_mode,
unsigned  int 
)
int get_last_funcdef_no ( void  )

Return value of funcdef.

int get_next_funcdef_no ( void  )

Return value of funcdef and increase it.

References hard_function_value().

rtx has_hard_reg_initial_val ( enum  machine_mode,
unsigned  int 
)
void init_varasm_status ( void  )

Initialize constant pool hashing for a new function.

References CONSTANT_POOL_ADDRESS_P, GET_CODE, and NULL_RTX.

Referenced by blocks_nreverse().

bool initial_value_entry ( int  i,
rtx ,
rtx  
)
void instantiate_decl_rtl ( rtx  x)
struct loops* loops_for_fn ( )
read

Return the loop tree of FN.

Referenced by move_stmt_eh_region_tree_nr().

void number_blocks ( tree  )

Set BLOCK_NUMBER for all the blocks in FN.

bool optimize_function_for_size_p ( struct function )
bool optimize_function_for_speed_p ( struct function )

Referenced by find_rtx_in_ldst().

bool pass_by_reference ( CUMULATIVE_ARGS *  ca,
enum machine_mode  mode,
tree  type,
bool  named_arg 
)

Return true if TYPE should be passed by invisible reference.

     If this type contains non-trivial constructors, then it is
     forbidden for the middle-end to create any new copies.   
     GCC post 3.4 passes *all* variable sized types by reference.   
     If a record type should be passed the same as its first (and only)
     member, use the type and mode of that member.   

Referenced by initialize_argument_information().

void pop_cfun ( void  )

Pop cfun from the stack. Also set current_function_decl accordingly.

When in_dummy_function, we do have a cfun but current_function_decl is NULL. We also allow pushing NULL cfun and subsequently changing current_function_decl to something else and have both restored by pop_cfun.

Referenced by cgraph_process_new_functions(), and gcc::pass_manager::pass_manager().

void push_cfun ( struct function new_cfun)
bool reference_callee_copied ( CUMULATIVE_ARGS *  ca,
enum machine_mode  mode,
tree  type,
bool  named_arg 
)

Return true if TYPE, which is passed by reference, should be callee copied instead of caller copied.

References targetm.

Referenced by assign_parms(), and initialize_argument_information().

void reorder_blocks ( void  )

Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END}, and create duplicate blocks.

Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END}, and create duplicate blocks. ??? Need an option to either create block fragments or to create abstract origin duplicates of a source block. It really depends on what optimization has been performed.

 Reset the TREE_ASM_WRITTEN bit for all blocks.   
 Prune the old trees away, so that they don't get in the way.   
 Recreate the block tree from the note nesting.   
void set_cfun ( struct function new_cfun)

cfun shouldn't be set directly; use one of these functions instead.

void set_loops_for_fn ( )
inline

Set the loop tree of FN to LOOPS.

void types_used_by_var_decl_insert ( tree  type,
tree  var_decl 
)
hashval_t types_used_by_vars_do_hash ( const void *  )
int types_used_by_vars_eq ( const void *  ,
const void *   
)
void used_types_insert ( tree  )

Variable Documentation

struct function* cfun

The function currently being compiled.

The currently compiled function.

struct machine_function*(* init_machine_status)(void)

A pointer to a function to create target specific, per-function data structures.

These variables hold pointers to functions to create and destroy target specific, per-function data structures.

rtx* regno_reg_rtx

Indexed by register number, gives an rtx for that register (and only that register). For pseudo registers, it is the unique rtx for that pseudo. For hard registers, it is an rtx of the mode specified by reg_raw_mode.

FIXME: We could put it into emit_status struct, but gengtype is not able to deal with length attribute nested in top level structures.

Indexed by pseudo register number, gives the rtx for that pseudo. Allocated in parallel with regno_pointer_align. FIXME: We could put it into emit_status struct, but gengtype is not able to deal with length attribute nested in top level structures.

Referenced by assign_parm_setup_reg(), df_remove_dead_eq_notes(), find_costs_and_classes(), record_value_for_reg(), save_call_clobbered_regs(), and use_crosses_set_p().

int trampolines_created

Nonzero if at least one trampoline has been created.

This is a generic routine suitable for use as TARGET_ASM_FILE_END which emits a special section directive used to indicate whether or not this object file needs an executable stack. This is primarily a GNU extension to ELF but could be used on other targets.

vec<tree, va_gc>* types_used_by_cur_var_decl

During parsing of a global variable, this vector contains the types referenced by the global variable.

htab_t types_used_by_vars_hash

Hash table making the relationship between a global variable and the types it references in its initializer. The key of the entry is a referenced type, and the value is the DECL of the global variable. types_use_by_vars_do_hash and types_used_by_vars_eq below are the hash and equality functions to use for this hash table.

int virtuals_instantiated

Nonzero if we've already converted virtual regs to hard regs.

Nonzero once virtual register instantiation has been done. assign_stack_local uses frame_pointer_rtx when this is nonzero. calls.c:emit_library_call_value_1 uses it to set up post-instantiation libcalls.

Referenced by emit_library_call_value_1(), and push_function_context().

struct rtl_data x_rtl

Datastructures maintained for currently processed function in RTL form.