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