+
+ return ret;
+}
+
+/* Set a value for a complex component of SSA_NAME, return a
+ gimple_seq of stuff that needs doing. */
+
+static gimple_seq
+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;
+ gimple last;
+ gimple_seq list;
+
+ /* 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)
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name))
+ {
+ 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);
+ }
+
+ VEC_replace (tree, complex_ssa_name_components, ssa_name_index, value);
+ return NULL;
+ }
+
+ /* Finally, we need to stabilize the result by installing the value into
+ a new ssa name. */
+ else
+ comp = get_component_ssa_name (ssa_name, imag_p);
+
+ /* Do all the work to assign VALUE to COMP. */
+ list = NULL;
+ value = force_gimple_operand (value, &list, false, NULL);
+ last = gimple_build_assign (comp, value);
+ gimple_seq_add_stmt (&list, last);
+ gcc_assert (SSA_NAME_DEF_STMT (comp) == last);
+
+ return list;