blob: cd94a013205141897bf9ffecc676f035c693cf5f [file] [log] [blame]
Mikhail Glushenkovc82ce4a2008-09-22 20:49:34 +00001//===--- Plugin.cpp - The LLVM Compiler Driver ------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open
6// Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Plugin support for llvmc2.
11//
12//===----------------------------------------------------------------------===//
13
Mikhail Glushenkov4a1a77c2008-09-22 20:50:40 +000014#include "llvm/CompilerDriver/Plugin.h"
Mikhail Glushenkovc82ce4a2008-09-22 20:49:34 +000015
16#include <vector>
17
18namespace {
19 typedef std::vector<llvmc::BasePlugin*> PluginRegistry;
20 static PluginRegistry GlobalPluginRegistry;
21}
22
23namespace llvmc {
24
25 RegisterPluginImpl::RegisterPluginImpl(BasePlugin* plugin) {
26 GlobalPluginRegistry.push_back(plugin);
27 }
28
29 void PopulateLanguageMap(LanguageMap& langMap) {
30 for (PluginRegistry::const_iterator B = GlobalPluginRegistry.begin(),
31 E = GlobalPluginRegistry.end(); B != E; ++B)
32 (*B)->PopulateLanguageMap(langMap);
33 }
34
35 void PopulateCompilationGraph(CompilationGraph& graph) {
36 for (PluginRegistry::const_iterator B = GlobalPluginRegistry.begin(),
37 E = GlobalPluginRegistry.end(); B != E; ++B)
38 (*B)->PopulateCompilationGraph(graph);
39 }
40
41}