diff options
author | Andrew Trick <atrick@apple.com> | 2012-04-19 01:34:10 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-04-19 01:34:10 +0000 |
commit | fc728fbdc2631ce8f343cf9b7292d218fde7419f (patch) | |
tree | fa897863d259ef63d5a40d1ade8161c5d454c32c /lib | |
parent | 27745c19a957f1298cc2c56e6dabea5ef244a1c8 (diff) | |
download | external_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.cpp | 13 |
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) { |