CIRCT 21.0.0git
|
#include <DNF.h>
Public Types | |
using | OrTerms = SmallVector< OrTerm, 1 > |
Public Member Functions | |
DNF () | |
Construct a null DNF. | |
DNF (bool value) | |
Construct a constant true or false . | |
DNF (Value value) | |
Construct a DNF with a single opaque Value . | |
DNF (AndTerm value) | |
Construct a DNF with a given AND term inside a single OR term. | |
DNF (OrTerm value) | |
Construct a DNF with a given OR term. | |
DNF (OrTerms terms) | |
Construct a DNF with a multiple OR terms. The terms must be sorted. | |
bool | isNull () const |
Check whether this DNF is null. | |
operator bool () const | |
bool | isFalse () const |
Check whether this DNF is trivially false. | |
bool | isTrue () const |
Check whether this DNF is trivially true. | |
std::optional< std::pair< Value, AndTerm::Use > > | getSingleTerm () const |
If this DNF consists of a single term, return it. | |
bool | contains (const OrTerm &orTerm) const |
Check if this DNF contains a specific OR term. | |
bool | contains (const AndTerm &andTerm) const |
Check if this DNF contains a specific AND term. | |
int | compare (const DNF &other) const |
Compare against another DNF. | |
bool | operator== (const DNF &other) const |
bool | operator!= (const DNF &other) const |
bool | operator< (const DNF &other) const |
bool | operator> (const DNF &other) const |
bool | operator>= (const DNF &other) const |
bool | operator<= (const DNF &other) const |
DNF | operator| (const DNF &other) const |
Compute the boolean OR of this and another DNF. | |
DNF | operator& (const DNF &other) const |
Compute the boolean AND of this and another DNF. | |
DNF | operator^ (const DNF &other) const |
Compute the boolean XOR of this and another DNF. | |
DNF | operator~ () const |
Compute the boolean NOT of this DNF. | |
DNF & | operator|= (const DNF &other) |
DNF & | operator&= (const DNF &other) |
DNF & | operator^= (const DNF &other) |
DNF & | negate () |
bool | isSortedAndUnique () const |
Check that all terms in the DNF are sorted. | |
void | optimize () |
Removes redundant terms as follows: | |
std::optional< bool > | evaluate (llvm::function_ref< std::optional< bool >(Value, bool)> evaluateTerm) |
Try to evaluate this DNF to a constant true or false value. | |
void | print (llvm::raw_ostream &os, llvm::function_ref< void(Value)> printValue={}) const |
Print this DNF to os , using the given callback to print the value. | |
void | printWithValues (llvm::raw_ostream &os) const |
Print this DNF to os , followed by a list of the concrete values used. | |
Static Public Member Functions | |
static DNF | withPastValue (Value value) |
Construct a DNF with a single opaque past Value . | |
Public Attributes | |
OrTerms | orTerms |
using circt::llhd::DNF::OrTerms = SmallVector<OrTerm, 1> |
|
inline |
Construct a null DNF.
Definition at line 204 of file DNF.h.
Referenced by operator&(), operator^(), operator|(), operator~(), and withPastValue().
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
Construct a DNF with a multiple OR terms. The terms must be sorted.
Definition at line 217 of file DNF.h.
References assert(), and isSortedAndUnique().
int DNF::compare | ( | const DNF & | other | ) | const |
Compare against another DNF.
Definition at line 336 of file DNF.cpp.
Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
bool DNF::contains | ( | const AndTerm & | andTerm | ) | const |
bool DNF::contains | ( | const OrTerm & | orTerm | ) | const |
std::optional< bool > DNF::evaluate | ( | llvm::function_ref< std::optional< bool >(Value, bool)> | evaluateTerm | ) |
|
inline |
|
inline |
Check whether this DNF is trivially false.
Definition at line 229 of file DNF.h.
References orTerms.
Referenced by operator&(), operator^(), operator|(), operator~(), and print().
|
inline |
Check whether this DNF is null.
Definition at line 222 of file DNF.h.
References circt::llhd::AndTerm::Id, and orTerms.
Referenced by getSingleTerm(), operator bool(), operator&(), operator^(), operator|(), operator~(), and print().
bool DNF::isSortedAndUnique | ( | ) | const |
|
inline |
Check whether this DNF is trivially true.
Definition at line 231 of file DNF.h.
References orTerms.
Referenced by operator&(), operator^(), operator|(), operator~(), and print().
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
DNF DNF::operator~ | ( | ) | const |
void DNF::optimize | ( | ) |
Removes redundant terms as follows:
Definition at line 359 of file DNF.cpp.
References circt::llhd::AndTerm::Id, circt::llhd::AndTerm::NotId, circt::llhd::AndTerm::NotPast, orTerms, and circt::llhd::AndTerm::Past.
void DNF::print | ( | llvm::raw_ostream & | os, |
llvm::function_ref< void(Value)> | printValue = {} |
||
) | const |
void DNF::printWithValues | ( | llvm::raw_ostream & | os | ) | const |
Print this DNF to os
, followed by a list of the concrete values used.
Definition at line 495 of file DNF.cpp.
References print().
Referenced by circt::llhd::operator<<().
|
inlinestatic |
Construct a DNF with a single opaque past Value
.
Definition at line 219 of file DNF.h.
References DNF(), and circt::llhd::AndTerm::past().
OrTerms circt::llhd::DNF::orTerms |
Definition at line 201 of file DNF.h.
Referenced by contains(), contains(), DNF(), DNF(), evaluate(), getSingleTerm(), isFalse(), isNull(), isSortedAndUnique(), isTrue(), operator&(), operator|(), operator~(), optimize(), and print().