[llvm-commits] [llvm] r155090 - in /llvm/trunk: include/llvm/CodeGen/MachinePassRegistry.h include/llvm/CodeGen/MachineScheduler.h lib/CodeGen/MachinePassRegistry.cpp
Andrew Trick
atrick at apple.com
Wed Apr 18 18:34:10 PDT 2012
Author: atrick
Date: Wed Apr 18 20:34:10 2012
New Revision: 155090
URL: http://llvm.org/viewvc/llvm-project?rev=155090&view=rev
Log:
Allow targets to select the default scheduler by name.
Modified:
llvm/trunk/include/llvm/CodeGen/MachinePassRegistry.h
llvm/trunk/include/llvm/CodeGen/MachineScheduler.h
llvm/trunk/lib/CodeGen/MachinePassRegistry.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachinePassRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachinePassRegistry.h?rev=155090&r1=155089&r2=155090&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachinePassRegistry.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachinePassRegistry.h Wed Apr 18 20:34:10 2012
@@ -99,6 +99,7 @@
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.
Modified: llvm/trunk/include/llvm/CodeGen/MachineScheduler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineScheduler.h?rev=155090&r1=155089&r2=155090&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineScheduler.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineScheduler.h Wed Apr 18 20:34:10 2012
@@ -81,6 +81,9 @@
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);
}
Modified: llvm/trunk/lib/CodeGen/MachinePassRegistry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachinePassRegistry.cpp?rev=155090&r1=155089&r2=155090&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachinePassRegistry.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachinePassRegistry.cpp Wed Apr 18 20:34:10 2012
@@ -18,6 +18,19 @@
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) {
More information about the llvm-commits
mailing list