GCC Middle and Back End API Reference
|
Data Structures | |
struct | cfg_stats_d |
struct | locus_discrim_map |
struct | locus_discrim_hasher |
struct | label_record |
struct | move_stmt_d |
Variables | |
static const int | initial_cfg_capacity = 20 |
static struct pointer_map_t * | edge_to_cases |
static bitmap | touched_switch_bbs |
static struct cfg_stats_d | cfg_stats |
static bool | found_computed_goto |
static hash_table < locus_discrim_hasher > | discriminator_per_locus |
static struct label_record * | label_for_bb |
static bool | eh_error_found |
struct cfg_hooks | gimple_cfg_hooks |
void add_phi_args_after_copy | ( | basic_block * | region_copy, |
unsigned | n_region, | ||
edge | e_copy | ||
) |
Blocks in REGION_COPY array of length N_REGION were created by duplication of basic blocks. Add phi node arguments for edges going from these blocks. If E_COPY is not NULL, also add phi node arguments for its destination.
Referenced by tm_memopt_clear_visited().
void add_phi_args_after_copy_bb | ( | ) |
Basic block BB_COPY was created by code duplication. Add phi node arguments for edges going out of BB_COPY. The blocks that were duplicated have BB_DUPLICATED set.
|
static |
Adds phi node arguments for edge E_COPY after basic block duplication.
During loop unrolling the target of the latch edge is copied. In this case we are not looking for edge to dest, but to duplicated block whose original was dest.
|
static |
Assign discriminators to each basic block.
References loop::next.
|
static |
Checks if BB is part of the region defined by N_REGION BBS.
|
static |
Entry point to the CFG builder for trees. SEQ is the sequence of statements to be added to the flowgraph.
Register specific gimple functions.
Computed gotos are hell to deal with, especially if there are lots of them with a large number of destinations. So we factor them to a common computed goto location before we build the edge list. After we convert back to normal form, we will un-factor the computed gotos since factoring introduces an unwanted jump.
Make sure there is always at least one block, even if it's empty.
Adjust the size of the array.
To speed up statement iterator walks, we first purge dead labels.
Group case nodes to reduce the number of edges. We do this after cleaning up dead labels because otherwise we miss a lot of obvious case merging opportunities.
Create the edges of the flowgraph.
|
static |
Return true if T, a GIMPLE_CALL, can make an abnormal transfer of control flow. Transfers of control flow associated with EH are excluded.
If the function has no non-local labels, then a call cannot make an abnormal transfer of control.
Likewise if the call has no side effects.
Likewise if the called function is leaf.
void cleanup_dead_labels | ( | void | ) |
Cleanup redundant labels. This is a three-step process: 1) Find the leading label for each block. 2) Redirect all references to labels to the leading labels. 3) Cleanup all useless labels.
Find a suitable label for each block. We use the first user-defined label if there is one, or otherwise just the first label we see.
If we have not yet seen a label for the current block, remember this one and see if there are more labels.
If we did see a label for the current block already, but it is an artificially created label, replace it if the current label is a user defined label.
Now redirect all jumps/branches to the selected label. First do so for each block ending in a control statement.
Replace all destination labels.
We have to handle gotos until they're removed, and we don't remove them until after we've created the CFG edges.
Do the same for the exception region tree labels.
Finally, purge dead labels. All user-defined labels and labels that can be the target of non-local gotos and labels which have their address taken are preserved.
If the main label of the block is unused, we may still remove it.
References gimple_asm_label_op(), and main_block_label().
|
static |
Clean up redundant labels within the exception tree.
void clear_special_calls | ( | void | ) |
Clear flags set by notice_special_calls. Used by dead code removal to update the flags.
|
static |
Insert all subblocks of BLOCK into BLOCKS and recurse.
|
static |
Return true if T is a computed goto.
|
static |
Create and return a new empty basic block after bb AFTER.
Create and initialize a new basic block. Since alloc_block uses GC allocation that clears memory to allocate a basic block, we do not have to clear the newly allocated basic block here.
Add the new block to the linked list of blocks.
Grow the basic block array if needed.
Add the newly created block to the array.
References fold_binary_loc(), fold_defer_overflow_warnings(), fold_undefer_overflow_warnings(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_make_false(), gimple_cond_make_true(), gimple_cond_rhs(), gimple_location(), integer_onep(), integer_zerop(), last_stmt(), and WARN_STRICT_OVERFLOW_CONDITIONAL.
DEBUG_FUNCTION void debug | ( | ) |
Dump a loop.
DEBUG_FUNCTION void debug_cfg_stats | ( | void | ) |
Dump CFG statistics on stderr. Keep extern so that it's always linked in the final executable.
References cfg_stats, gimple_label_label(), and cfg_stats_d::num_merged_labels.
DEBUG_FUNCTION void debug_function | ( | ) |
Dump FUNCTION_DECL FN to stderr using FLAGS (see TDF_* in tree.h)
DEBUG_FUNCTION void debug_loop | ( | ) |
Print on stderr the code of LOOP, at some VERBOSITY level.
DEBUG_FUNCTION void debug_loop_num | ( | ) |
Print on stderr the code of loop number NUM, at some VERBOSITY level.
DEBUG_FUNCTION void debug_loops | ( | ) |
Debugging loops structure at tree level, at some VERBOSITY level.
References edge_def::flags.
DEBUG_FUNCTION void debug_verbose | ( | ) |
Dump a loop verbosely.
void delete_tree_cfg_annotations | ( | void | ) |
Remove block annotations and other data structures.
|
static |
Walk a gimplified function and warn for functions whose return value is ignored and attribute((warn_unused_result)) is set. This is done before inlining, so we don't have to worry about that.
This is a naked call, as opposed to a GIMPLE_CALL with an LHS. All calls whose value is ignored should be represented like this. Look for the attribute.
Not a container, not a call, or a call whose value is used.
Referenced by gimple_purge_all_dead_abnormal_call_edges().
void dump_cfg_stats | ( | ) |
Dump CFG statistics on FILE.
Referenced by find_taken_edge_switch_expr().
void dump_function_to_file | ( | ) |
Dump FUNCTION_DECL FN to file FILE using FLAGS (see TDF_* in dumpfile.h)
When GIMPLE is lowered, the variables are no longer available in BIND_EXPRs, so display them separately.
If the CFG has been built, emit a CFG-based dump.
The function is now in GIMPLE form but the CFG has not been built yet. Emit the single sequence of GIMPLE statements that make up its body.
Make a tree based dump.
References BUILT_IN_NORMAL, edge_def::flags, gimple_asm_input_p(), gimple_asm_volatile_p(), gimple_bb(), gimple_call_flags(), gimple_call_fndecl(), is_gimple_call(), and basic_block_def::succs.
Referenced by dump_maybe_newline().
|
static |
Called for each element in the hash table (P) as we delete the edge to cases hash table. Clear all the TREE_CHAINs to prevent problems with copying of SWITCH_EXPRs and structure sharing rules, then free the hash table element.
void end_recording_case_labels | ( | void | ) |
Stop recording information mapping edges to case labels and remove any information we have recorded.
|
static |
References execute().
unsigned int execute_fixup_cfg | ( | void | ) |
IPA passes, compilation of earlier functions or inlining might have changed some properties, such as marked functions nothrow, pure, const or noreturn. Remove redundant edges and basic blocks, and create new ones if necessary. This pass can't be executed as stand alone pass from pass manager, because in between inlining and this fixup the verify_flow_info would fail.
If we have a basic block with no successors that does not end with a control statement or a noreturn call end it with a call to __builtin_unreachable. This situation can occur when inlining a noreturn call that does in fact return.
We just processed all calls.
Dump a textual representation of the flowgraph.
|
static |
Emit return warnings.
If we have a path to EXIT, then we do return.
If we see "return;" in some basic block, then we do reach the end without returning a value.
void extract_true_false_edges_from_block | ( | basic_block | b, |
edge * | true_edge, | ||
edge * | false_edge | ||
) |
Given a basic block B which ends with a conditional and has precisely two successors, determine which of the edges is taken if the conditional is true and which is taken if the conditional is false. Set TRUE_EDGE and FALSE_EDGE appropriately.
Referenced by associate_equivalences_with_edges(), check_forbidden_calls(), operand_equal_for_value_replacement(), and simple_mem_ref_in_stmt().
|
static |
Search the CFG for any computed gotos. If found, factor them to a common computed goto site. Also record the location of that site so that we can un-factor the gotos after we have converted back to normal form.
We know there are one or more computed gotos in this function. Examine the last statement in each basic block to see if the block ends with a computed goto.
Ignore the computed goto we create when we factor the original computed gotos.
If the last statement is a computed goto, factor it.
The first time we find a computed goto we need to create the factored goto block and the variable each original computed goto will use for their goto destination.
Create the destination of the factored goto. Each original computed goto will put its desired destination into this variable and jump to the label we create immediately below.
Build a label for the new block which will contain the factored computed goto.
Build our new computed goto.
Copy the original computed goto's destination into VAR.
And re-vector the computed goto to the new destination.
References create_artificial_label(), create_empty_bb(), create_tmp_var(), gimple_build_goto(), gimple_build_label(), gsi_insert_after(), GSI_NEW_STMT, and gsi_start_bb().
|
static |
Return the CASE_LABEL_EXPR that SWITCH_STMT will take for VAL. We can make optimal use here of the fact that the case labels are sorted: We can do a binary search for a case matching VAL.
Cache the result of comparing CASE_LOW and val.
A singe-valued case label.
A case range. We can only handle integer ranges.
References function::calls_setjmp, cfun, gimple_call_flags(), gimple_has_side_effects(), and function::has_nonlocal_label.
|
static |
Examine the statements in BB (which is in SRC_CFUN); find and return the outermost EH region. Use REGION as the incoming base EH region.
edge find_taken_edge | ( | ) |
Given a basic block BB ending with COND_EXPR or SWITCH_EXPR, and a predicate VAL, return the edge that will be taken out of the block. If VAL does not match a unique edge, NULL is returned.
Only optimize if the argument is a label, if the argument is not a label then we can not construct a proper CFG. It may be the case that we only need to allow the LABEL_REF to appear inside an ADDR_EXPR, but we also allow the LABEL_REF to appear inside a LABEL_EXPR just to be safe.
References gimple_debug_bb().
Referenced by optimize_stmt().
|
static |
|
static |
Given a constant value VAL and the entry block BB to a GOTO_EXPR statement, determine which of the outgoing edges will be taken out of the block. Return NULL if either edge may be taken.
References current_function_name().
|
static |
|
static |
Given a constant value VAL and the entry block BB to a COND_EXPR statement, determine which of the two edges will be taken out of the block. Return NULL if either edge may be taken.
|
static |
|
static |
Given an INTEGER_CST VAL and the entry block BB to a SWITCH_EXPR statement, determine which edge will be taken out of the block. Return NULL if any edge may be taken.
References dump_cfg_stats().
|
static |
Referenced by next_discriminator_for_locus().
|
static |
Return the first non-label statement in basic block BB.
gimple first_stmt | ( | ) |
Return the first statement in basic block BB.
References error().
Referenced by phi_alternatives_equal(), vect_get_store_cost(), and vect_model_promotion_demotion_cost().
|
static |
Fixup the loop arrays and numbers after moving LOOP and its subloops from FN1 to FN2.
Discard it from the old loop array.
Place it in the new loop array, assigning it a new number.
Recurse to children.
Referenced by move_stmt_eh_region_tree_nr().
void fold_cond_expr_cond | ( | void | ) |
Fold COND_EXPR_COND of each COND_EXPR.
|
static |
void gather_blocks_in_sese_region | ( | basic_block | entry, |
basic_block | exit, | ||
vec< basic_block > * | bbs_p | ||
) |
Add all the blocks dominated by ENTRY to the array BBS_P. Stop adding blocks when the dominator traversal reaches EXIT. This function silently assumes that ENTRY strictly dominates EXIT.
Referenced by create_loads_and_stores_for_name(), and move_stmt_r().
|
static |
If we are inside a {start,end}_recording_cases block, then return a chain of CASE_LABEL_EXPRs from T which reference E. Otherwise return NULL.
If we are not recording cases, then we do not have CASE_LABEL_EXPR chains available. Return NULL so the caller can detect this case.
If we did not find E in the hash table, then this must be the first time we have been queried for information about E & T. Add all the elements from T to the hash table then perform the query again.
Add it to the chain of CASE_LABEL_EXPRs referencing E, or create a new chain.
|
static |
Do book-keeping of basic block BB for the profile consistency checker. If AFTER_PASS is 0, do pre-pass accounting, or if AFTER_PASS is 1 then do post-pass accounting. Store the counting in RECORD.
|
static |
Return true if BB ends with a call, possibly followed by some instructions that must stay with the call. Return false, otherwise.
References gimple_purge_dead_abnormal_call_edges().
|
static |
Return true if BB ends with a conditional branch. Return false, otherwise.
tree gimple_block_label | ( | ) |
Return a non-special label in the head of basic block BLOCK. Create one if it doesn't exist.
Referenced by lower_eh_constructs().
|
static |
Return true if basic_block can be duplicated.
|
static |
|
static |
Checks whether we can merge block B into block A.
If A ends by a statement causing exceptions or something similar, we cannot merge the blocks.
Do not allow a block with only a non-local label to be merged.
Examine the labels at the beginning of B.
Do not remove user forced labels or for -O0 any user labels.
Protect the loop latches.
It must be possible to eliminate all phi nodes in B. If ssa form is not up-to-date and a name-mapping is registered, we cannot eliminate any phis. Symbols marked for renaming are never a problem though.
Technically only new names matter.
When not optimizing, don't merge if we'd lose goto_locus.
|
static |
Returns true if it is possible to remove edge E by redirecting it to the destination of the other edge from E->src.
void gimple_debug_bb | ( | ) |
Dump a basic block on stderr.
Referenced by find_taken_edge().
basic_block gimple_debug_bb_n | ( | ) |
Dump basic block with index N on stderr.
void gimple_debug_cfg | ( | ) |
Dump the CFG on stderr. FLAGS are the same used by the tree dumping functions (see TDF_* in dumpfile.h).
void gimple_dump_cfg | ( | ) |
Dump the program showing basic block boundaries on the given FILE. FLAGS are the same used by the tree dumping functions (see TDF_* in tree.h).
|
static |
Create a duplicate of the basic block BB. NOTE: This does not preserve SSA form.
Copy the PHI nodes. We ignore PHI node arguments here because the incoming edges have not been setup yet.
Don't duplicate label debug stmts.
Create a new copy of STMT and duplicate STMT's virtual operands.
When copying around a stmt writing into a local non-user aggregate, make sure it won't share stack slot with other vars.
Create new names for all the definitions created by COPY and add replacement mappings for each new name.
bool gimple_duplicate_sese_region | ( | edge | entry, |
edge | exit, | ||
basic_block * | region, | ||
unsigned | n_region, | ||
basic_block * | region_copy, | ||
bool | update_dominance | ||
) |
Duplicates a REGION (set of N_REGION basic blocks) with just a single important exit edge EXIT. By important we mean that no SSA name defined inside region is live over the other exit edges of the region. All entry edges to the region must go to ENTRY->dest. The edge ENTRY is redirected to the duplicate of the region. Dominance and loop information is updated if UPDATE_DOMINANCE is true, but not the SSA web. If UPDATE_DOMINANCE is false then we assume that the caller will update the dominance information after calling this function. The new basic blocks are stored to REGION_COPY in the same order as they had in REGION, provided that REGION_COPY is not NULL. The function returns false if it is unable to copy the region, true otherwise.
Some sanity checking. Note that we do not check for all possible missuses of the functions. I.e. if you ask to copy something weird, it will work, but the state of structures probably will not be correct.
We do not handle subloops, i.e. all the blocks must belong to the same loop.
In case the function is used for loop header copying (which is the primary use), ensure that EXIT and its copy will be new latch and entry edges.
Record blocks outside the region that are dominated by something inside.
Fix up corner cases, to avoid division by zero or creation of negative frequencies.
Fix up corner cases, to avoid division by zero or creation of negative frequencies.
Redirect the entry and add the phi node arguments.
Concerning updating of dominators: We must recount dominators for entry block and its copy. Anything that is outside of the region, but was dominated by something inside needs recounting as well.
Add the other PHI node arguments.
bool gimple_duplicate_sese_tail | ( | edge | entry, |
edge | exit, | ||
basic_block * | region, | ||
unsigned | n_region, | ||
basic_block * | region_copy | ||
) |
@verbatim
Duplicates REGION consisting of N_REGION blocks. The new blocks are stored to REGION_COPY in the same order in that they appear in REGION, if REGION_COPY is not NULL. ENTRY is the entry to the region, EXIT an exit from it. The condition guarding EXIT is moved to ENTRY. Returns true if duplication succeeds, false otherwise.
For example,
some_code; if (cond) A; else B;
is transformed to
if (cond) { some_code; A; } else { some_code; B; }
Record blocks outside the region that are dominated by something inside.
Fix up corner cases, to avoid division by zero or creation of negative frequencies.
Fix up corner cases, to avoid division by zero or creation of negative frequencies.
Create the switch block, and put the exit condition to it.
Register the new edge from SWITCH_BB in loop exit lists.
Add the PHI node arguments.
Get rid of now superfluous conditions and associated edges (and phi node arguments).
The latch of ORIG_LOOP was copied, and so was the backedge to the original header. We redirect this backedge to EXIT_BB.
Anything that is outside of the region, but was dominated by something inside needs to update dominance info.
Update the SSA web.
Referenced by create_loop_fn().
|
static |
Return TRUE if block BB has no executable statements, otherwise return FALSE.
BB must have no executable statements.
|
static |
This function is called whenever a new edge is created or redirected.
|
static |
This function is called immediately before edge E is removed from the edge vector E->dest->preds.
References gimple_location(), and warning_at().
|
static |
Add fake edges to the function exit for any non constant and non noreturn calls (or noreturn calls with EH/abnormal edges), volatile inline assembly in the bitmap of blocks specified by BLOCKS or to the whole CFG if BLOCKS is zero. Return the number of blocks that were split. The goal is to expose cases in which entering a basic block does not imply that all subsequent instructions must be executed.
In the last basic block, before epilogue generation, there will be a fallthru edge to EXIT. Special care is required if the last insn of the last basic block is a call because make_edge folds duplicate edges, which would result in the fallthru edge also being marked fake, which would result in the fallthru edge being removed by remove_fake_edges, which would result in an invalid CFG. Moreover, we can't elide the outgoing fake edge, since the block profiler needs to take this into account in order to solve the minimal spanning tree in the case that the call doesn't return. Handle this by adding a dummy instruction in a new last basic block.
Now add fake edges to the function exit for any non constant calls since there is no way that we can determine if they will return or not...
The handling above of the final block before the epilogue should be enough to verify that there is no edge to the exit block in CFG already. Calling make_edge in such case would cause us to mark that edge as fake and remove it later.
Note that the following may create a new basic block and renumber the existing basic blocks.
|
static |
Adds a if else statement to COND_BB with condition COND_EXPR. SECOND_HEAD is the destination of the THEN and FIRST_HEAD is the destination of the ELSE part.
Build new conditional expr
Add new cond in cond_bb.
Adjust edges appropriately to connect new head with first head as well as second head.
|
static |
Adjust phi nodes for 'first' basic block. 'second' basic block is a copy of 'first'. Both of them are dominated by 'new_head' basic block. When 'new_head' was created by 'second's incoming edge it received phi arguments on the edge by split_edge(). Later, additional edge 'e' was created to connect 'new_head' and 'first'. Now this routine adds phi args on this additional edge 'e' that new_head to second edge received as part of edge splitting.
Because NEW_HEAD has been created by splitting SECOND's incoming edge, we should always have an edge from NEW_HEAD to SECOND.
Browse all 'second' basic block phi nodes and add phi args to edge 'e' for 'first' head. PHI args are always in correct order.
|
static |
|
static |
Updates phi nodes after creating a forwarder block joined by edge FALLTHRU.
If we redirected a branch we must create new PHI nodes at the start of BB.
Add the arguments we have stored on edges.
References create_empty_bb(), walk_stmt_info::gsi, gsi_end_p(), gsi_next(), gsi_split_seq_before(), gsi_start_bb(), gsi_stmt(), edge_def::src, and basic_block_def::succs.
|
static |
Flowgraph optimization and cleanup.
|
static |
Merge block B into block A.
Remove all single-valued PHI nodes from block B of the form V_i = PHI <V_j> by propagating V_j to all the uses of V_i.
In case we maintain loop closed ssa form, do not propagate arguments of loop exit phi nodes.
Note that just emitting the copies is fine -- there is no problem with ordering of phi nodes. This is because A is the single predecessor of B, therefore results of the phi nodes cannot appear as arguments of the phi nodes.
If we deal with a PHI for virtual operands, we can simply propagate these without fussing with folding or updating the stmt.
Ensure that B follows A.
Remove labels from B and set gimple_bb to A for other statements.
Now that we can thread computed gotos, we might have a situation where we have a forced label in block B However, the label at the start of block B might still be used in other ways (think about the runtime checking for Fortran assigned gotos). So we can not just delete the label. Instead we move the label to the start of block A.
Other user labels keep around in a form of a debug stmt.
Merge the sequences.
References edge_def::dest, edge_def::flags, and basic_block_def::succs.
|
static |
Moves basic block BB after block AFTER.
bool gimple_purge_all_dead_abnormal_call_edges | ( | ) |
Purge dead abnormal call edges from basic block listed in BLOCKS.
Earlier gimple_purge_dead_abnormal_call_edges could have removed this basic block already.
References do_warn_unused_result(), g, gimple_bind_body(), gimple_catch_handler(), gimple_eh_filter_failure(), gimple_try_cleanup(), gimple_try_eval(), gsi_end_p(), gsi_next(), and gsi_stmt().
bool gimple_purge_all_dead_eh_edges | ( | ) |
Purge dead EH edges from basic block listed in BLOCKS.
Earlier gimple_purge_dead_eh_edges could have removed this basic block already.
References edge_def::flags.
bool gimple_purge_dead_abnormal_call_edges | ( | ) |
Purge dead abnormal call edges from basic block BB.
Referenced by gimple_block_ends_with_call_p().
bool gimple_purge_dead_eh_edges | ( | ) |
Purge dead EH edges from basic block BB.
References cfun, function::decl, function::function_end_locus, gimple_location(), gimple_no_warning_p(), gimple_return_retval(), last_stmt(), edge_def::src, and warning_at().
Referenced by replace_phi_args_in().
|
static |
|
static |
Redirect E to DEST. Return NULL on failure. Otherwise, return the edge representing the redirected branch.
For COND_EXPR, we only need to redirect the edge.
No non-abnormal edges should lead from a non-simple goto, and simple ones should be represented implicitly.
If we have a list of cases associated with E, then use it as it's a lot faster than walking the entire case vector.
If there was already an edge in the CFG, then we need to move all the cases associated with E to E2.
If we didn't find any label matching the former edge in the asm labels, we must be redirecting the fallthrough edge.
The edges from OMP constructs can be simply redirected.
The ABORT edge has a stored label associated with it, otherwise the edges are simply redirectable.
Otherwise it must be a fallthru edge, and we don't need to do anything besides redirecting it.
Update/insert PHI nodes as necessary.
Now update the edges in the CFG.
References cfun, copy(), create_empty_bb(), create_new_def_for(), create_phi_node(), get_base_address(), gimple_copy(), gimple_debug_bind_get_var(), gimple_debug_bind_p(), gimple_duplicate_stmt_histograms(), gimple_get_lhs(), gimple_phi_result(), gimple_phi_result_ptr(), gimple_set_uid(), gimple_uid(), walk_stmt_info::gsi, gsi_end_p(), gsi_insert_after(), GSI_NEW_STMT, gsi_next(), gsi_start_bb(), gsi_stmt(), maybe_duplicate_eh_stmt(), and phi_nodes().
|
static |
Simple wrapper, as we can always redirect fallthru edges.
References edge_def::dest, and basic_block_def::loop_father.
|
static |
Splits basic block BB after statement STMT (but at least after the labels). If STMT is NULL, BB is split just after the labels.
Redirect the outgoing edges.
Move everything from GSI to the new basic block.
Split the statement list - avoid re-creating new containers as this brings ugly quadratic memory consumption in the inliner. (We are still quadratic since we need to update stmt BB pointers, sadly.)
References edge_def::dest, and loop::header.
|
static |
Split a basic block if it ends with a conditional branch and if the other part of the block is not empty.
|
static |
Split a (typically critical) edge EDGE_IN. Return the new block. Abort on abnormal edges.
Abnormal edges cannot be split.
References error().
|
static |
|
static |
Attempt to perform edge redirection by replacing a possibly complex jump instruction by a goto or by removing the jump completely. This can apply only if all edges now point to the same block. The parameters and return values are equivalent to redirect_edge_and_branch.
We can replace or remove a complex jump only when we have exactly two edges.
Verify that all targets will be TARGET. Specifically, the edge that is not E must also go to TARGET.
|
static |
Verifies that the flow information is OK.
Skip labels on the start of basic block.
Verify that body of basic block BB is free of control flow.
Verify that there are no edges with EDGE_TRUE/FALSE_FLAG set after anything else but if statement.
FIXME. We should double check that the labels in the destination blocks have their address taken.
... fallthru ...
Mark all the destination basic blocks.
Verify that the case labels are sorted.
VRP will remove the default case if it can prove it will never be executed. So do not verify there always exists a default case here.
Check that we have all of them.
tree gimplify_build1 | ( | gimple_stmt_iterator * | gsi, |
enum tree_code | code, | ||
tree | type, | ||
tree | a | ||
) |
Build a unary operation and gimplify it. Emit code before GSI. Return the gimple_val holding the result.
Referenced by expand_complex_libcall().
Build a binary operation and gimplify it. Emit code before GSI. Return the gimple_val holding the result.
Referenced by add_rshift(), and expand_complex_libcall().
tree gimplify_build3 | ( | gimple_stmt_iterator * | gsi, |
enum tree_code | code, | ||
tree | type, | ||
tree | a, | ||
tree | b, | ||
tree | c | ||
) |
Build a ternary operation and gimplify it. Emit code before GSI. Return the gimple_val holding the result.
References current_ir_type(), edge_def::dest, edge_def::edge_def_insns::g, edge_def::goto_locus, gt_pch_nx(), edge_def::insns, IR_GIMPLE, edge_def::edge_def_insns::r, and edge_def::src.
void group_case_labels | ( | void | ) |
Look for blocks ending in a multiway branch (a GIMPLE_SWITCH), and scan the sorted vector of cases. Combine the ones jumping to the same label.
References edge_def::flags, gimple_phi_arg_edge(), replace_exp(), and virtual_operand_p().
void group_case_labels_stmt | ( | ) |
Scan the sorted vector of cases in STMT (a GIMPLE_SWITCH) and combine the ones jumping to the same label. Eg. three separate entries 1: 2: 3: become one entry 1..3:
Look for possible opportunities to merge cases.
Discard cases that have the same destination as the default case.
Try to merge case labels. Break out when we reach the end of the label vector or when we cannot merge the next case label with the current one.
Merge the cases if they jump to the same place, and their ranges are consecutive.
Compress the case labels in the label vector, and adjust the length of the vector.
void gt_ggc_mx | ( | tree & | ) |
Garbage collection support for edge_def.
void gt_ggc_mx | ( | gimple & | ) |
void gt_ggc_mx | ( | rtx & | ) |
void gt_ggc_mx | ( | basic_block & | ) |
void gt_ggc_mx | ( | ) |
void gt_pch_nx | ( | tree & | ) |
PCH support for edge_def.
void gt_pch_nx | ( | gimple & | ) |
void gt_pch_nx | ( | rtx & | ) |
void gt_pch_nx | ( | basic_block & | ) |
void gt_pch_nx | ( | ) |
void init_empty_tree_cfg | ( | void | ) |
void init_empty_tree_cfg_for_function | ( | ) |
Initialize the basic block array.
Build a mapping of labels to their associated blocks.
bool is_ctrl_altering_stmt | ( | ) |
Return true if T is a statement that may alter the flow of control (e.g., a call to a non-returning function).
A call alters control flow if it can make an abnormal goto.
A call also alters control flow if it does not return.
TM ending statements have backedges out of the transaction. Return true so we split the basic block containing them. Note that the TM_BUILTIN test is merely an optimization.
BUILT_IN_RETURN call is same as return statement.
EH_DISPATCH branches to the individual catch handlers at this level of a try or allowed-exceptions region. It can fallthru to the next statement as well.
OpenMP directives alter control flow.
A transaction start alters control flow.
If a statement can throw, it alters control flow.
bool is_ctrl_stmt | ( | ) |
Return true if T represents a stmt that always transfers control.
References gsi_end_p(), gsi_next(), gsi_start_bb(), and gsi_stmt().
Referenced by create_rdg_edges_for_scalar(), and gsi_for_stmt().
basic_block label_to_block_fn | ( | ) |
Return the basic block holding label DEST.
We would die hard when faced by an undefined label. Emit a label to the very first basic block. This will hopefully make even the dataflow and undefined variable warnings quite right.
gimple last_and_only_stmt | ( | ) |
Return the last statement of an otherwise empty block. Return NULL if the block is totally empty, or if it contains more than one statement.
Empty statements should no longer appear in the instruction stream. Everything that might have appeared before should be deleted by remove_useless_stmts, and the optimizers should just gsi_remove instead of smashing with build_empty_stmt. Thus the only thing that should appear here in a block containing one executable statement is a label.
gimple last_stmt | ( | ) |
Return the last statement in basic block BB.
References error(), and is_gimple_mem_ref_addr().
Referenced by create_bb(), create_loop_fn(), create_rdg_edges_for_scalar(), dump_gimple_bb_footer(), final_range_test_p(), get_ancestor_addr_info(), gimple_purge_dead_eh_edges(), ip_end_pos(), lower_eh_constructs(), next_discriminator_for_locus(), operand_equal_for_value_replacement(), optimize_range_tests_diff(), process_switch(), recognize_bits_test(), recording_case_labels_p(), register_edge_assert_for_1(), rewrite_use_compare(), simplify_using_outer_evolutions(), tree_unswitch_single_loop(), and vect_recog_temp_ssa_var().
|
static |
Given LABEL return the first label in the same basic block.
label_to_block possibly inserted undefined label into the chain.
Referenced by cleanup_dead_labels(), make_gimple_asm_edges(), and make_goto_expr_edges().
void make_abnormal_goto_edges | ( | ) |
Create edges for an abnormal goto statement at block BB. If FOR_CALL is true, the source statement is a CALL_EXPR instead of a GOTO_EXPR.
Make an edge to every label block that has been marked as a potential target for a computed goto or a non-local goto.
Make an edge to every setjmp-like call.
|
static |
Basic blocks and flowgraphs.
|
static |
Build a flowgraph for the sequence of stmts SEQ.
If the statement starts a new basic block or if we have determined in a previous pass that we need to create a new block for STMT, do so now.
Now add STMT to BB and create the subgraphs for special statement codes.
If STMT is a basic block terminator, set START_NEW_BLOCK for the next iteration.
If the stmt can make abnormal goto use a new temporary for the assignment to the LHS. This makes sure the old value of the LHS is available on the abnormal edge. Otherwise we will end up with overlapping life-ranges for abnormal SSA names.
References create_tmp_var(), gimple_block(), gimple_get_lhs(), gimple_location(), gimple_set_block(), gimple_set_lhs(), gimple_set_location(), gsi_insert_after(), and GSI_SAME_STMT.
|
static |
|
static |
Create the edges for a GIMPLE_COND starting at block BB.
Entry basic blocks for each component.
We do not need the labels anymore.
|
static |
Edges.
Join all the blocks in the flowgraph.
Create an edge from entry to the first block with executable statements in it.
Traverse the basic block array placing edges.
If this function receives a nonlocal goto, then we need to make edges from this call site to all the nonlocal goto handlers.
If this statement has reachable exception handlers, then create abnormal edges to them.
BUILTIN_RETURN is really a return statement.
Some calls are known not to return.
A GIMPLE_ASSIGN may throw internally and thus be considered control-altering.
Fold COND_EXPR_COND of each COND_EXPR.
|
static |
|
static |
Create edges for an asm statement with labels at block BB.
References eh_region_d::eh_region_u::eh_try, eh_region_d::eh_region_u::eh_region_u_try::first_catch, eh_catch_d::label, main_block_label(), eh_catch_d::next_catch, and eh_region_d::u.
|
static |
|
static |
Create the edges for a GIMPLE_SWITCH starting at block BB.
|
static |
|
static |
Create edges for a goto statement at block BB.
A simple GOTO creates normal edges.
A computed GOTO creates abnormal edges.
References cfun, function::eh, ERT_CLEANUP, ERT_MUST_NOT_THROW, eh_landing_pad_d::index, eh_status::lp_array, main_block_label(), eh_landing_pad_d::post_landing_pad, eh_region_d::type, and vec_safe_iterate().
gimple_opt_pass* make_pass_build_cfg | ( | ) |
References gsi_last_bb(), and last.
gimple_opt_pass* make_pass_fixup_cfg | ( | ) |
gimple_opt_pass* make_pass_split_crit_edges | ( | ) |
gimple_opt_pass* make_pass_warn_function_return | ( | ) |
gimple_opt_pass* make_pass_warn_unused_result | ( | ) |
|
static |
Move basic block BB from function CFUN to function DEST_FN. The block is moved out of the original linked list and placed after block AFTER in the new list. Also, the block is removed from the original array of blocks and placed in DEST_FN's array of blocks. If UPDATE_EDGE_COUNT_P is true, the edge counts on both CFGs is updated to reflect the moved edges. The local variables are remapped to new instances, VARS_MAP is used to record the mapping.
Remove BB from dominance structures.
Move BB from its current loop to the copy in the new function.
Link BB to the new linked list.
Update the edge count in the corresponding flowgraphs.
Remove BB from the original basic block array.
Grow DEST_CFUN's basic block array if needed.
Remap the variables in phi nodes.
Remove the phi nodes for virtual operands (alias analysis will be run for the new function, anyway).
We cannot leave any operands allocated from the operand caches of the current function.
basic_block move_sese_region_to_fn | ( | struct function * | dest_cfun, |
basic_block | entry_bb, | ||
basic_block | exit_bb, | ||
tree | orig_block | ||
) |
Move a single-entry, single-exit region delimited by ENTRY_BB and EXIT_BB to function DEST_CFUN. The whole region is replaced by a single basic block in the original CFG and the new basic block is returned. DEST_CFUN must not have a CFG yet. Note that the region need not be a pure SESE region. Blocks inside the region may contain calls to abort/exit. The only restriction is that ENTRY_BB should be the only entry point and it must dominate EXIT_BB. Change TREE_BLOCK of all statements in ORIG_BLOCK to the new functions outermost BLOCK, move all subblocks of ORIG_BLOCK to the new function. All local variables referenced in the region are assumed to be in the corresponding BLOCK_VARS and unexpanded variable lists associated with DEST_CFUN.
If ENTRY does not strictly dominate EXIT, this cannot be an SESE region.
Collect all the blocks in the region. Manually add ENTRY_BB because it won't be added by dfs_enumerate_from.
The blocks that used to be dominated by something in BBS will now be dominated by the new block.
Detach ENTRY_BB and EXIT_BB from CFUN->CFG. We need to remember the predecessor edges to ENTRY_BB and the successor edges to EXIT_BB so that we can re-attach them to the new basic block that will replace the region.
Switch context to the child function to initialize DEST_FN's CFG.
Initialize EH information for the new function.
Initialize an empty loop tree.
Move the outlined loop tree part.
If the SESE region contains some bbs ending with a noreturn call, those are considered to belong to the outermost loop in saved_cfun, rather than the entry_bb's loop_father.
Remove loop exits from the outlined region.
Adjust the number of blocks in the tree root of the outlined part.
Setup a mapping to be used by move_block_to_fn.
Move blocks from BBS into DEST_CFUN.
No need to update edge counts on the last block. It has already been updated earlier when we detached the region from the original CFG.
Loop sizes are no longer correct, fix them up.
Rewire BLOCK_SUBBLOCKS of orig_block.
Rewire the entry and exit blocks. The successor to the entry block turns into the successor of DEST_FN's ENTRY_BLOCK_PTR in the child function. Similarly, the predecessor of DEST_FN's EXIT_BLOCK_PTR turns into the predecessor of EXIT_BLOCK_PTR. We need to switch CFUN between DEST_CFUN and SAVED_CFUN so that the various CFG manipulation function get to the right CFG. FIXME, this is silly. The CFG ought to become a parameter to these helpers.
Back in the original function, the SESE region has disappeared, create a new basic block in its place.
References gimple_body(), gimple_seq_first_stmt(), gimple_seq_last_stmt(), and print_gimple_seq().
|
static |
Helper for move_stmt_r. Given an EH region number for the source function, map that to the duplicate EH regio number in the dest.
|
static |
Similar, but operate on INTEGER_CSTs.
References fixup_loop_arrays_after_move(), get_loops(), loop::inner, loops_for_fn(), loop::next, loop::num, number_of_loops(), and vec_safe_push().
|
static |
Helper for move_block_to_fn. Set TREE_BLOCK in every expression contained in *TP if it has been ORIG_BLOCK previously and change the DECL_CONTEXT of every local variable referenced in *TP.
Replace T with its duplicate. T should no longer appear in the parent function, so this looks wasteful; however, it may appear in referenced_vars, and more importantly, as virtual operands of statements, and in alias lists of other variables. It would be quite difficult to expunge it from all those places. ??? It might suffice to do this for addressable variables.
References eh_region_outermost(), get_eh_region_from_lp_number_fn(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), lookup_stmt_eh_lp_fn(), and si.
|
static |
Like move_stmt_op, but for gimple statements. Helper for move_block_to_fn. Set GIMPLE_BLOCK in every expression contained in the current statement in *GSI_P and change the DECL_CONTEXT of every local variable referenced in the current statement.
Remap the region numbers for __builtin_eh_{pointer,filter}.
FALLTHRU
Do not remap variables inside OMP directives. Variables referenced in clauses and directive header belong to the parent function and should not be moved into the child function.
References cfun, edge_def::dest, dominated_by_p(), ei_safe_edge(), edge_def::flags, gather_blocks_in_sese_region(), get_dominated_by_region(), get_immediate_dominator(), get_loop(), basic_block_def::loop_father, loop::num_nodes, basic_block_def::preds, edge_def::probability, remove_edge(), edge_def::src, and basic_block_def::succs.
|
static |
Return true if we need to add fake edge to exit at statement T. Helper function for gimple_flow_call_edges_add.
NORETURN and LONGJMP calls already have an edge to exit. CONST and PURE calls do not need one. We don't currently check for CONST and PURE here, although it would be a good idea, because those attributes are figured out from the RTL in mark_constant_function, and the counter incrementation code from -fprofile-arcs leads to different results from -fbranch-probabilities.
fork() doesn't really return twice, but the effect of wrapping it in __gcov_fork() which calls __gcov_flush() and clears the counters before forking has the same effect as returning twice. Force a fake edge.
|
static |
|
static |
Find the next available discriminator value for LOCUS. The discriminator distinguishes among several basic blocks that share a common locus, allowing for more accurate sample-based profiling.
References edge_def::dest, basic_block_def::discriminator, first, first_non_label_stmt(), last_stmt(), and same_line_p().
void notice_special_calls | ( | ) |
T is CALL_EXPR. Set current_function_calls_* flags.
|
static |
Returns true if there is one pointer type in TYPE_POINTER_TO (SRC_OBJ) list of pointer-to types that is trivially convertible to DEST.
|
static |
Pretty print LOOP on FILE, indented INDENT spaces. Following VERBOSITY level this outputs the contents of the loop, or just its structure.
Print loop's header.
Print loop's body.
References bitmap_set_bit(), edge_def::dest, basic_block_def::index, and basic_block_def::succs.
|
static |
Print the LOOP and its sibling loops on FILE, indented INDENT spaces. Following VERBOSITY level this outputs the contents of the loop, or just its structure.
void print_loops | ( | ) |
Follow a CFG edge from the entry point of the program, and on entry of a loop, pretty print the loop structure on FILE.
References ei_next(), edge_def::flags, and remove_edge_and_dominated_blocks().
void print_loops_bb | ( | ) |
Print to FILE the basic block BB following the VERBOSITY level.
Print basic_block's header.
Print basic_block's body.
|
static |
|
static |
Print on FILE the indexes for the successors of basic_block BB.
References remove_edge().
|
static |
Return nonzero if we are recording information for case labels.
References last_stmt().
|
static |
Reinstall those PHI arguments queued in OLD_EDGE to NEW_EDGE.
Referenced by stmt_starts_bb_p().
|
static |
|
static |
Remove statements of basic block BB.
If a loop gets removed, clean up the information associated with it.
Remove all the instructions in the block.
Walk backwards so as to get a chance to substitute all released DEFs into debug stmts. See eliminate_unnecessary_stmts() in tree-ssa-dce.c for more details.
A non-reachable non-local label may still be referenced. But it no longer needs to carry the extra semantics of non-locality.
Release SSA definitions if we are in SSA. Note that we may be called when not in SSA. For example, final_cleanup calls this function via cleanup_tree_cfg.
void remove_edge_and_dominated_blocks | ( | ) |
Removes edge E and all the blocks dominated by it, and updates dominance information. The IL in E->src needs to be updated separately. If dominance info is not available, only the edge E is removed.
No updating is needed for edges to exit.
First, we find the basic blocks to remove. If E->dest has a predecessor that is not dominated by E->dest, then this set is empty. Otherwise, all the basic blocks dominated by E->dest are removed. Also, to DF_IDOM we store the immediate dominators of the blocks in the dominance frontier of E (i.e., of the successors of the removed blocks, if there are any, and of E->dest otherwise).
Record the set of the altered basic blocks.
Remove E and the cancelled blocks.
Walk backwards so as to get a chance to substitute all released DEFs into debug stmts. See eliminate_unnecessary_stmts() in tree-ssa-dce.c for more details.
Update the dominance information. The immediate dominator may change only for blocks whose immediate dominator belongs to DF_IDOM: Suppose that idom(X) = Y before removal of E and idom(X) != Y after the removal. Let Z the arbitrary block such that idom(Z) = Y and Z dominates X after the removal. Before removal, there exists a path P from Y to X that avoids Z. Let F be the last edge on P that is removed, and let W = F->dest. Before removal, idom(W) = Y (since Y dominates W, and because of P, Z does not dominate W), and W belongs to the dominance frontier of E. Therefore, Y belongs to DF_IDOM.
Referenced by print_loops(), and remove_fallthru_edge().
|
static |
Remove PHI nodes associated with basic block BB and all edges out of BB.
Since this block is no longer reachable, we can just delete all of its PHI nodes.
Remove edges to BB's successors.
|
static |
Change DECL_CONTEXT of all BLOCK_VARS in block, including subblocks.
|
static |
Replaces *TP with a duplicate (belonging to function TO_CONTEXT). The duplicates are recorded in VARS_MAP.
|
static |
Search for ANNOTATE call with annot_expr_ivdep_kind; if found, remove it and set loop->safelen to INT_MAX. We assume that the annotation comes immediately before the condition.
Remove IFN_ANNOTATE. Safeguard for the case loop->latch == NULL.
|
static |
Creates an ssa name in TO_CONTEXT equivalent to NAME. VARS_MAP maps old ssa names and var_decls to the new ones.
References function::cfg, cfun, gimple_label_label(), vec_safe_grow_cleared(), vec_safe_length(), and control_flow_graph::x_label_to_block_map.
void replace_uses_by | ( | ) |
Replaces all uses of NAME by VAL.
This can only occur for virtual operands, since for the real ones SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)) would prevent replacement.
Mark the block if we changed the last stmt in it.
FIXME. It shouldn't be required to keep TREE_CONSTANT on ADDR_EXPRs up-to-date on GIMPLE. Propagation will only change sth from non-invariant to invariant, and only when propagating constants.
Operands may be empty here. For example, the labels of a GIMPLE_COND are nulled out following the creation of the corresponding CFG edges.
Also update the trees stored in loop structures.
Referenced by scev_reset().
|
static |
|
static |
Return TRUE if LOCUS1 and LOCUS2 refer to the same source line.
Referenced by next_discriminator_for_locus().
bool simple_goto_p | ( | ) |
Return true if T is a simple local goto.
References edge_def::dest, find_edge(), edge_def::flags, basic_block_def::prev_bb, and edge_def::src.
Referenced by mark_stmt_if_obviously_necessary().
basic_block single_noncomplex_succ | ( | ) |
Return the one of two successors of BB that is not reachable by a complex edge, if there is one. Else, return BB. We use this in optimizations that use post-dominators for their heuristics, to catch the cases in C++ where function calls are involved.
|
static |
Split all critical edges.
split_edge can redirect edges out of SWITCH_EXPRs, which can get expensive. So we want to enable recording of edge to CASE_LABEL_EXPR mappings around the calls to split_edge.
PRE inserts statements to edges and expects that since split_critical_edges was done beforehand, committing edge insertions will not split more edges. In addition to critical edges we must split edges that have multiple successors and end by control flow statements, such as RESX. Go ahead and split them too. This matches the logic in gimple_find_edge_insert_loc.
References builtin_decl_implicit(), gimple_build_call(), gsi_insert_after(), gsi_last_bb(), and GSI_NEW_STMT.
|
static |
Returns the basic block after which the new basic block created by splitting edge EDGE_IN should be placed. Tries to keep the new block near its "logical" location. This is of most help to humans looking at debugging dumps.
References error().
Referenced by stmt_starts_bb_p().
void start_recording_case_labels | ( | void | ) |
Start recording information mapping edges to case labels.
bool stmt_can_make_abnormal_goto | ( | ) |
Return true if T can make an abnormal transfer of control flow. Transfers of control flow associated with EH are excluded.
References gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), and is_gimple_debug().
Referenced by eliminate_avail().
bool stmt_ends_bb_p | ( | ) |
Return true if T should end a basic block.
Referenced by compare_range_with_value(), disqualify_base_of_expr(), do_partial_partial_insertion(), simulate_stmt(), surely_varying_stmt_p(), and trivially_conflicts_p().
|
inlinestatic |
Return true if STMT should start a new basic block. PREV_STMT is the statement preceding STMT. It is used when STMT is a label or a case label. Labels should only start a new basic block if their previous statement wasn't a label. Otherwise, sequence of labels would generate unnecessary basic blocks that only contain a single label.
Labels start a new basic block only if the preceding statement wasn't a label of the same type. This prevents the creation of consecutive blocks that have nothing but a single label.
Nonlocal and computed GOTO targets always start a new block.
setjmp acts similar to a nonlocal GOTO target and thus should start a new block.
References edge_def::count, basic_block_def::count, create_empty_bb(), edge_def::dest, edge_def::flags, basic_block_def::frequency, make_edge(), edge_def::probability, redirect_edge_and_branch(), reinstall_phi_args(), and split_edge_bb_loc().
|
static |
Return true when the T can be shared.
|
static |
Return true if TYPE1 is a fixed-point type and if conversions to and from TYPE2 can be handled by FIXED_CONVERT_EXPR.
References debug_generic_expr(), and error().
|
static |
Verify properties of the address expression T with base object BASE.
|
static |
|
static |
Callback for walk_tree, check that all elements with address taken are properly noticed as such. The DATA is an int* that is 1 if TP was seen inside a PHI node.
Check operand N for being valid GIMPLE and give error MSG if not.
Skip any references (they will be checked when we recurse down the tree) and ensure that any variable used as a prefix is marked addressable.
Fall-through.
We have a nest of references. Verify that each of the operands that determine where to reference is either a constant or a variable, verify that the base is valid, and then show we've already checked the subtrees.
PLUS_EXPR and MINUS_EXPR don't work on pointers, they should be done using POINTER_PLUS_EXPR.
Check to make sure the first operand is a pointer or reference type.
Check to make sure the second operand is a ptrofftype.
FALLTHROUGH
References error().
|
static |
Called via walk_gimple_op. Verify locations of expressions.
|
static |
Called via walk_tree. Verify locations of expressions.
References error(), gimple_label_label(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), basic_block_def::index, and print_generic_expr().
|
static |
Called via walk_tree. Verify that expressions have no blocks.
References error().
|
static |
Verify the contents of a GIMPLE_ASSIGN STMT. Returns true when there is a problem, otherwise false.
References error().
|
static |
Verify a gimple assignment statement STMT with a binary rhs. Returns true if anything is wrong.
First handle operations that involve different types.
Shifts and rotates are ok on integral types, fixed point types and integer vector types.
Vector shifts of vectors are also ok.
For shifting a vector of non-integral components we only allow shifting by a constant multiple of the element size.
Continue with generic binary expression handling.
Comparisons are also binary, but the result type is not connected to the operand types.
FIXME.
Continue with generic binary expression handling.
|
static |
Verify a gimple assignment statement STMT with a single rhs. Returns true if anything is wrong.
Special codes we cannot handle via their class.
Technically there is no longer a need for matching types, but gimple hygiene asks for this check. In LTO we can end up combining incompatible units and thus end up with addresses of globals that change their type to a common one.
tcc_reference
tcc_constant
tcc_declaration
For vector CONSTRUCTORs we require that either it is empty CONSTRUCTOR, or it is a CONSTRUCTOR of smaller vector elements (then the element count must be correct to cover the whole outer vector and index must be NULL on all elements, or it is a CONSTRUCTOR of scalar elements, where we as an exception allow smaller number of elements (assuming zero filling) and consecutive indexes as compared to NULL indexes (such CONSTRUCTORs can appear in the IL from FEs).
FIXME.
|
static |
Verify a gimple assignment statement STMT with a ternary rhs. Returns true if anything is wrong.
First handle operations that involve different types.
FIXME.
References debug_generic_stmt(), and error().
|
static |
Verify a gimple assignment statement STMT with an unary rhs. Returns true if anything is wrong.
First handle conversions.
Allow conversions from pointer type to integral type only if there is no sign or zero extension involved. For targets were the precision of ptrofftype doesn't match that of pointers we need to allow arbitrary conversions to ptrofftype.
Allow conversion from integral to offset type and vice versa.
Otherwise assert we are converting between types of the same kind.
FIXME.
For the remaining codes assert there is no conversion involved.
|
static |
Verify the contents of a GIMPLE_CALL STMT. Returns true when there is a problem, otherwise false.
??? At least C++ misses conversions at assignments from void * call results. ??? Java is completely off. Especially with functions returning java.lang.Object. For now simply allow arbitrary pointer type conversions.
If there is a static chain argument, this should not be an indirect call, and the decl should have DECL_STATIC_CHAIN set.
??? The C frontend passes unpromoted arguments in case it didn't see a function declaration before the call. So for now leave the call arguments mostly unverified. Once we gimplify unit-at-a-time we have a chance to fix this.
|
static |
Verifies the gimple comparison with the result type TYPE and the operands OP0 and OP1.
For comparisons we do not have the operations type as the effective type the comparison is carried out in. Instead we require that either the first operand is trivially convertible into the second, or the other way around. Because we special-case pointers to void we allow comparisons of pointers with the same mode as well.
The resulting type of a comparison may be an effective boolean type.
Or an integer vector type with the same size and element count as the comparison operand types.
The result of a vector comparison is of signed integral type.
|
static |
Verify a gimple debug statement STMT. Returns true if anything is wrong.
There isn't much that could be wrong in a gimple debug stmt. A gimple debug bind stmt, for example, maps a tree, that's usually a VAR_DECL or a PARM_DECL, but that could also be some scalarized component or member of an aggregate type, to another tree, that can be an arbitrary expression. These stmts expand into debug insns, and are converted to debug notes by var-tracking.c.
|
static |
Verify the contents of a GIMPLE_GOTO STMT. Returns true when there is a problem, otherwise false.
??? We have two canonical forms of direct goto destinations, a bare LABEL_DECL and an ADDR_EXPR of a LABEL_DECL.
References error().
DEBUG_FUNCTION void verify_gimple_in_cfg | ( | ) |
Verify the GIMPLE statements in the CFG of FN.
Collect all BLOCKs referenced by the BLOCK tree of FN.
Only PHI arguments have locations.
??? Instead of not checking these stmts at all the walker should know its context via wi.
If the statement is marked as part of an EH region, then it is expected that the statement could throw. Verify that when we have optimizations that simplify statements such that we prove that they cannot throw, that we update other data structures to match.
DEBUG_FUNCTION void verify_gimple_in_seq | ( | ) |
Verify the GIMPLE statements inside the statement list STMTS.
|
static |
Verify the GIMPLE statements inside the sequence STMTS.
|
static |
Verify a gimple label statement STMT. Returns true if anything is wrong.
References gdbhooks::IDENTIFIER_NODE, and is_gimple_min_invariant().
|
static |
Verify the contents of a GIMPLE_PHI. Returns true if there is a problem, and false otherwise.
Addressable variables do have SSA_NAMEs but they are not considered gimple values.
|
static |
Verify the contents of a GIMPLE_RETURN STMT. Returns true when there is a problem, otherwise false.
We cannot test for present return values as we do not fix up missing return values from the original source.
|
static |
Verify the GIMPLE statement STMT. Returns true if there is an error, otherwise false.
Tuples that do not have tree operands.
OpenMP directives are validated by the FE and never operated on by the optimizers. Furthermore, GIMPLE_OMP_FOR may contain non-gimple expressions when the main index variable has had its address taken. This does not affect the loop itself because the header of an GIMPLE_OMP_FOR is merely used to determine how to setup the parallel iteration.
References walk_stmt_info::info, and verify_node_sharing_1().
|
static |
Verify the contents of a GIMPLE_SWITCH STMT. Returns true when there is a problem, otherwise false.
|
static |
|
static |
Verify the contents of a GIMPLE_TRANSACTION. Returns true if there is a problem, otherwise false.
|
static |
Verify if the location LOCs block is in BLOCKS.
|
static |
Called via walk_gimple_stmt. Verify tree sharing.
References error().
|
static |
Called via walk_tree. Verify tree sharing.
Referenced by verify_gimple_stmt().
|
static |
Verify if EXPR is either a GIMPLE ID or a GIMPLE indirect reference. Returns true if there is an error, otherwise false.
TARGET_MEM_REFs are strange beasts.
Memory references now generally can involve a value conversion.
References debug_generic_stmt(), and error().
|
static |
Verify if EXPR is a valid GIMPLE reference expression. If REQUIRE_LVALUE is true verifies it is an lvalue. Returns true if there is an error, otherwise false.
Verify if the reference array element types are compatible.
For VIEW_CONVERT_EXPRs which are allowed here too, we only check that their operand is not an SSA name or an invariant when requiring an lvalue (this usually means there is a SRA or IPA-SRA bug). Otherwise there is nothing to verify, gross mismatches at most invoke undefined behavior.
References error().
|
static |
Referenced by debug_cfg_stats().
|
static |
|
static |
This hash table allows us to efficiently lookup all CASE_LABEL_EXPRs which use a particular edge. The CASE_LABEL_EXPRs are chained together via their CASE_CHAIN field, which we clear after we're done with the hash table to prevent problems with duplication of GIMPLE_SWITCHes. Access to this list of CASE_LABEL_EXPRs allows us to efficiently update the case vector in response to edge redirections. Right now this table is set up and torn down at key points in the compilation process. It would be nice if we could make the table more persistent. The key is getting notification of changes to the CFG (particularly edge removal, creation and redirection).
|
static |
|
static |
Nonzero if we found a computed goto while building basic blocks.
struct cfg_hooks gimple_cfg_hooks |
Hooks containers.
Referenced by cfg_layout_rtl_register_cfg_hooks(), and set_cfg_hooks().
|
static |
@verbatim
Control flow functions for trees. Copyright (C) 2001-2013 Free Software Foundation, Inc. Contributed by Diego Novillo dnovi llo@ redha t.co m
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 contains functions for building the Control Flow Graph (CFG) for a function tree.
Local declarations.
Initial capacity for the basic block array.
|
static |
Referenced by make_pass_into_cfg_layout_mode().
|
static |
If we record edge_to_cases, this bitmap will hold indexes of basic blocks that end in a GIMPLE_SWITCH which we touched due to edge manipulations.