GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass.cpp Lines: 25 25 100.0 %
Date: 2021-09-15 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
117528
PreprocessingPassResult PreprocessingPass::apply(
32
    AssertionPipeline* assertionsToPreprocess) {
33
235056
  TimerStat::CodeTimer codeTimer(d_timer);
34
117528
  Trace("preprocessing") << "PRE " << d_name << std::endl;
35
117528
  Chat() << d_name << "..." << std::endl;
36
117528
  dumpAssertions(("pre-" + d_name).c_str(), *assertionsToPreprocess);
37
117528
  PreprocessingPassResult result = applyInternal(assertionsToPreprocess);
38
117518
  dumpAssertions(("post-" + d_name).c_str(), *assertionsToPreprocess);
39
117518
  Trace("preprocessing") << "POST " << d_name << std::endl;
40
235036
  return result;
41
}
42
43
235046
void PreprocessingPass::dumpAssertions(const char* key,
44
                                       const AssertionPipeline& assertionList) {
45
235046
  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
235046
}
58
59
338108
PreprocessingPass::PreprocessingPass(PreprocessingPassContext* preprocContext,
60
338108
                                     const std::string& name)
61
    : EnvObj(preprocContext->getEnv()),
62
      d_preprocContext(preprocContext),
63
      d_name(name),
64
338108
      d_timer(statisticsRegistry().registerTimer("preprocessing::" + name))
65
{
66
338108
}
67
68
676012
PreprocessingPass::~PreprocessingPass() {
69
338006
  Assert(smt::smtEngineInScope());
70
338006
}
71
72
}  // namespace preprocessing
73
29577
}  // namespace cvc5