GCC Middle and Back End API Reference
tree-complex.c File Reference

Typedefs

typedef int complex_lattice_t

Enumerations

enum  { UNINITIALIZED = 0, ONLY_REAL = 1, ONLY_IMAG = 2, VARYING = 3 }

Functions

static tree cvc_lookup ()
static void cvc_insert ()
static int some_nonzerop ()
static complex_lattice_t find_lattice_value_parts ()
static complex_lattice_t find_lattice_value ()
static bool is_complex_reg ()
static void init_parameter_lattice_values ()
static bool init_dont_simulate_again ()
static enum ssa_prop_result complex_visit_stmt (gimple stmt, edge *taken_edge_p, tree *result_p)
static enum ssa_prop_result complex_visit_phi ()
static tree create_one_component_var (tree type, tree orig, const char *prefix, const char *suffix, enum tree_code code)
static tree get_component_var ()
static tree get_component_ssa_name ()
static gimple_seq set_component_ssa_name ()
static tree extract_component (gimple_stmt_iterator *gsi, tree t, bool imagpart_p, bool gimple_p)
static void update_complex_components (gimple_stmt_iterator *gsi, gimple stmt, tree r, tree i)
static void update_complex_components_on_edge ()
static void update_complex_assignment ()
static void update_parameter_components ()
static void update_phi_components ()
static void expand_complex_move ()
static void expand_complex_addition (gimple_stmt_iterator *gsi, tree inner_type, tree ar, tree ai, tree br, tree bi, enum tree_code code, complex_lattice_t al, complex_lattice_t bl)
static void expand_complex_libcall (gimple_stmt_iterator *gsi, tree ar, tree ai, tree br, tree bi, enum tree_code code)
static void expand_complex_multiplication (gimple_stmt_iterator *gsi, tree inner_type, tree ar, tree ai, tree br, tree bi, complex_lattice_t al, complex_lattice_t bl)
static void expand_complex_div_straight (gimple_stmt_iterator *gsi, tree inner_type, tree ar, tree ai, tree br, tree bi, enum tree_code code)
static void expand_complex_div_wide (gimple_stmt_iterator *gsi, tree inner_type, tree ar, tree ai, tree br, tree bi, enum tree_code code)
static void expand_complex_division (gimple_stmt_iterator *gsi, tree inner_type, tree ar, tree ai, tree br, tree bi, enum tree_code code, complex_lattice_t al, complex_lattice_t bl)
static void expand_complex_negation (gimple_stmt_iterator *gsi, tree inner_type, tree ar, tree ai)
static void expand_complex_conjugate (gimple_stmt_iterator *gsi, tree inner_type, tree ar, tree ai)
static void expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai, tree br, tree bi, enum tree_code code)
static void expand_complex_asm ()
static void expand_complex_operations_1 ()
static unsigned int tree_lower_complex ()
gimple_opt_passmake_pass_lower_complex ()
static bool gate_no_optimization ()
gimple_opt_passmake_pass_lower_complex_O0 ()

Variables

static vec< complex_lattice_tcomplex_lattice_values
static int_tree_htab_type complex_variable_components
static vec< treecomplex_ssa_name_components

Typedef Documentation

typedef int complex_lattice_t
The type complex_lattice_t holds combinations of the above
   constants.   

Enumeration Type Documentation

anonymous enum
@verbatim Lower complex number operations to scalar operations.

Copyright (C) 2004-2013 Free Software Foundation, Inc.

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

For each complex ssa name, a lattice value.  We're interested in finding
   out whether a complex number is degenerate in some way, having only real
   or only complex parts.   
Enumerator:
UNINITIALIZED 
ONLY_REAL 
ONLY_IMAG 
VARYING 

Function Documentation

static enum ssa_prop_result complex_visit_phi ( )
static
static enum ssa_prop_result complex_visit_stmt ( gimple  stmt,
edge taken_edge_p,
tree result_p 
)
static
static tree create_one_component_var ( tree  type,
tree  orig,
const char *  prefix,
const char *  suffix,
enum tree_code  code 
)
static
Create one backing variable for a complex component of ORIG.   

References create_tmp_var(), and get_identifier().

Referenced by get_component_var().

static void cvc_insert ( )
static
Insert the pair UID, TO into the complex_variable_components hashtable.   

References hash_table< Descriptor, Allocator >::find_slot_with_hash(), int_tree_map::to, and int_tree_map::uid.

Referenced by get_component_var().

static tree cvc_lookup ( )
static
Lookup UID in the complex_variable_components hashtable and return the
   associated tree.   

References hash_table< Descriptor, Allocator >::find_with_hash(), int_tree_map::to, and int_tree_map::uid.

Referenced by get_component_var().

static void expand_complex_addition ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  ar,
tree  ai,
tree  br,
tree  bi,
enum tree_code  code,
complex_lattice_t  al,
complex_lattice_t  bl 
)
static
Expand complex addition to scalars:
        a + b = (ar + br) + i(ai + bi)
        a - b = (ar - br) + i(ai + bi)

References gimplify_build2(), ONLY_IMAG, ONLY_REAL, update_complex_assignment(), and VARYING.

Referenced by expand_complex_operations_1().

