]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
rose: make assignGroupsToRoles a free function
authorJustin Viiret <justin.viiret@intel.com>
Thu, 2 Jun 2016 03:52:29 +0000 (13:52 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Fri, 8 Jul 2016 00:47:08 +0000 (10:47 +1000)
src/rose/rose_build_compile.cpp
src/rose/rose_build_groups.cpp
src/rose/rose_build_groups.h
src/rose/rose_build_impl.h

index dca7310cc0cc4ba4715f92b33848a215d21cf9a4..b86058de4a54b7392740fb14ce7baa1be93e68c0 100644 (file)
@@ -1661,7 +1661,7 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
     findMoreLiteralMasks(*this);
 
     assignGroupsToLiterals();
-    assignGroupsToRoles();
+    assignGroupsToRoles(*this);
     findGroupSquashers(*this);
 
     /* final prep work */
index 5467e1abea26a29d33c76fcc0bc51e1f75d4a909..fd96fbd668fa6f34fa0f27a39e72b45c58bf7c48 100644 (file)
@@ -363,20 +363,23 @@ rose_group RoseBuildImpl::getSuccGroups(RoseVertex start) const {
  * The groups that a role sets are determined by the union of its successor
  * literals. Requires the literals already have had groups assigned.
  */
-void RoseBuildImpl::assignGroupsToRoles() {
+void assignGroupsToRoles(RoseBuildImpl &build) {
+    auto &g = build.g;
+
     /* Note: if there is a succ literal in the sidematcher, its successors
      * literals must be added instead */
     for (auto v : vertices_range(g)) {
-        if (isAnyStart(v)) {
+        if (build.isAnyStart(v)) {
             continue;
         }
 
-        const rose_group succ_groups = getSuccGroups(v);
+        const rose_group succ_groups = build.getSuccGroups(v);
         g[v].groups |= succ_groups;
 
-        if (ghost.find(v) != ghost.end()) {
+        auto ghost_it = build.ghost.find(v);
+        if (ghost_it != end(build.ghost)) {
             /* delayed roles need to supply their groups to the ghost role */
-            g[ghost[v]].groups |= succ_groups;
+            g[ghost_it->second].groups |= succ_groups;
         }
 
         DEBUG_PRINTF("vertex %zu: groups=%llx\n", g[v].idx, g[v].groups);
index f24a11c3953c01cfa2aafe3572c3a0bc34acd323..6719fbeadd8ac2ec0c5283258bfadf79e8c02256 100644 (file)
@@ -44,6 +44,8 @@ getVertexGroupMap(const RoseBuildImpl &build);
 
 rose_group getSquashableGroups(const RoseBuildImpl &build);
 
+void assignGroupsToRoles(RoseBuildImpl &build);
+
 void findGroupSquashers(RoseBuildImpl &build);
 
 } // namespace ue2
index d5f75a2236c4450376ed7ca383afc953a95c22b8..b1d7ac36615c1746132ba31f3bd012ac1b8557ea 100644 (file)
@@ -439,10 +439,6 @@ public:
     // Find the maximum bound on the edges to this vertex's successors.
     u32 calcSuccMaxBound(RoseVertex u) const;
 
-    // Assign roles to groups, writing the groups bitset into each role in the
-    // graph.
-    void assignGroupsToRoles();
-
     /* Returns the ID of the given literal in the literal map, adding it if
      * necessary. */
     u32 getLiteralId(const ue2_literal &s, u32 delay, rose_literal_table table);