llir-opt  0.0.1
Low-Level Post-Link Optimiser for OCaml and C
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SymbolicValue Class Referencefinal

#include <passes/pre_eval/symbolic_value.h>

Public Types

enum  Kind {
  Kind::UNDEFINED, Kind::SCALAR, Kind::INTEGER, Kind::LOWER_BOUNDED_INTEGER,
  Kind::MASKED_INTEGER, Kind::FLOAT, Kind::POINTER, Kind::NULLABLE,
  Kind::VALUE
}
 Enumeration of value kinds. More...
 
using Origin = std::pair< ID< SymbolicFrame >, Ref< Inst > >
 Instruction which originated the value.
 

Public Member Functions

 SymbolicValue ()
 Undefined constructor.
 
 SymbolicValue (const SymbolicValue &that)
 Copy constructor.
 
 ~SymbolicValue ()
 Cleanup.
 
SymbolicValueoperator= (const SymbolicValue &that)
 Copy assignment operator.
 
Kind GetKind () const
 
bool IsInteger () const
 
bool IsScalar () const
 
bool IsLowerBoundedInteger () const
 
bool IsMaskedInteger () const
 
bool IsFloat () const
 
bool IsPointer () const
 
bool IsValue () const
 
bool IsNullable () const
 
bool IsPointerLike () const
 
bool IsIntegerLike () const
 
APInt GetInteger () const
 
APInt GetMaskKnown () const
 
APInt GetMaskValue () const
 
APFloat GetFloat () const
 
const SymbolicPointer::Ref & GetPointer () const
 
const SymbolicPointerAsPointer () const
 
std::optional< APInt > AsInt () const
 
SymbolicValue Pin (Ref< Inst > ref, ID< SymbolicFrame > frame) const
 Pin the value to a different instruction.
 
bool IsTrue () const
 Checks whether the value evaluates to true.
 
bool IsFalse () const
 Checks whether the value evaluates to false.
 
std::optional< OriginGetOrigin () const
 Return the origin, if there is one.
 
SymbolicValue Cast (Type type) const
 Cast the value to a specific type.
 
void Merge (const SymbolicValue &that)
 Merges a value into this one.
 
SymbolicValue LUB (const SymbolicValue &that) const
 Computes the least-upper-bound.
 
bool operator== (const SymbolicValue &that) const
 Compares two values for equality.
 
bool operator!= (const SymbolicValue &that) const
 
void dump (llvm::raw_ostream &os) const
 Dump the textual representation to a stream.
 

Static Public Member Functions

static SymbolicValue Scalar (const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue Undefined (const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue Float (const APFloat &val, const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue Integer (const APInt &val, const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue LowerBoundedInteger (const APInt &bound, const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue Mask (const APInt &known, const APInt &value, const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue Pointer (const SymbolicPointer::Ref &pointer, const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue Value (const SymbolicPointer::Ref &pointer, const std::optional< Origin > &orig=std::nullopt)
 
static SymbolicValue Nullable (const SymbolicPointer::Ref &pointer, const std::optional< Origin > &orig=std::nullopt)
 

Detailed Description

Representation for a symbolic value.

Member Enumeration Documentation

◆ Kind

enum SymbolicValue::Kind
strong

Enumeration of value kinds.

Enumerator
UNDEFINED 

A undefined value.

SCALAR 

A integer of an unknown value.

INTEGER 

A specific integer.

LOWER_BOUNDED_INTEGER 

An unknown integer with a lower bound.

MASKED_INTEGER 

An integer with some known bits.

FLOAT 

Floating-point value.

POINTER 

A pointer or a range of pointers.

NULLABLE 

A pointer or null.

VALUE 

Value - unknown integer or pointer.


The documentation for this class was generated from the following files: