GCC Middle and Back End API Reference
autofdo::string_table Class Reference
Collaboration diagram for autofdo::string_table:

Public Member Functions

 string_table ()
 ~string_table ()
int get_index (const char *name) const
int get_index_by_decl (tree decl) const
const char * get_symbol_name (int index) const
const char * get_filename (int index) const
int get_filename_by_symbol (int index) const
int get_filename_by_symbol (const char *name) const
int get_filename_index (const char *name) const
std::pair< const char *, int > get_original_name (const char *name) const
bool read ()
size_t num_entries ()
int add_symbol_name (const char *string, int filename_idx)
int add_filename (const char *name)
cgraph_nodeget_cgraph_node (int)

Static Public Attributes

static const int unknown_filename = -1

Private Types

typedef std::map< const char *, unsigned, string_comparestring_index_map
typedef std::map< const char *, auto_vec< unsigned >, string_compareclashing_name_map
typedef std::map< const char *, char *, string_comparestring_string_map

Private Attributes

string_vector symbol_names_
string_vector filenames_
string_index_map symbol_name_map_
string_index_map filename_map_
string_index_map symbol_to_filename_map_
string_string_map original_names_map_
clashing_name_map clashing_names_map_

Detailed Description

Store a string array, indexed by string position in the array.   

Member Typedef Documentation

◆ clashing_name_map

typedef std::map<const char *, auto_vec<unsigned>, string_compare> autofdo::string_table::clashing_name_map
private

◆ string_index_map

typedef std::map<const char *, unsigned, string_compare> autofdo::string_table::string_index_map
private

◆ string_string_map

typedef std::map<const char *, char *, string_compare> autofdo::string_table::string_string_map
private

Constructor & Destructor Documentation

◆ string_table()

autofdo::string_table::string_table ( )
inline

◆ ~string_table()

autofdo::string_table::~string_table ( )
Member functions for string_table.   
Deconstructor.   

References filenames_, free(), i, original_names_map_, and symbol_names_.

Member Function Documentation

◆ add_filename()

int autofdo::string_table::add_filename ( const char * name)
Add new filename and return its index (returning the same if it already
exists).   

References filename_map_, and filenames_.

◆ add_symbol_name()

int autofdo::string_table::add_symbol_name ( const char * string,
int filename_idx )
Add new symbol name STRING (with an associated file name FILENAME_IDX) and
return its index.   

References filenames_, gcc_checking_assert, symbol_name_map_, symbol_names_, symbol_to_filename_map_, and unknown_filename.

◆ get_cgraph_node()

cgraph_node * autofdo::string_table::get_cgraph_node ( int name_index)
Return cgraph node corresponding to given NAME_INDEX,
NULL if unavailable.   

References dyn_cast(), cgraph_node::get_for_asmname(), get_identifier(), get_symbol_name(), and NULL.

◆ get_filename()

const char * autofdo::string_table::get_filename ( int index) const
For a given index, returns the string.   

References fatal_error(), filenames_, unknown_filename, and UNKNOWN_LOCATION.

Referenced by get_original_name().

◆ get_filename_by_symbol() [1/2]

int autofdo::string_table::get_filename_by_symbol ( const char * name) const
For a given function name, returns the filename index.   

References filenames_, symbol_to_filename_map_, and unknown_filename.

◆ get_filename_by_symbol() [2/2]

int autofdo::string_table::get_filename_by_symbol ( int index) const
For a given symbol name index, returns the filename index.   

References get_filename_by_symbol(), and get_symbol_name().

Referenced by get_filename_by_symbol(), and get_original_name().

◆ get_filename_index()

int autofdo::string_table::get_filename_index ( const char * name) const
For a given filename, returns the index.   

References filename_map_, and unknown_filename.

◆ get_index()

int autofdo::string_table::get_index ( const char * name) const
Return the index of a given function NAME. Return -1 if NAME is not
found in string table.   

References NULL, and symbol_name_map_.

Referenced by get_index_by_decl().

◆ get_index_by_decl()

int autofdo::string_table::get_index_by_decl ( tree decl) const
Return the index of a given function DECL. Return -1 if DECL is not
found in string table.   

References DECL_ABSTRACT_ORIGIN, DECL_FROM_INLINE, get_index(), get_index_by_decl(), and autofdo::raw_symbol_name().

Referenced by get_index_by_decl().

◆ get_original_name()

std::pair< const char *, int > autofdo::string_table::get_original_name ( const char * name) const
Get the original name and file name index for a node.  This will return the
name from the current TU if there are multiple symbols that map to
NAME.   

References clashing_names_map_, DECL_SOURCE_FILE, dyn_cast(), gcc_checking_assert, get_filename(), get_filename_by_symbol(), cgraph_node::get_for_asmname(), get_identifier(), autofdo::get_normalized_path(), is_a(), and original_names_map_.

◆ get_symbol_name()

const char * autofdo::string_table::get_symbol_name ( int index) const
Return the function name of a given INDEX.   

References fatal_error(), symbol_names_, and UNKNOWN_LOCATION.

Referenced by get_cgraph_node(), and get_filename_by_symbol().

◆ num_entries()

size_t autofdo::string_table::num_entries ( )
inline

References symbol_names_.

◆ read()

Field Documentation

◆ clashing_names_map_

clashing_name_map autofdo::string_table::clashing_names_map_
private

Referenced by get_original_name(), and read().

◆ filename_map_

string_index_map autofdo::string_table::filename_map_
private

◆ filenames_

string_vector autofdo::string_table::filenames_
private

◆ original_names_map_

string_string_map autofdo::string_table::original_names_map_
private

◆ symbol_name_map_

string_index_map autofdo::string_table::symbol_name_map_
private

Referenced by add_symbol_name(), get_index(), and read().

◆ symbol_names_

string_vector autofdo::string_table::symbol_names_
private

◆ symbol_to_filename_map_

string_index_map autofdo::string_table::symbol_to_filename_map_
private

◆ unknown_filename


The documentation for this class was generated from the following file: