aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-04-19 01:34:10 +0000
committerAndrew Trick <atrick@apple.com>2012-04-19 01:34:10 +0000
commitfc728fbdc2631ce8f343cf9b7292d218fde7419f (patch)
treefa897863d259ef63d5a40d1ade8161c5d454c32c /lib
parent27745c19a957f1298cc2c56e6dabea5ef244a1c8 (diff)
downloadexternal_llvm-fc728fbdc2631ce8f343cf9b7292d218fde7419f.zip
external_llvm-fc728fbdc2631ce8f343cf9b7292d218fde7419f.tar.gz
external_llvm-fc728fbdc2631ce8f343cf9b7292d218fde7419f.tar.bz2
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
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/MachinePassRegistry.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/CodeGen/MachinePassRegistry.cpp b/lib/CodeGen/MachinePassRegistry.cpp
index 58e067b..cb204fd 100644
--- a/lib/CodeGen/MachinePassRegistry.cpp
+++ b/lib/CodeGen/MachinePassRegistry.cpp
@@ -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) {