This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug objc/24867] New: many N^2 loops in objc frontend


The objc front-end contains many loops that are N^2.  For example, most uses of
chainon should be changed to either build the list backwards are reverse it
(both for straight-line code and for loops).  Some trivial examples from
objc-act.c:

---
  for (t = TYPE_NEXT_VARIANT (s); t; t = TYPE_NEXT_VARIANT (t))
    objc_info = chainon (objc_info, build_tree_list (NULL_TREE, TYPE_OBJC_INFO
(t)));
--- 

---
  /* SEL *refs; */
  field_decl = create_field_decl (build_pointer_type (objc_selector_type),
"refs");
  chainon (field_decl_chain, field_decl);

  /* short cls_def_cnt; */
  field_decl = create_field_decl (short_integer_type_node, "cls_def_cnt");
  chainon (field_decl_chain, field_decl);

  /* short cat_def_cnt; */
  field_decl = create_field_decl (short_integer_type_node, "cat_def_cnt");
  chainon (field_decl_chain, field_decl);
---

---
    for (j = 1; j < i; j++)  {
      sprintf (buffer, "c%d", j + 1);
      field_decl = create_field_decl (char_type_node,
                      buffer);
      chainon (field_decl_chain, field_decl);
    }
---

-Chris


-- 
           Summary: many N^2 loops in objc frontend
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sabre at nondot dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24867


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]