bugpoint: (* keep *) to (* bugpoint_keep *); also apply to modules/cells
authorEddie Hung <eddie@fpgeh.com>
Fri, 24 Apr 2020 20:26:04 +0000 (13:26 -0700)
committerEddie Hung <eddie@fpgeh.com>
Fri, 24 Apr 2020 20:26:04 +0000 (13:26 -0700)
kernel/constids.inc
passes/cmds/bugpoint.cc

index 68a5782fde8ef8390e7ab95e1508a9f5556460d9..2d8b8f79161adcf4696f35d53fac4574df358540 100644 (file)
@@ -29,6 +29,7 @@ X(B)
 X(BI)
 X(blackbox)
 X(B_SIGNED)
+X(bugpoint_keep)
 X(B_WIDTH)
 X(C)
 X(cells_not_processed)
index 2bdd551af7f7d6abd9ca14f49c1da538dc8713ca..0e9bd9dc32a94442796969857157e5dc8b3e93cf 100644 (file)
@@ -63,14 +63,16 @@ struct BugpointPass : public Pass {
                log("will be considered.\n");
                log("\n");
                log("    -modules\n");
-               log("        try to remove modules.\n");
+               log("        try to remove modules. modules with a (* bugpoint_keep *) attribute\n");
+               log("        will be skipped.\n");
                log("\n");
                log("    -ports\n");
-               log("        try to remove module ports. ports with a (* keep *) attribute will be\n");
-               log("        skipped (useful for clocks, resets, etc.)\n");
+               log("        try to remove module ports. ports with a (* bugpoint_keep *) attribute\n");
+               log("        will be skipped (useful for clocks, resets, etc.)\n");
                log("\n");
                log("    -cells\n");
-               log("        try to remove cells.\n");
+               log("        try to remove cells. cells with a (* bugpoint_keep *) attribute will\n");
+               log("        be skipped.\n");
                log("\n");
                log("    -connections\n");
                log("        try to reconnect ports to 'x.\n");
@@ -142,6 +144,9 @@ struct BugpointPass : public Pass {
                                if (module->get_blackbox_attribute())
                                        continue;
 
+                               if (module->get_bool_attribute(ID::bugpoint_keep))
+                                   continue;
+
                                if (index++ == seed)
                                {
                                        log("Trying to remove module %s.\n", module->name.c_str());
@@ -169,7 +174,7 @@ struct BugpointPass : public Pass {
                                        if (!stage2 && wire->get_bool_attribute(ID($bugpoint)))
                                                continue;
 
-                                       if (wire->get_bool_attribute(ID::keep))
+                                       if (wire->get_bool_attribute(ID::bugpoint_keep))
                                                continue;
 
                                        if (index++ == seed)
@@ -189,9 +194,13 @@ struct BugpointPass : public Pass {
                                if (mod->get_blackbox_attribute())
                                        continue;
 
+
                                Cell *removed_cell = nullptr;
                                for (auto cell : mod->cells())
                                {
+                                       if (cell->get_bool_attribute(ID::bugpoint_keep))
+                                               continue;
+
                                        if (index++ == seed)
                                        {
                                                log("Trying to remove cell %s.%s.\n", mod->name.c_str(), cell->name.c_str());