blob: a50cd2541e0c9f8ba2e02bfcc6ae876015270593 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/********************* */
/*! \file preprocessing_pass_registry.cpp
** \verbatim
** Top contributors (to current version):
** Justin Xu, Yoni Zohar
** This file is part of the CVC4 project.
** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
** in the top-level source directory) and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
**
** \brief The preprocessing pass registry
**
** This file defines the classes PreprocessingPassRegistry, which keeps track
** of the available preprocessing passes, and RegisterPass, which registers a
** preprocessing pass with the registry.
**/
#include "preprocessing/preprocessing_pass_registry.h"
#include <algorithm>
#include <utility>
#include "base/cvc4_assert.h"
#include "base/output.h"
#include "preprocessing/preprocessing_pass.h"
namespace CVC4 {
namespace preprocessing {
PreprocessingPassRegistry& PreprocessingPassRegistry::getInstance()
{
static PreprocessingPassRegistry* ppReg = new PreprocessingPassRegistry();
return *ppReg;
}
void PreprocessingPassRegistry::registerPassInfo(
const std::string& name,
std::function<PreprocessingPass*(PreprocessingPassContext*)> ctor)
{
d_ppInfo[name] = ctor;
}
PreprocessingPass* PreprocessingPassRegistry::createPass(
PreprocessingPassContext* ppCtx, const std::string& name)
{
return d_ppInfo[name](ppCtx);
}
std::vector<std::string> PreprocessingPassRegistry::getAvailablePasses()
{
std::vector<std::string> passes;
for (const auto& info : d_ppInfo)
{
passes.push_back(info.first);
}
std::sort(passes.begin(), passes.end());
return passes;
}
bool PreprocessingPassRegistry::hasPass(const std::string& name)
{
return d_ppInfo.find(name) != d_ppInfo.end();
}
} // namespace preprocessing
} // namespace CVC4
|