Commit 51ece3d7 authored by Robert Ricci's avatar Robert Ricci
Browse files

Merge branch 'assign-randomize-pclass'

parents 973cb882 885f36c0
......@@ -115,6 +115,9 @@ bool dynamic_pclasses = false;
// Whether or not to allow assign to temporarily over-subscribe pnodes
bool allow_overload = false;
// Whether or not to allow assign to temporarily over-subscribe pnodes
bool randomize_order = false;
// Forces assign to do greedy link assignment, by chosing the first link in its
// list, which is usually the lowest-cost
bool greedy_link_assignment = false;
......@@ -467,6 +470,7 @@ void print_help() {
#endif
cout << " -F - Apply additional checking to fixed nodes" << endl;
cout << " -D - Dump configuration options" << endl;
cout << " -R - Randomize order of nodes in pclasses" << endl;
cout << " cparams - You probably don't want to touch these!" << endl;
cout << " If you must, see config.h in the source for a list"
<< endl;
......@@ -870,9 +874,9 @@ int main(int argc,char **argv) {
char* ptopFileFormat;
char* vtopFileFormat;
char* delims = "/";
char* flags = "s:v:l:t:rpPTdH:oguc:nx:y:W:FDf:";
char* flags = "s:v:l:t:rpPTdH:oguc:nx:y:W:FDf:R";
#else
char* flags = "s:v:l:t:rpPTdH:oguc:nx:y:FD";
char* flags = "s:v:l:t:rpPTdH:oguc:nx:y:FDR";
#endif
while ((ch = getopt(argc,argv,flags)) != -1) {
......@@ -1016,6 +1020,9 @@ int main(int argc,char **argv) {
break;
#endif
case 'R':
randomize_order = true;
break;
default:
print_help();
......@@ -1118,7 +1125,7 @@ int main(int argc,char **argv) {
timestart = used_time();
cout << "Generating physical equivalence classes:";
generate_pclasses(PG,disable_pclasses,dynamic_pclasses);
generate_pclasses(PG,disable_pclasses,dynamic_pclasses,randomize_order);
cout << pclasses.size() << endl;
#ifdef PCLASS_DEBUG
......
......@@ -213,7 +213,7 @@ int pclass_equiv(tb_pgraph &pg, tb_pnode *a,tb_pnode *b)
physical type to list of classes that can satisfy that type) are
set by this routine. */
int generate_pclasses(tb_pgraph &pg, bool pclass_for_each_pnode,
bool dynamic_pclasses) {
bool dynamic_pclasses, bool randomize_order) {
typedef hash_map<tb_pclass*,tb_pnode*,hashptr<tb_pclass*> > pclass_pnode_map;
typedef hash_map<fstring,pclass_list*> name_pclass_list_map;
......@@ -222,8 +222,25 @@ int generate_pclasses(tb_pgraph &pg, bool pclass_for_each_pnode,
pvertex_iterator vit,vendit;
tie(vit,vendit) = vertices(pg);
/*
* Create a vector that we'll use for iterating through the nodes - it's
* a seperate structure so that we can randomize the order if desired.
* Argh, can't use STL copy since pg is not an STL structure
*/
typedef vector<pvertex> pvertex_vector;
pvertex_vector pvertexes;
for (;vit != vendit;++vit) {
cur = *vit;
pvertexes.push_back(*vit);
}
if (randomize_order) {
random_shuffle(pvertexes.begin(), pvertexes.end());
}
pvertex_vector::iterator pvit;
for (pvit = pvertexes.begin();pvit != pvertexes.end();++pvit) {
cur = *pvit;
bool found_class = 0;
tb_pnode *curP = get(pvertex_pmap,cur);
tb_pclass *curclass;
......
......@@ -123,7 +123,7 @@ typedef hash_map<fstring,tt_entry> pclass_types;
// each physical node should get its own pclass (effectively disabling
// pclasses)
int generate_pclasses(tb_pgraph &PG, bool pclass_for_each_pnode,
bool dynamic_pclasses);
bool dynamic_pclasses, bool randomize_order);
/* The following two routines sets and remove mappings in pclass
datastructures */
......
Supports Markdown
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