GCC Middle and Back End API Reference
gimple-low.c File Reference

Data Structures

struct  return_statements_t
struct  lower_data

Typedefs

typedef struct return_statements_t return_statements_t

Functions

static void lower_stmt (gimple_stmt_iterator *, struct lower_data *)
static void lower_gimple_bind (gimple_stmt_iterator *, struct lower_data *)
static void lower_try_catch (gimple_stmt_iterator *, struct lower_data *)
static void lower_gimple_return (gimple_stmt_iterator *, struct lower_data *)
static void lower_builtin_setjmp (gimple_stmt_iterator *)
static unsigned int lower_function_body ()
gimple_opt_passmake_pass_lower_cf ()
static void lower_sequence ()
static void lower_omp_directive ()
static void lower_stmt ()
static void lower_gimple_bind ()
static void lower_try_catch ()
static bool gimple_try_catch_may_fallthru ()
bool gimple_stmt_may_fallthru ()
bool gimple_seq_may_fallthru ()
static void lower_gimple_return ()
static void lower_builtin_setjmp ()
void record_vars_into ()
void record_vars ()

Typedef Documentation


Function Documentation

bool gimple_seq_may_fallthru ( )
   Same as gimple_stmt_may_fallthru, but for the gimple sequence SEQ.  
bool gimple_stmt_may_fallthru ( )
   Try to determine if we can continue executing the statement
   immediately following STMT.  This guess need not be 100% accurate;
   simply be conservative and return true if we don't know.  This is
   used only to avoid stupidly generating extra code. If we're wrong,
   we'll just delete the extra code later.  
         Easy cases.  If the last statement of the seq implies
         control transfer, then we can't fall through.  
         Switch has already been lowered and represents a branch
         to a selected label and hence can't fall through.  
         GIMPLE_COND's are already lowered into a two-way branch.  They
         can't fall through.  
         It must be a GIMPLE_TRY_FINALLY.  
         The finally clause is always executed after the try clause,
         so if it does not fall through, then the try-finally will not
         fall through.  Otherwise, if the try clause does not fall
         through, then when the finally clause falls through it will
         resume execution wherever the try clause was going.  So the
         whole try-finally will only fall through if both the try
         clause and the finally clause fall through.  
         Functions that do not return do not fall through.  
static bool gimple_try_catch_may_fallthru ( )
static
   Try to determine whether a TRY_CATCH expression can fall through.
   This is a subroutine of gimple_stmt_may_fallthru.  
     We don't handle GIMPLE_TRY_FINALLY.  
     If the TRY block can fall through, the whole TRY_CATCH can
     fall through.  
         We expect to see a sequence of GIMPLE_CATCH stmts, each with a
         catch expression and a body.  The whole try/catch may fall
         through iff any of the catch bodies falls through.  
         The exception filter expression only matters if there is an
         exception.  If the exception does not match EH_FILTER_TYPES,
         we will execute EH_FILTER_FAILURE, and we will fall through
         if that falls through.  If the exception does match
         EH_FILTER_TYPES, the stack unwinder will continue up the
         stack, so we will not fall through.  We don't know whether we
         will throw an exception which matches EH_FILTER_TYPES or not,
         so we just ignore EH_FILTER_TYPES and assume that we might
         throw an exception which doesn't match.  
         This case represents statements to be executed when an
         exception occurs.  Those statements are implicitly followed
         by a GIMPLE_RESX to resume execution after the exception.  So
         in this case the try/catch never falls through.  
static void lower_builtin_setjmp ( gimple_stmt_iterator )
static
static void lower_builtin_setjmp ( )
static
   Lower a __builtin_setjmp GSI.

   __builtin_setjmp is passed a pointer to an array of five words (not
   all will be used on all machines).  It operates similarly to the C
   library function of the same name, but is more efficient.

   It is lowered into 3 other builtins, namely __builtin_setjmp_setup,
   __builtin_setjmp_dispatcher and __builtin_setjmp_receiver, but with
   __builtin_setjmp_dispatcher shared among all the instances; that's
   why it is only emitted at the end by lower_function_body.

   After full lowering, the body of the function should look like:

    {
      void * setjmpvar.0;
      int D.1844;
      int D.2844;

      [...]

      __builtin_setjmp_setup (&buf, &<D1847>);
      D.1844 = 0;
      goto <D1846>;
      <D1847>:;
      __builtin_setjmp_receiver (&<D1847>);
      D.1844 = 1;
      <D1846>:;
      if (D.1844 == 0) goto <D1848>; else goto <D1849>;

      [...]

      __builtin_setjmp_setup (&buf, &<D2847>);
      D.2844 = 0;
      goto <D2846>;
      <D2847>:;
      __builtin_setjmp_receiver (&<D2847>);
      D.2844 = 1;
      <D2846>:;
      if (D.2844 == 0) goto <D2848>; else goto <D2849>;

      [...]

      <D3850>:;
      return;
      <D3853>: [non-local];
      setjmpvar.0 = __builtin_setjmp_dispatcher (&<D3853>);
      goto setjmpvar.0;
    }

   The dispatcher block will be both the unique destination of all the
   abnormal call edges and the unique source of all the abnormal edges
   to the receivers, thus keeping the complexity explosion localized.  
     NEXT_LABEL is the label __builtin_longjmp will jump to.  Its address is
     passed to both __builtin_setjmp_setup and __builtin_setjmp_receiver.  
     Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert.  
     Build 'DEST = 0' and insert.  
     Build 'goto CONT_LABEL' and insert.  
     Build 'NEXT_LABEL:' and insert.  
     Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert.  
     Build 'DEST = 1' and insert.  
     Build 'CONT_LABEL:' and insert.  
     Remove the call to __builtin_setjmp.  
