+static tree
+get_component_ssa_name (tree ssa_name, bool imag_p)
+{
+ complex_lattice_t lattice = find_lattice_value (ssa_name);
+ size_t ssa_name_index;
+ tree ret;
+
+ if (lattice == (imag_p ? ONLY_REAL : ONLY_IMAG))
+ {
+ tree inner_type = TREE_TYPE (TREE_TYPE (ssa_name));
+ if (SCALAR_FLOAT_TYPE_P (inner_type))
+ return build_real (inner_type, dconst0);
+ else
+ return build_int_cst (inner_type, 0);
+ }
+
+ ssa_name_index = SSA_NAME_VERSION (ssa_name) * 2 + imag_p;
+ ret = VEC_index (tree, complex_ssa_name_components, ssa_name_index);
+ if (ret == NULL)
+ {
+ ret = get_component_var (SSA_NAME_VAR (ssa_name), imag_p);
+ ret = make_ssa_name (ret, NULL);
+
+ /* Copy some properties from the original. In particular, whether it
+ is used in an abnormal phi, and whether it's uninitialized. */
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret)
+ = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name);
+ if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL
+ && IS_EMPTY_STMT (SSA_NAME_DEF_STMT (ssa_name)))
+ {
+ SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name);
+ set_default_def (SSA_NAME_VAR (ret), ret);
+ }
+
+ VEC_replace (tree, complex_ssa_name_components, ssa_name_index, ret);
+ }
+
+ return ret;
+}
+
+/* Set a value for a complex component of SSA_NAME, return a STMT_LIST of
+ stuff that needs doing. */
+
+static tree
+set_component_ssa_name (tree ssa_name, bool imag_p, tree value)
+{
+ complex_lattice_t lattice = find_lattice_value (ssa_name);
+ size_t ssa_name_index;
+ tree comp, list, last;
+
+ /* We know the value must be zero, else there's a bug in our lattice
+ analysis. But the value may well be a variable known to contain
+ zero. We should be safe ignoring it. */
+ if (lattice == (imag_p ? ONLY_REAL : ONLY_IMAG))
+ return NULL;
+
+ /* If we've already assigned an SSA_NAME to this component, then this
+ means that our walk of the basic blocks found a use before the set.
+ This is fine. Now we should create an initialization for the value
+ we created earlier. */
+ ssa_name_index = SSA_NAME_VERSION (ssa_name) * 2 + imag_p;
+ comp = VEC_index (tree, complex_ssa_name_components, ssa_name_index);
+ if (comp)
+ ;
+
+ /* If we've nothing assigned, and the value we're given is already stable,
+ then install that as the value for this SSA_NAME. This preemptively
+ copy-propagates the value, which avoids unnecessary memory allocation. */
+ else if (is_gimple_min_invariant (value))
+ {
+ VEC_replace (tree, complex_ssa_name_components, ssa_name_index, value);
+ return NULL;
+ }
+ else if (TREE_CODE (value) == SSA_NAME
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name))
+ {
+ /* Replace an anonymous base value with the variable from cvc_lookup.
+ This should result in better debug info. */
+ if (DECL_IGNORED_P (SSA_NAME_VAR (value))
+ && !DECL_IGNORED_P (SSA_NAME_VAR (ssa_name)))
+ {
+ comp = get_component_var (SSA_NAME_VAR (ssa_name), imag_p);
+ replace_ssa_name_symbol (value, comp);