aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvmc2/Plugin.cpp
blob: 70d99878ba934458badaca110b8e6a83f31233fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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);
  }

}