static void expand_complex_asm ( )
static
static void expand_complex_comparison ( gimple_stmt_iterator gsi,
tree  ar,
tree  ai,
tree  br,
tree  bi,
enum tree_code  code 
)
static
static void expand_complex_conjugate ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  ar,
tree  ai 
)
static
Expand complex conjugate to scalars:
        ~a = (ar) + i(-ai)

References gimplify_build1(), and update_complex_assignment().

Referenced by expand_complex_operations_1().

static void expand_complex_div_straight ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  ar,
tree  ai,
tree  br,
tree  bi,
enum tree_code  code 
)
static
Keep this algorithm in sync with fold-const.c:const_binop().

   Expand complex division to scalars, straightforward algorithm.
        a / b = ((ar*br + ai*bi)/t) + i((ai*br - ar*bi)/t)
            t = br*br + bi*bi

References gimplify_build2(), and update_complex_assignment().

Referenced by expand_complex_division().

static void expand_complex_division ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  ar,
tree  ai,
tree  br,
tree  bi,
enum tree_code  code,
complex_lattice_t  al,
complex_lattice_t  bl 
)
static
static void expand_complex_multiplication ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  ar,
tree  ai,
tree  br,
tree  bi,
complex_lattice_t  al,
complex_lattice_t  bl 
)
static
Expand complex multiplication to scalars:
        a * b = (ar*br - ai*bi) + i(ar*bi + br*ai)

References dconst1, expand_complex_libcall(), gimplify_build1(), gimplify_build2(), ONLY_IMAG, ONLY_REAL, update_complex_assignment(), and VARYING.

Referenced by expand_complex_operations_1().

static void expand_complex_negation ( gimple_stmt_iterator gsi,
tree  inner_type,
tree  ar,
tree  ai 
)
static
Expand complex negation to scalars:
        -a = (-ar) + i(-ai)

References gimplify_build1(), and update_complex_assignment().

Referenced by expand_complex_operations_1().

static tree extract_component ( gimple_stmt_iterator gsi,
tree  t,
bool  imagpart_p,
bool  gimple_p 
)
static
Extract the real or imaginary part of a complex variable or constant.
   Make sure that it's a proper gimple_val and gimplify it if not.
   Emit any new code before gsi.   

References force_gimple_operand_gsi(), get_component_ssa_name(), GSI_SAME_STMT, and unshare_expr().

Referenced by expand_complex_move(), expand_complex_operations_1(), and update_phi_components().

static complex_lattice_t find_lattice_value ( )
static
static complex_lattice_t find_lattice_value_parts ( )
static
Compute a lattice value from the components of a complex type REAL
   and IMAG.   

References ONLY_IMAG, ONLY_REAL, some_nonzerop(), and UNINITIALIZED.

Referenced by complex_visit_stmt(), and find_lattice_value().

static bool gate_no_optimization ( )
static

References cfun, and function::curr_properties.

static tree get_component_ssa_name ( )
static
static tree get_component_var ( )
static
Retrieve a value for a complex component of VAR.   

References create_one_component_var(), cvc_insert(), and cvc_lookup().

Referenced by get_component_ssa_name(), and set_component_ssa_name().

static bool init_dont_simulate_again ( )
static
static void init_parameter_lattice_values ( )
static
Mark the incoming parameters to the function as VARYING.   

References cfun, function::decl, is_complex_reg(), ssa_default_def(), and VARYING.

Referenced by tree_lower_complex().

static bool is_complex_reg ( )
static
Determine if LHS is something for which we're interested in seeing
   simulation results.   

References is_gimple_reg().

Referenced by init_dont_simulate_again(), init_parameter_lattice_values(), and update_phi_components().

gimple_opt_pass* make_pass_lower_complex ( )
gimple_opt_pass* make_pass_lower_complex_O0 ( )
static gimple_seq set_component_ssa_name ( )
static
static int some_nonzerop ( )
static
Return true if T is not a zero constant.  In the case of real values,
   we're only interested in +0.0.   

References dconst0, fixed_zerop(), and integer_zerop().

Referenced by find_lattice_value_parts().

static void update_complex_components ( gimple_stmt_iterator gsi,
gimple  stmt,
tree  r,
tree  i 
)
static
Update the complex components of the ssa name on the lhs of STMT.   

References gimple_get_lhs(), GSI_CONTINUE_LINKING, gsi_insert_seq_after(), and set_component_ssa_name().

Referenced by expand_complex_libcall(), expand_complex_move(), and update_complex_assignment().

static void update_complex_components_on_edge ( )
static
static void update_parameter_components ( )
static
Generate code at the entry point of the function to initialize the
   component variables for a complex parameter.   

References cfun, function::decl, is_gimple_reg(), single_succ_edge(), ssa_default_def(), and update_complex_components_on_edge().

Referenced by tree_lower_complex().

static void update_phi_components ( )
static
Generate code to set the component variables of a complex variable
   to match the PHI statements in block BB.   

References comp, create_phi_node(), extract_component(), get_component_ssa_name(), gimple_phi_arg_def(), gimple_phi_num_args(), gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_start_phis(), gsi_stmt(), and is_complex_reg().

Referenced by tree_lower_complex().


Variable Documentation

vec<complex_lattice_t> complex_lattice_values
static
vec<tree> complex_ssa_name_components
static
For each complex SSA_NAME, a pair of ssa names for the components.   
int_tree_htab_type complex_variable_components
static
For each complex variable, a pair of variables for the components exists in
   the hashtable.