static unsigned int lower_function_body ( )
static
   Lower the body of current_function_decl from High GIMPLE into Low
   GIMPLE.  
     The gimplifier should've left a body of exactly one statement,
     namely a GIMPLE_BIND.  
     If the function falls off the end, we need a null return statement.
     If we've already got one in the return_statements vector, we don't
     need to do anything special.  Otherwise build one by hand.  
     If we lowered any return statements, emit the representative
     at the end of the function.  
     If the function calls __builtin_setjmp, we need to emit the computed
     goto that will serve as the unique dispatcher for all the receivers.  
         Build 'DISP_LABEL:' and insert.  
         This mark will create forward edges from every call site.  
         Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);'
         and insert.  
         Build 'goto DISP_VAR;' and insert.  
     Once the old body has been lowered, replace it with the new
     lowered sequence.  
static void lower_gimple_bind ( gimple_stmt_iterator ,
struct lower_data  
)
static

Referenced by lower_omp_directive().

static void lower_gimple_bind ( )
static
   Lower a bind_expr TSI.  DATA is passed through the recursion.  
             The outermost block of the original function may not be the
             outermost statement chain of the gimplified function.  So we
             may see the outermost block just inside the function.  
             We do not expect to handle duplicate blocks.  
             Block tree may get clobbered by inlining.  Normally this would
             be fixed in rest_of_decl_compilation using block notes, but
             since we are not going to emit them, it is up to us.  
     The GIMPLE_BIND no longer carries any useful information -- kill it.  
static void lower_gimple_return ( gimple_stmt_iterator ,
struct lower_data  
)
static
static void lower_gimple_return ( )
static
   Lower a GIMPLE_RETURN GSI.  DATA is passed through the recursion.  
     Match this up with an existing return statement that's been created.  
             Remove the line number from the representative return statement.
             It now fills in for many such returns.  Failure to remove this
             will result in incorrect results for coverage analysis.  
     Not found.  Create a new label and record the return statement.  
     Generate a goto statement and remove the return statement.  
     When not optimizing, make sure user returns are preserved.  

References build_addr(), build_zero_cst(), builtin_decl_implicit(), create_artificial_label(), current_function_decl, fold_convert_loc(), g, gimple_block(), gimple_build_call(), gimple_build_goto(), gimple_build_label(), gimple_call_arg(), gimple_call_lhs(), gimple_location(), gimple_set_block(), gimple_set_location(), gsi_insert_before(), GSI_SAME_STMT, and gsi_stmt().

static void lower_omp_directive ( )
static
   Lower the OpenMP directive statement pointed by GSI.  DATA is
   passed through the recursion.  

References lower_data::block, lower_data::cannot_fallthru, gimple_set_block(), gsi_next(), gsi_stmt(), and lower_gimple_bind().

static void lower_sequence ( )
static
   Lower sequence SEQ.  Unlike gimplification the statements are not relowered
   when they are changed -- if this has to be done, the lowering routine must
   do it explicitly.  DATA is passed through the recursion.  
static void lower_stmt ( gimple_stmt_iterator ,
struct lower_data  
)
static
static void lower_stmt ( )
static
   Lower statement GSI.  DATA is passed through the recursion.  We try to
   track the fallthruness of statements and get rid of unreachable return
   statements in order to prevent the EH lowering pass from adding useless
   edges that can cause bogus warnings to be issued later; this guess need
   not be 100% accurate, simply be conservative and reset cannot_fallthru
   to false if we don't know.  
         Propagate fallthruness.  
             Propagate fallthruness.  
             It must be a GIMPLE_TRY_FINALLY.  
             The finally clause is always executed after the try clause,
             so if it does not fall through, then the try-finally will not
             fall through.  Otherwise, if the try clause does not fall
             through, then when the finally clause falls through it will
             resume execution wherever the try clause was going.  So the
             whole try-finally will only fall through if both the try
             clause and the finally clause fall through.  

References gsi_remove().

static void lower_try_catch ( gimple_stmt_iterator ,
struct lower_data  
)
static
static void lower_try_catch ( )
static
   Same as above, but for a GIMPLE_TRY_CATCH.  
     We don't handle GIMPLE_TRY_FINALLY.  
         We expect to see a sequence of GIMPLE_CATCH stmts, each with a
         catch expression and a body.  The whole try/catch may fall
         through iff any of the catch bodies falls through.  
         The exception filter expression only matters if there is an
         exception.  If the exception does not match EH_FILTER_TYPES,
         we will execute EH_FILTER_FAILURE, and we will fall through
         if that falls through.  If the exception does match
         EH_FILTER_TYPES, the stack unwinder will continue up the
         stack, so we will not fall through.  We don't know whether we
         will throw an exception which matches EH_FILTER_TYPES or not,
         so we just ignore EH_FILTER_TYPES and assume that we might
         throw an exception which doesn't match.  
         This case represents statements to be executed when an
         exception occurs.  Those statements are implicitly followed
         by a GIMPLE_RESX to resume execution after the exception.  So
         in this case the try/catch never falls through.  
gimple_opt_pass* make_pass_lower_cf ( )

References gsi_stmt().

void record_vars ( )
   Record the variables in VARS into current_function_decl.  
void record_vars_into ( )
   Record the variables in VARS into function FN.  
         BIND_EXPRs contains also function/type/constant declarations
         we don't need to care about.  
         Nothing to do in this case.  
         Record the variable.