blob: 90a61f8bb9cbfdb0ddcbd42467f254c60762b5f4 (
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
|
/********************* */
/*! \file abstract_values.cpp
** \verbatim
** Top contributors (to current version):
** Andrew Reynolds, Morgan Deters
** This file is part of the CVC4 project.
** Copyright (c) 2009-2021 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 Utility for constructing and maintaining abstract values.
**/
#include "smt/abstract_values.h"
#include "options/smt_options.h"
namespace CVC4 {
namespace smt {
AbstractValues::AbstractValues(NodeManager* nm)
: d_nm(nm),
d_fakeContext(),
d_abstractValueMap(&d_fakeContext),
d_abstractValues()
{
}
AbstractValues::~AbstractValues() {}
Node AbstractValues::substituteAbstractValues(TNode n)
{
// We need to do this even if options::abstractValues() is off,
// since the setting might have changed after we already gave out
// some abstract values.
return d_abstractValueMap.apply(n);
}
Node AbstractValues::mkAbstractValue(TNode n)
{
Assert(options::abstractValues());
Node& val = d_abstractValues[n];
if (val.isNull())
{
val = d_nm->mkAbstractValue(n.getType());
d_abstractValueMap.addSubstitution(val, n);
}
// We are supposed to ascribe types to all abstract values that go out.
Node ascription = d_nm->mkConst(AscriptionType(n.getType()));
Node retval = d_nm->mkNode(kind::APPLY_TYPE_ASCRIPTION, ascription, val);
return retval;
}
} // namespace smt
} // namespace CVC4
|