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

Data Structures

struct  alt_unit

Public Types

enum  alt_cat {
  ALT_GIMPLE_EXPRS , ALT_FNS , ALT_GENERIC_EXPRS , ALT_GENERIC_FNS ,
  ALT_COUNT
}

Public Member Functions

 fn_splitter (vec< FILE * > &files_, FILE *f_, const char *fname_, bool gimple_, unsigned nops_, unsigned budget_)
void emit_alternatives (dt_node *, int, int, const vec< dt_operand * > &, const vec< dt_operand * > &, const vec< dt_operand * > &, const vec< dt_operand * > &, const vec< dt_operand * > &, const vec< dt_node * > &)
bool emit_dispatch (FILE *, int, alt_cat, unsigned)
bool split_out_p (alt_cat cat, unsigned index) const
bool same_chunk_p (alt_cat cat, unsigned a, unsigned b) const

Private Member Functions

bool full (unsigned have, unsigned more) const
void print_params (FILE *)
void print_args (FILE *)
FILE * open_chunk (unsigned)
void close_chunk (FILE *)
FILE * choose_chunk_file ()

Private Attributes

FILE * f
vec< FILE * > & files
const char * fname
bool gimple
unsigned nops
unsigned budget
unsigned nchunks
bool dispatching
auto_vec< unsigned > owner [ALT_COUNT]

Detailed Description

Split a generated matcher across functions.  The entry function keeps the
dispatch that selects between the top-level alternatives, and calls the
function that holds the selected group in place of the group's body.   

Member Enumeration Documentation

◆ alt_cat

Enumerator
ALT_GIMPLE_EXPRS 
ALT_FNS 
ALT_GENERIC_EXPRS 
ALT_GENERIC_FNS 
ALT_COUNT 

Constructor & Destructor Documentation

◆ fn_splitter()

fn_splitter::fn_splitter ( vec< FILE * > & files_,
FILE * f_,
const char * fname_,
bool gimple_,
unsigned nops_,
unsigned budget_ )
inline

Member Function Documentation

◆ choose_chunk_file()

FILE * fn_splitter::choose_chunk_file ( )
private
Return the shortest output file that is not the one the entry function is
being written to, which must not receive another function while it is
open.   

References f, files, gcc_assert, and NULL.

Referenced by open_chunk().

◆ close_chunk()

void fn_splitter::close_chunk ( FILE * cf)
private
Close the function being written to CF.   

References gimple.

Referenced by emit_alternatives().

◆ emit_alternatives()

void fn_splitter::emit_alternatives ( dt_node * node,
int indent,
int depth,
const vec< dt_operand * > & gimple_exprs,
const vec< dt_operand * > & generic_exprs,
const vec< dt_operand * > & fns,
const vec< dt_operand * > & generic_fns,
const vec< dt_operand * > & preds,
const vec< dt_node * > & others )
Emit the alternatives of NODE at INDENT and DEPTH.  GIMPLE_EXPRS,
GENERIC_EXPRS, FNS, GENERIC_FNS, PREDS and OTHERS are the vectors that
gen_kids_1 accepts.  Unless the whole run is small, the groups of the first
four move to new functions, packed in order up to the budget.  The entry
function keeps the dispatch, PREDS and OTHERS.  Groups reached from one
dispatch have disjoint cases, so selecting one is what trying them in turn
does.   

References ALT_COUNT, ALT_FNS, ALT_GENERIC_EXPRS, ALT_GENERIC_FNS, ALT_GIMPLE_EXPRS, budget, close_chunk(), collect_alt_units(), collect_operand_groups(), dispatching, f, full(), gimple, i, MATCHER_FN_MIN_RUN_FRACTION, nchunks, open_chunk(), and owner.

Referenced by dt_node::gen_kids().

◆ emit_dispatch()

bool fn_splitter::emit_dispatch ( FILE * to,
int indent,
alt_cat cat,
unsigned index )
Called by gen_kids_1 in place of emitting the body of group INDEX of
category CAT to TO at INDENT.  If another function holds the group, emit a
call to it and return true.  Otherwise return false, and gen_kids_1 emits
the body.   

References fname, fprintf_indent(), gimple, owner, print_args(), and split_out_p().

Referenced by dt_node::gen_kids_1().

◆ full()

bool fn_splitter::full ( unsigned have,
unsigned more ) const
inlineprivate

References budget.

Referenced by emit_alternatives().

◆ open_chunk()

FILE * fn_splitter::open_chunk ( unsigned n)
private
Open the function holding chunk N and return its output file.   

References choose_chunk_file(), fname, fp_decl(), fp_decl_done(), fprintf_indent(), gcc_assert, gimple, header_file, and print_params().

Referenced by emit_alternatives().

◆ print_args()

void fn_splitter::print_args ( FILE * to)
private
Print to TO the arguments that forward the current matcher state to a new
function.   

References gimple, i, and nops.

Referenced by emit_dispatch().

◆ print_params()

void fn_splitter::print_params ( FILE * to)
private
Print the parameter list of a new function to TO.  Also print its
declaration to the generated header.   

References fp_decl(), gimple, i, and nops.

Referenced by open_chunk().

◆ same_chunk_p()

bool fn_splitter::same_chunk_p ( alt_cat cat,
unsigned a,
unsigned b ) const
inline

References a, b, owner, and split_out_p().

Referenced by dt_node::gen_kids_1().

◆ split_out_p()

bool fn_splitter::split_out_p ( alt_cat cat,
unsigned index ) const
inline

References dispatching, and owner.

Referenced by emit_dispatch(), dt_node::gen_kids_1(), and same_chunk_p().

Field Documentation

◆ budget

unsigned fn_splitter::budget
private

◆ dispatching

bool fn_splitter::dispatching
private

◆ f

FILE* fn_splitter::f
private

◆ files

vec<FILE *>& fn_splitter::files
private

Referenced by choose_chunk_file(), and fn_splitter().

◆ fname

const char* fn_splitter::fname
private

◆ gimple

◆ nchunks

unsigned fn_splitter::nchunks
private

Referenced by emit_alternatives(), and fn_splitter().

◆ nops

unsigned fn_splitter::nops
private

◆ owner

auto_vec<unsigned> fn_splitter::owner[ALT_COUNT]
private

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