Allow targets to select the default scheduler by name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155090 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick 2012-04-19 01:34:10 +00:00
parent 27745c19a9
commit fc728fbdc2
3 changed files with 17 additions and 0 deletions

View File

@ -99,6 +99,7 @@ public:
MachinePassRegistryNode *getList() { return List; }
MachinePassCtor getDefault() { return Default; }
void setDefault(MachinePassCtor C) { Default = C; }
void setDefault(StringRef Name);
void setListener(MachinePassRegistryListener *L) { Listener = L; }
/// Add - Adds a function pass to the registration list.

View File

@ -81,6 +81,9 @@ public:
static void setDefault(ScheduleDAGCtor C) {
Registry.setDefault((MachinePassCtor)C);
}
static void setDefault(StringRef Name) {
Registry.setDefault(Name);
}
static void setListener(MachinePassRegistryListener *L) {
Registry.setListener(L);
}

View File

@ -18,6 +18,19 @@ using namespace llvm;
void MachinePassRegistryListener::anchor() { }
/// setDefault - Set the default constructor by name.
void MachinePassRegistry::setDefault(StringRef Name) {
MachinePassCtor Ctor = 0;
for(MachinePassRegistryNode *R = getList(); R; R = R->getNext()) {
if (R->getName() == Name) {
Ctor = R->getCtor();
break;
}
}
assert(Ctor && "Unregistered pass name");
setDefault(Ctor);
}
/// Add - Adds a function pass to the registration list.
///
void MachinePassRegistry::Add(MachinePassRegistryNode *Node) {