ROSE  0.10.0.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Rose::BinaryAnalysis::SymbolicExpr::Type Class Reference

Description

Type of symbolic expression.

Definition at line 225 of file BinarySymbolicExpr.h.

#include <BinarySymbolicExpr.h>

Public Types

enum  TypeClass {
  INTEGER,
  FP,
  MEMORY,
  INVALID
}
 Type class. More...
 

Public Member Functions

 Type ()
 Create an invalid, empty type. More...
 
bool isValid () const
 Check whether this object is valid. More...
 
TypeClass typeClass () const
 Property: Type class. More...
 
size_t nBits () const
 Property: Total width of values. More...
 
size_t addressWidth () const
 Property: Width of memory addresses. More...
 
size_t exponentWidth () const
 Property: Exponent width. More...
 
size_t significandWidth () const
 Property: Significand width. More...
 
bool operator< (const Type &other) const
 Type comparison. More...
 
void print (std::ostream &, TypeStyle::Flag style=TypeStyle::FULL) const
 Print the type. More...
 
std::string toString (TypeStyle::Flag style=TypeStyle::FULL) const
 Print the type to a string. More...
 
bool operator== (const Type &other) const
 Type equality. More...
 
bool operator!= (const Type &other) const
 Type equality. More...
 

Static Public Member Functions

static Type none ()
 Create no type. More...
 
static Type integer (size_t nBits)
 Create a new integer type. More...
 
static Type memory (size_t addressWidth, size_t valueWidth)
 Create a new memory type. More...
 
static Type floatingPoint (size_t exponentWidth, size_t significandWidth)
 Create a new floating-point type. More...
 

Member Enumeration Documentation

Type class.

Enumerator
INTEGER 

Integer type.

FP 

Floating-point type.

MEMORY 

Memory type.

INVALID 

Default constructed.

Definition at line 228 of file BinarySymbolicExpr.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::SymbolicExpr::Type::Type ( )
inline

Create an invalid, empty type.

This is used mainly for default arguments.

Definition at line 266 of file BinarySymbolicExpr.h.

References INVALID, nBits(), and typeClass().

Referenced by floatingPoint(), integer(), memory(), and none().

Member Function Documentation

static Type Rose::BinaryAnalysis::SymbolicExpr::Type::none ( )
inlinestatic

Create no type.

This is the same as a default constructor, but somewhat more self-documenting.

Definition at line 283 of file BinarySymbolicExpr.h.

References Type().

static Type Rose::BinaryAnalysis::SymbolicExpr::Type::integer ( size_t  nBits)
inlinestatic

Create a new integer type.

This is an integer type whose size is specified in bits. Whether an integer is signed is determined by the context in which it's used. For instance, unsigned less-than operation will interpret its arguments as unsigned integers, whereas a signed less-than operation will interpret its arguments as 2's complement signed integers.

Definition at line 292 of file BinarySymbolicExpr.h.

References INTEGER, and Type().

static Type Rose::BinaryAnalysis::SymbolicExpr::Type::memory ( size_t  addressWidth,
size_t  valueWidth 
)
inlinestatic

Create a new memory type.

A memory type has an address width and a value width. The value width is the size of the value stored at each address.

Definition at line 299 of file BinarySymbolicExpr.h.

References MEMORY, and Type().

static Type Rose::BinaryAnalysis::SymbolicExpr::Type::floatingPoint ( size_t  exponentWidth,
size_t  significandWidth 
)
inlinestatic

Create a new floating-point type.

A floating point type describes an IEEE-754 style of value and is parameterized by two properties: the width of the exponent field, and the width of the significand field including the implied bit. The actual storage size of the floating point value is the sum of these two widths since although the implied bit is not stored, a sign bit is stored. Due to limitations of SMT-LIB, ROSE's symbolic layer doesn't handle all IEEE-754 floating-point types. In particular, the symbolic layer supports only binary formats and uses the implied bit convention for the integer part of the significand. Gradual underflow capability (i.e., denormalized significands) is assumed.

Definition at line 311 of file BinarySymbolicExpr.h.

References FP, and Type().

bool Rose::BinaryAnalysis::SymbolicExpr::Type::isValid ( ) const
inline

Check whether this object is valid.

A default constructed type is invalid.

Definition at line 318 of file BinarySymbolicExpr.h.

References INVALID, and typeClass().

TypeClass Rose::BinaryAnalysis::SymbolicExpr::Type::typeClass ( ) const
inline
size_t Rose::BinaryAnalysis::SymbolicExpr::Type::nBits ( ) const
inline

Property: Total width of values.

This is the total width in bits of the values represented by this type. For memory types, it's the width of the value stored at each address.

Definition at line 333 of file BinarySymbolicExpr.h.

Referenced by Rose::BinaryAnalysis::SymbolicExpr::Node::nBits(), significandWidth(), Rose::BinaryAnalysis::SymbolicExprParser::Token::Token(), and Type().

size_t Rose::BinaryAnalysis::SymbolicExpr::Type::addressWidth ( ) const
inline

Property: Width of memory addresses.

Returns the width in bits of each memory address for a memory type. This should only be invoked on types for which typeClass returns MEMORY.

Definition at line 341 of file BinarySymbolicExpr.h.

References MEMORY, and typeClass().

Referenced by Rose::BinaryAnalysis::SymbolicExpr::Node::domainWidth().

size_t Rose::BinaryAnalysis::SymbolicExpr::Type::exponentWidth ( ) const
inline

Property: Exponent width.

Returns the width in bits of the exponent for floating-point types. This should only be invoked on types for which typeClass returns FP.

Definition at line 350 of file BinarySymbolicExpr.h.

References FP, and typeClass().

Referenced by significandWidth().

size_t Rose::BinaryAnalysis::SymbolicExpr::Type::significandWidth ( ) const
inline

Property: Significand width.

Returns the logical width in bits of the significand for floating-point types, which includes the implied bit. The actual storage size of the significand is one bit fewer. This should only be invoked on types for which typeClass returns FP.

Definition at line 360 of file BinarySymbolicExpr.h.

References exponentWidth(), FP, nBits(), and typeClass().

bool Rose::BinaryAnalysis::SymbolicExpr::Type::operator== ( const Type other) const
inline

Type equality.

Types are equivalent if they have the same class and sizes.

Definition at line 371 of file BinarySymbolicExpr.h.

bool Rose::BinaryAnalysis::SymbolicExpr::Type::operator!= ( const Type other) const
inline

Type equality.

Types are equivalent if they have the same class and sizes.

Definition at line 374 of file BinarySymbolicExpr.h.

bool Rose::BinaryAnalysis::SymbolicExpr::Type::operator< ( const Type other) const

Type comparison.

void Rose::BinaryAnalysis::SymbolicExpr::Type::print ( std::ostream &  ,
TypeStyle::Flag  style = TypeStyle::FULL 
) const

Print the type.

std::string Rose::BinaryAnalysis::SymbolicExpr::Type::toString ( TypeStyle::Flag  style = TypeStyle::FULL) const

Print the type to a string.


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