GCC Middle and Back End API Reference
statistics.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "function.h"
#include "tree-pass.h"
#include "context.h"
#include "pass_manager.h"
#include "tree.h"
Include dependency graph for statistics.cc:

Data Structures

struct  statistics_counter
 
struct  stats_counter_hasher
 

Typedefs

typedef hash_table< stats_counter_hasherstats_counter_table_type
 

Functions

static stats_counter_table_typecurr_statistics_hash (bool alloc=true)
 
static const charget_function_name (struct function *fn)
 
int statistics_fini_pass_1 (statistics_counter **slot, void *data)
 
int statistics_fini_pass_2 (statistics_counter **slot, void *data)
 
int statistics_fini_pass_3 (statistics_counter **slot, void *data)
 
void statistics_fini_pass (void)
 
int statistics_fini_1 (statistics_counter **slot, opt_pass *pass)
 
void statistics_fini (void)
 
void statistics_early_init (void)
 
void statistics_init (void)
 
static statistics_counterlookup_or_add_counter (stats_counter_table_type *hash, const char *id, int val, bool histogram_p)
 
void statistics_counter_event (struct function *fn, const char *id, int incr)
 
void statistics_histogram_event (struct function *fn, const char *id, int val)
 

Variables

static int statistics_dump_nr
 
static dump_flags_t statistics_dump_flags
 
static FILEstatistics_dump_file
 
static stats_counter_table_type ** statistics_hashes
 
static unsigned nr_statistics_hashes
 

Typedef Documentation

◆ stats_counter_table_type

Function Documentation

◆ curr_statistics_hash()

static stats_counter_table_type * curr_statistics_hash ( bool alloc = true)
static
Return the current hashtable to be used for recording or printing
statistics.   

References current_pass, gcc_assert, ggc_alloc(), nr_statistics_hashes, opt_pass::static_pass_number, and statistics_hashes.

Referenced by statistics_counter_event(), statistics_fini_pass(), and statistics_histogram_event().

◆ get_function_name()

static const char * get_function_name ( struct function * fn)
static
Helper function to return asmname or name of FN
depending on whether asmname option is set.   

References function::decl, decl_assembler_name(), DECL_ASSEMBLER_NAME_SET_P, function_name(), ggc_alloc(), IDENTIFIER_POINTER, statistics_dump_flags, and TDF_ASMNAME.

Referenced by statistics_counter_event(), statistics_fini_pass_2(), and statistics_histogram_event().

◆ lookup_or_add_counter()

static statistics_counter * lookup_or_add_counter ( stats_counter_table_type * hash,
const char * id,
int val,
bool histogram_p )
static
Lookup or add a statistics counter in the hashtable HASH with ID, VAL
and HISTOGRAM_P.   

References hash_table< Descriptor, Lazy, Allocator >::find_slot(), ggc_alloc(), statistics_counter::id, and statistics_counter::val.

Referenced by statistics_counter_event(), and statistics_histogram_event().

◆ statistics_counter_event()

◆ statistics_early_init()

void statistics_early_init ( void )
Register the statistics dump file.   

References DK_tree, g, gcc::context::get_dumps(), ggc_alloc(), OPTGROUP_NONE, and statistics_dump_nr.

Referenced by general_init().

◆ statistics_fini()

◆ statistics_fini_1()

◆ statistics_fini_pass()

◆ statistics_fini_pass_1()

int statistics_fini_pass_1 ( statistics_counter ** slot,
void * data )
Helper for statistics_fini_pass.  Print the counter difference
since the last dump for the pass dump files.   

References count, statistics_counter::count, dump_file, ggc_alloc(), statistics_counter::histogram_p, HOST_WIDE_INT_PRINT_DEC, statistics_counter::id, statistics_counter::prev_dumped_count, and statistics_counter::val.

Referenced by statistics_fini_pass().

◆ statistics_fini_pass_2()

int statistics_fini_pass_2 ( statistics_counter ** slot,
void * data )

◆ statistics_fini_pass_3()

int statistics_fini_pass_3 ( statistics_counter ** slot,
void * data )
Helper for statistics_fini_pass, reset the counters.   

References statistics_counter::count, and statistics_counter::prev_dumped_count.

Referenced by statistics_fini_pass().

◆ statistics_histogram_event()

void statistics_histogram_event ( struct function * fn,
const char * id,
int val )
Add statistics information about event ID in function FN with the
histogram value VAL.
It will dump the event to the global statistics file if requested.   

References statistics_counter::count, curr_statistics_hash(), current_pass, dump_flags, gcc_assert, get_function_name(), ggc_alloc(), statistics_counter::histogram_p, lookup_or_add_counter(), pass_data::name, opt_pass::static_pass_number, statistics_dump_file, statistics_dump_flags, TDF_DETAILS, and TDF_STATS.

Referenced by compute_antic(), do_rpo_vn_1(), and insert().

◆ statistics_init()

void statistics_init ( void )

Variable Documentation

◆ nr_statistics_hashes

unsigned nr_statistics_hashes
static

◆ statistics_dump_file

◆ statistics_dump_flags

◆ statistics_dump_nr

int statistics_dump_nr
static
Optimization statistics functions.
   Copyright (C) 2008-2024 Free Software Foundation, Inc.
   Contributed by Richard Guenther  <rguenther@suse.de>

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/>.   

Referenced by statistics_early_init(), statistics_fini(), and statistics_init().

◆ statistics_hashes

stats_counter_table_type** statistics_hashes
static
Array of statistic hashes, indexed by pass id.   

Referenced by curr_statistics_hash(), and statistics_fini().