Commit bd844542 authored by Robert Ricci's avatar Robert Ricci

Add a new call to tb_vclass, empty(), which tells you if no nodes

are using this class.

Skip the vclass precheck for any pclasses that no one is actually
using.
parent 64f6a368
......@@ -380,6 +380,19 @@ int type_precheck() {
// Check the vclasses, too
for (name_list_map::iterator vclass_it = vclasses.begin();
vclass_it != vclasses.end(); ++vclass_it) {
// Make sure we actually use this vclass
name_vclass_map::iterator dit = vclass_map.find(vclass_it->first);
if (dit == vclass_map.end()) {
cout << "***: Internal error - unable to find vtype " <<
vclass_it->first << endl;
exit(EXIT_FATAL);
} else {
if (dit->second->empty()) {
// Nobody uses it, don't check
continue;
}
}
bool found_match = false;
for (vector<crope>::iterator vtype_it = vclass_it->second.begin();
vtype_it != vclass_it->second.end(); vtype_it++) {
......
......@@ -62,9 +62,10 @@ int bind_top_subnodes() {
return errors;
}
extern name_vclass_map vclass_map;
int parse_top(tb_vgraph &VG, istream& i)
{
name_vclass_map vclass_map;
string_vector parsed_line;
int errors=0,line=0;
int num_nodes = 0;
......
......@@ -22,6 +22,8 @@ using namespace boost;
#include "physical.h"
#include "virtual.h"
name_vclass_map vclass_map;
void tb_vclass::add_type(crope type)
{
members[type]=0;
......@@ -94,3 +96,12 @@ crope tb_vclass::choose_type()
return (*dit).first;
}
bool tb_vclass::empty() {
members_map::iterator dit;
for (dit=members.begin();dit != members.end();++dit) {
if ((*dit).second > 0) {
return false;
}
}
return true;
}
......@@ -53,6 +53,8 @@ public:
crope dominant; // Current dominant type
bool empty(); // True if no vnodes use this vlcass
// The next two routines report the *change* in score. The score
// for the vclass as a whole is 0 if all nodes are of the dominant
// type and the weight if they aren't.
......@@ -77,5 +79,6 @@ public:
};
typedef hash_map<crope,tb_vclass*> name_vclass_map;
extern name_vclass_map vclass_map;
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment