GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass.cpp Lines: 25 25 100.0 %
Date: 2021-09-29 Branches: 50 88 56.8 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Justin Xu, Abdalrhman Mohamed, Andres Noetzli
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * The preprocessing pass super class.
14
 */
15
16
#include "preprocessing/preprocessing_pass.h"
17
18
#include "preprocessing/assertion_pipeline.h"
19
#include "preprocessing/preprocessing_pass_context.h"
20
#include "printer/printer.h"
21
#include "smt/dump.h"
22
#include "smt/env.h"
23
#include "smt/output_manager.h"
24
#include "smt/smt_engine_scope.h"
25
#include "smt/smt_statistics_registry.h"
26
#include "util/statistics_stats.h"
27
28
namespace cvc5 {
29
namespace preprocessing {
30
31
75644
PreprocessingPassResult PreprocessingPass::apply(
32
    AssertionPipeline* assertionsToPreprocess) {
33
151288
  TimerStat::CodeTimer codeTimer(d_timer);
34
75644
  Trace("preprocessing") << "PRE " << d_name << std::endl;
35
75644
  Chat() << d_name << "..." << std::endl;
36
75644
  dumpAssertions(("pre-" + d_name).c_str(), *assertionsToPreprocess);
37
75644
  PreprocessingPassResult result = applyInternal(assertionsToPreprocess);
38
75634
  dumpAssertions(("post-" + d_name).c_str(), *assertionsToPreprocess);
39
75634
  Trace("preprocessing") << "POST " << d_name << std::endl;
40
151268
  return result;
41
}
42
43
151278
void PreprocessingPass::dumpAssertions(const char* key,
44
                                       const AssertionPipeline& assertionList) {
45
151278
  if (Dump.isOn("assertions") && Dump.isOn(std::string("assertions:") + key))
46
  {
47
    // Push the simplified assertions to the dump output stream
48
1
    Env& env = d_preprocContext->getEnv();
49
1
    const Printer& printer = env.getPrinter();
50
1
    std::ostream& out = env.getDumpOut();
51
52
5
    for (const auto& n : assertionList)
53
    {
54
4
      printer.toStreamCmdAssert(out, n);
55
    }
56
  }
57
151278
}
58
59
213294
PreprocessingPass::PreprocessingPass(PreprocessingPassContext* preprocContext,
60
213294
                                     const std::string& name)
61
    : EnvObj(preprocContext->getEnv()),
62
      d_preprocContext(preprocContext),
63
      d_name(name),
64
213294
      d_timer(statisticsRegistry().registerTimer("preprocessing::" + name))
65
{
66
213294
}
67
68
426384
PreprocessingPass::~PreprocessingPass() {
69
213192
  Assert(smt::smtEngineInScope());
70
213192
}
71
72
}  // namespace preprocessing
73
22746
}  // namespace cvc5