std::pair<const Formula *, const Formula *>
19 autoRes = std::make_pair(&LHS, &RHS);
21std::swap(Res.first, Res.second);
25template<
classKey,
classComputeFunc>
28 auto[It, Inserted] =
Cache.try_emplace(std::forward<Key>(K));
35 return cached(AtomRefs, A, [&] {
37 static_cast<unsigned>(A));
46 returnLHS.
literal() ? &RHS : &LHS;
48 returnRHS.
literal() ? &LHS : &RHS;
59 returnLHS.
literal() ? &LHS : &RHS;
61 returnRHS.
literal() ? &RHS : &LHS;
68 return cached(Nots, &Val, [&] {
79 return cached(Implies, std::make_pair(&LHS, &RHS), [&] {
105 auto[It, Inserted] = IntegerLiterals.try_emplace(
Value,
nullptr);
108It->second = &create<IntegerValue>();
113 auto[It, Inserted] = FormulaValues.try_emplace(&F);
116? (
BoolValue*)&create<AtomicBoolValue>(F)
117: &create<FormulaBoolValue>(F);
123 autoEatSpaces = [&] { In = In.ltrim(
' '); };
126 if(In.consume_front(
"!")) {
127 if(
auto*Arg = parse(A, In))
132 if(In.consume_front(
"(")) {
133 auto*Arg1 = parse(A, In);
139 if(In.consume_front(
"|"))
141 else if(In.consume_front(
"&"))
143 else if(In.consume_front(
"=>"))
145 else if(In.consume_front(
"="))
150 auto*Arg2 = parse(A, In);
155 if(!In.consume_front(
")"))
158 return&(A.*Op)(*Arg1, *Arg2);
163 if(
In.consume_front(
"V")) {
164std::underlying_type_t<Atom> At;
165 if(
In.consumeInteger(10, At))
170 if(
In.consume_front(
"true"))
172 if(
In.consume_front(
"false"))
178classFormulaParseError :
publicllvm::ErrorInfo<FormulaParseError> {
184FormulaParseError(llvm::StringRef Formula,
unsignedOffset)
185: Formula(Formula), Offset(Offset) {}
187 void log(raw_ostream &OS)
const override{
188OS <<
"bad formula at offset "<< Offset <<
"\n";
189OS << Formula <<
"\n";
190OS.indent(Offset) <<
"^";
193std::error_code convertToErrorCode()
const override{
194 returnstd::make_error_code(std::errc::invalid_argument);
198charFormulaParseError::ID = 0;
203llvm::StringRef Rest = In;
204 auto*
Result= parse(*
this, Rest);
206 returnllvm::make_error<FormulaParseError>(In, In.size() - Rest.size());
209 returnllvm::make_error<FormulaParseError>(In, In.size() - Rest.size());
TypePropertyCache< Private > Cache
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.
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.
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.
const Formula & makeImplies(const Formula &LHS, const Formula &RHS)
Returns a formula for LHS => RHS.
const Formula & makeLiteral(bool Value)
Returns a formula for a literal true/false.
llvm::Expected< const Formula & > parseFormula(llvm::StringRef)
ArrayRef< const Formula * > operands() const
@ Equal
True if LHS is false or RHS is true.
@ Implies
True if either LHS or RHS is true.
@ AtomRef
A reference to an atomic boolean variable.
@ Literal
Constant true or false.
@ Or
True if LHS and RHS are both true.
@ And
True if its only operand is false.
static const Formula & create(llvm::BumpPtrAllocator &Alloc, Kind K, ArrayRef< const Formula * > Operands, unsigned Value=0)
Base class for all values computed by abstract interpretation.
Dataflow Directional Tag Classes.
static const Formula & cached(llvm::DenseMap< Key, const Formula * > &Cache, Key K, ComputeFunc &&Compute)
Atom
Identifies an atomic boolean variable such as "V1".
static std::pair< const Formula *, const Formula * > canonicalFormulaPair(const Formula &LHS, const Formula &RHS)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ Result
The result type of a method or function.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4