summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvmc2/Plugin.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:49:34 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:49:34 +0000
commit47afe730810cc5e21f13e1914c45ba1184967102 (patch)
treecc85c36b063176f27d488dca497594415fb0c991 /llvm/tools/llvmc2/Plugin.cpp
parent6f1db3df746f973c65cb090c64d8761bb1a41a35 (diff)
downloadbcm5719-llvm-47afe730810cc5e21f13e1914c45ba1184967102.tar.gz
bcm5719-llvm-47afe730810cc5e21f13e1914c45ba1184967102.zip
Plugin support for llvmc2 (a-la opt).
llvm-svn: 56465
Diffstat (limited to 'llvm/tools/llvmc2/Plugin.cpp')
-rw-r--r--llvm/tools/llvmc2/Plugin.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/tools/llvmc2/Plugin.cpp b/llvm/tools/llvmc2/Plugin.cpp
new file mode 100644
index 00000000000..70d99878ba9
--- /dev/null
+++ b/llvm/tools/llvmc2/Plugin.cpp
@@ -0,0 +1,41 @@
+//===--- Plugin.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open
+// Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Plugin support for llvmc2.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Plugin.h"
+
+#include <vector>
+
+namespace {
+ typedef std::vector<llvmc::BasePlugin*> PluginRegistry;
+ static PluginRegistry GlobalPluginRegistry;
+}
+
+namespace llvmc {
+
+ RegisterPluginImpl::RegisterPluginImpl(BasePlugin* plugin) {
+ GlobalPluginRegistry.push_back(plugin);
+ }
+
+ void PopulateLanguageMap(LanguageMap& langMap) {
+ for (PluginRegistry::const_iterator B = GlobalPluginRegistry.begin(),
+ E = GlobalPluginRegistry.end(); B != E; ++B)
+ (*B)->PopulateLanguageMap(langMap);
+ }
+
+ void PopulateCompilationGraph(CompilationGraph& graph) {
+ for (PluginRegistry::const_iterator B = GlobalPluginRegistry.begin(),
+ E = GlobalPluginRegistry.end(); B != E; ++B)
+ (*B)->PopulateCompilationGraph(graph);
+ }
+
+}
OpenPOWER on IntegriCloud