8#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE__ARENA_H
9#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE__ARENA_H
14#include "llvm/ADT/StringRef.h"
34 template <
typename T,
typename... Args>
35 std::enable_if_t<std::is_base_of<StorageLocation, T>::value,
T &>
41 Locs.emplace_back(std::make_unique<T>(std::forward<Args>(args)...))
50 template <
typename T,
typename... Args>
51 std::enable_if_t<std::is_base_of<Value, T>::value,
T &>
57 Vals.emplace_back(std::make_unique<T>(std::forward<Args>(args)...))
127 llvm::BumpPtrAllocator Alloc;
130 std::vector<std::unique_ptr<StorageLocation>> Locs;
131 std::vector<std::unique_ptr<Value>> Vals;
135 llvm::DenseMap<llvm::APInt, IntegerValue *> IntegerLiterals;
136 using FormulaPair = std::pair<const Formula *, const Formula *>;
137 llvm::DenseMap<FormulaPair, const Formula *> Ands;
138 llvm::DenseMap<FormulaPair, const Formula *> Ors;
139 llvm::DenseMap<const Formula *, const Formula *> Nots;
140 llvm::DenseMap<FormulaPair, const Formula *> Implies;
141 llvm::DenseMap<FormulaPair, const Formula *> Equals;
142 llvm::DenseMap<Atom, const Formula *> AtomRefs;
144 llvm::DenseMap<const Formula *, BoolValue *> FormulaValues;
145 unsigned NextAtom = 0;
The Arena owns the objects that model data within an analysis.
const Formula & makeEquals(const Formula &LHS, const Formula &RHS)
Returns a formula for LHS <=> RHS.
const Formula & makeAtomRef(Atom A)
Returns a formula for the variable A.
Atom makeAtom()
Returns a new atomic boolean variable, distinct from any other.
IntegerValue & makeIntLiteral(llvm::APInt Value)
Returns a symbolic integer value that models an integer literal equal to Value.
const Formula & makeNot(const Formula &Val)
Returns a formula for the negation of Val.
std::enable_if_t< std::is_base_of< Value, T >::value, T & > create(Args &&...args)
Creates a T (some subclass of Value), forwarding args to the constructor, and returns a reference to ...
Atom makeFlowConditionToken()
Creates a fresh flow condition and returns a token that identifies it.
TopBoolValue & makeTopValue()
Creates a fresh Top boolean value.
const Formula & makeOr(const Formula &LHS, const Formula &RHS)
Returns a formula for the disjunction of LHS and RHS.
BoolValue & makeBoolValue(const Formula &)
Creates a BoolValue wrapping a particular formula.
const Formula & makeAnd(const Formula &LHS, const Formula &RHS)
Returns a formula for the conjunction of LHS and RHS.
AtomicBoolValue & makeAtomValue()
Creates a fresh atom and wraps in in an AtomicBoolValue.
const Formula & makeImplies(const Formula &LHS, const Formula &RHS)
Returns a formula for LHS => RHS.
Arena(const Arena &)=delete
const Formula & makeLiteral(bool Value)
Returns a formula for a literal true/false.
llvm::Expected< const Formula & > parseFormula(llvm::StringRef)
std::enable_if_t< std::is_base_of< StorageLocation, T >::value, T & > create(Args &&...args)
Creates a T (some subclass of StorageLocation), forwarding args to the constructor,...
Arena & operator=(const Arena &)=delete
Models an atomic boolean.
A TopBoolValue represents a boolean that is explicitly unconstrained.
Base class for all values computed by abstract interpretation.
Dataflow Directional Tag Classes.
Atom
Identifies an atomic boolean variable such as "V1".
uint32_t Literal
Literals are represented as positive integers.
const FunctionProtoType * T