Lines Matching refs:elt

397 can_completely_scalarize_p (struct sra_elt *elt)
401 if (elt->cannot_scalarize)
404 for (c = elt->children; c; c = c->sibling)
408 for (c = elt->groups; c; c = c->sibling)
535 struct sra_elt *elt;
547 elt = *slot;
548 if (!elt && insert == INSERT)
550 *slot = elt = obstack_alloc (&sra_obstack, sizeof (*elt));
551 memset (elt, 0, sizeof (*elt));
553 elt->parent = parent;
554 elt->element = child;
555 elt->type = type;
556 elt->is_scalar = is_sra_scalar_type (type);
560 if (IS_ELEMENT_FOR_GROUP (elt->element))
562 elt->is_group = true;
563 elt->sibling = parent->groups;
564 parent->groups = elt;
568 elt->sibling = parent->children;
569 parent->children = elt;
577 elt->n_copies = 1;
582 return elt;
591 struct sra_elt *elt;
641 elt = maybe_lookup_element_for_expr (TREE_OPERAND (expr, 0));
642 if (elt)
643 return lookup_element (elt, child, TREE_TYPE (expr), INSERT);
662 void (*use) (struct sra_elt *elt, tree *expr_p,
671 void (*init) (struct sra_elt *elt, tree value, block_stmt_iterator *bsi);
676 void (*ldst) (struct sra_elt *elt, tree other,
734 struct sra_elt *elt = maybe_lookup_element_for_expr (expr);
736 elt->cannot_scalarize = true;
738 fns->use (elt, expr_p, bsi, is_output, use_all_p);
1040 scan_use (struct sra_elt *elt, tree *expr_p ATTRIBUTE_UNUSED,
1044 elt->n_uses += 1;
1063 scan_ldst (struct sra_elt *elt, tree other ATTRIBUTE_UNUSED,
1067 elt->n_copies += 1;
1073 scan_dump (struct sra_elt *elt)
1077 dump_sra_elt_name (dump_file, elt);
1078 fprintf (dump_file, ": n_uses=%u n_copies=%u\n", elt->n_uses, elt->n_copies);
1080 for (c = elt->children; c ; c = c->sibling)
1083 for (c = elt->groups; c ; c = c->sibling)
1108 struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
1109 if (elt)
1110 scan_dump (elt);
1124 build_element_name_1 (struct sra_elt *elt)
1129 if (elt->parent)
1131 build_element_name_1 (elt->parent);
1134 if (TREE_CODE (elt->parent->type) == COMPLEX_TYPE)
1136 if (elt->element == integer_zero_node)
1144 t = elt->element;
1169 build_element_name (struct sra_elt *elt)
1171 build_element_name_1 (elt);
1179 instantiate_element (struct sra_elt *elt)
1184 for (base_elt = elt; base_elt->parent; base_elt = base_elt->parent)
1188 elt->replacement = var = make_rename_temp (elt->type, "SR");
1192 if (TREE_THIS_VOLATILE (elt->type))
1200 char *pretty_name = build_element_name (elt);
1204 SET_DECL_DEBUG_EXPR (var, generate_element_ref (elt));
1220 dump_sra_elt_name (dump_file, elt);
1234 decide_instantiation_1 (struct sra_elt *elt, unsigned int parent_uses,
1237 if (dump_file && !elt->parent)
1240 dump_sra_elt_name (dump_file, elt);
1244 if (elt->cannot_scalarize)
1247 if (elt->is_scalar)
1251 if (elt->n_uses + elt->n_copies + parent_copies > parent_uses)
1252 instantiate_element (elt);
1257 unsigned int this_uses = elt->n_uses + parent_uses;
1258 unsigned int this_copies = elt->n_copies + parent_copies;
1262 for (group = elt->groups; group ; group = group->sibling)
1269 for (c = elt->children; c ; c = c->sibling)
1279 sum_instantiated_sizes (struct sra_elt *elt, unsigned HOST_WIDE_INT *sizep)
1281 if (elt->replacement)
1283 *sizep += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (elt->type));
1291 for (c = elt->children; c ; c = c->sibling)
1301 static void instantiate_missing_elements (struct sra_elt *elt);
1304 instantiate_missing_elements_1 (struct sra_elt *elt, tree child, tree type)
1306 struct sra_elt *sub = lookup_element (elt, child, type, INSERT);
1317 instantiate_missing_elements (struct sra_elt *elt)
1319 tree type = elt->type;
1339 elt->element,
1343 instantiate_missing_elements_1 (elt, f, field_type);
1358 instantiate_missing_elements_1 (elt, i, subtype);
1369 instantiate_missing_elements_1 (elt, integer_zero_node, type);
1370 instantiate_missing_elements_1 (elt, integer_one_node, type);
1383 decide_block_copy (struct sra_elt *elt)
1390 gcc_assert (!elt->is_group);
1393 if (elt->cannot_scalarize)
1395 elt->use_block_copy = 1;
1400 dump_sra_elt_name (dump_file, elt);
1405 for (c = elt->children; c; c = c->sibling)
1412 for (c = elt->groups; c; c = c->sibling)
1422 if (elt->n_uses == 0 && elt->n_copies == 0)
1425 else if (!elt->is_scalar)
1427 tree size_tree = TYPE_SIZE_UNIT (elt->type);
1432 if (TREE_CODE (elt->type) == COMPLEX_TYPE)
1454 full_count = count_type_elements (elt->type, false);
1455 inst_count = sum_instantiated_sizes (elt, &inst_size);
1466 && elt->n_copies > elt->n_uses)
1475 && (!can_completely_scalarize_p (elt)
1476 || !type_can_instantiate_all_elements (elt->type)))
1480 elt->use_block_copy = use_block_copy;
1483 for (c = elt->groups; c; c = c->sibling)
1490 dump_sra_elt_name (dump_file, elt);
1496 instantiate_missing_elements (elt);
1501 any_inst = elt->replacement != NULL;
1503 for (c = elt->children; c ; c = c->sibling)
1527 struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
1528 if (elt)
1530 decide_instantiation_1 (elt, 0, 0);
1531 if (!decide_block_copy (elt))
1532 elt = NULL;
1534 if (!elt)
1600 mark_no_warning (struct sra_elt *elt)
1602 if (!elt->all_no_warning)
1604 if (elt->replacement)
1605 TREE_NO_WARNING (elt->replacement) = 1;
1609 FOR_EACH_ACTUAL_CHILD (c, elt)
1612 elt->all_no_warning = true;
1619 generate_one_element_ref (struct sra_elt *elt, tree base)
1625 tree field = elt->element;
1631 return build3 (COMPONENT_REF, elt->type, base, field, NULL);
1636 if (TREE_CODE (elt->element) == RANGE_EXPR)
1637 return build4 (ARRAY_RANGE_REF, elt->type, base,
1638 TREE_OPERAND (elt->element, 0), NULL, NULL);
1640 return build4 (ARRAY_REF, elt->type, base, elt->element, NULL, NULL);
1643 if (elt->element == integer_zero_node)
1644 return build1 (REALPART_EXPR, elt->type, base);
1646 return build1 (IMAGPART_EXPR, elt->type, base);
1656 generate_element_ref (struct sra_elt *elt)
1658 if (elt->parent)
1659 return generate_one_element_ref (elt, generate_element_ref (elt->parent));
1661 return elt->element;
1678 generate_copy_inout (struct sra_elt *elt, bool copy_out, tree expr,
1689 c = lookup_element (elt, integer_zero_node, NULL, NO_INSERT);
1691 c = lookup_element (elt, integer_one_node, NULL, NO_INSERT);
1694 t = build2 (COMPLEX_EXPR, elt->type, r, i);
1699 else if (elt->replacement)
1702 t = sra_build_assignment (elt->replacement, expr);
1704 t = sra_build_assignment (expr, elt->replacement);
1709 FOR_EACH_ACTUAL_CHILD (c, elt)
1750 generate_element_zero (struct sra_elt *elt, tree *list_p)
1754 if (elt->visited)
1756 elt->visited = false;
1760 FOR_EACH_ACTUAL_CHILD (c, elt)
1763 if (elt->replacement)
1767 gcc_assert (elt->is_scalar);
1768 t = fold_convert (elt->type, integer_zero_node);
1770 t = sra_build_assignment (elt->replacement, t);
1793 generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
1807 if (elt->is_scalar)
1809 if (elt->replacement)
1811 generate_one_element_init (elt->replacement, init, list_p);
1812 elt->visited = true;
1821 FOR_EACH_ACTUAL_CHILD (sub, elt)
1843 sub = lookup_element (elt, lower, NULL, NO_INSERT);
1854 sub = lookup_element (elt, purpose, NULL, NO_INSERT);
1862 elt->visited = true;
1873 generate_element_init (struct sra_elt *elt, tree init, tree *list_p)
1878 ret = generate_element_init_1 (elt, init, list_p);
1965 if elt is scalar, or some occurrence of ELT that requires a complete
1969 scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
1974 if (elt->replacement)
1980 *expr_p = elt->replacement;
1998 generate_copy_inout (elt, is_output, generate_element_ref (elt), &list);
2008 mark_no_warning (elt);
2164 scalarize_ldst (struct sra_elt *elt, tree other,
2168 gcc_assert (!elt->replacement);
2170 if (elt->use_block_copy)
2174 scalarize_use (elt, NULL, bsi, is_output, false);
2185 generate_copy_inout (elt, is_output, other, &list);
2237 struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
2238 generate_copy_inout (elt, true, var, &list);
2267 dump_sra_elt_name (FILE *f, struct sra_elt *elt)
2269 if (elt->parent && TREE_CODE (elt->parent->type) == COMPLEX_TYPE)
2271 fputs (elt->element == integer_zero_node ? "__real__ " : "__imag__ ", f);
2272 dump_sra_elt_name (f, elt->parent);
2276 if (elt->parent)
2277 dump_sra_elt_name (f, elt->parent);
2278 if (DECL_P (elt->element))
2280 if (TREE_CODE (elt->element) == FIELD_DECL)
2282 print_generic_expr (f, elt->element, dump_flags);
2284 else if (TREE_CODE (elt->element) == RANGE_EXPR)
2286 TREE_INT_CST_LOW (TREE_OPERAND (elt->element, 0)),
2287 TREE_INT_CST_LOW (TREE_OPERAND (elt->element, 1)));
2290 TREE_INT_CST_LOW (elt->element));
2297 debug_sra_elt_name (struct sra_elt *elt)
2299 dump_sra_elt_name (stderr, elt);