Enzyme main
Loading...
Searching...
No Matches
ConcreteType Class Reference

Concrete SubType of a given value. More...

#include "TypeAnalysis/ConcreteType.h"

Collaboration diagram for ConcreteType:

Public Member Functions

 ConcreteType (llvm::Type *SubType)
 Construct a ConcreteType from an existing FloatingPoint Type.
 
 ConcreteType (BaseType SubTypeEnum)
 Construct a non-floating Concrete type from a BaseType.
 
 ConcreteType (llvm::StringRef Str, llvm::LLVMContext &C)
 Construct a ConcreteType from a string A Concrete Type's string representation is given by the string of the enum If it is a floating point it is given by Float<specific_type>
 
std::string str () const
 Convert the ConcreteType to a string.
 
bool isKnown () const
 Whether this ConcreteType has information (is not unknown)
 
bool isIntegral () const
 Whether this ConcreteType must an integer.
 
bool isPossiblePointer () const
 Whether this ConcreteType could be a pointer (SubTypeEnum is unknown or a pointer)
 
bool isPossibleFloat () const
 Whether this ConcreteType could be a float (SubTypeEnum is unknown or a float)
 
llvm::Type * isFloat () const
 Return the floating point type, if this is a float.
 
bool operator== (const BaseType BT) const
 Return if this is known to be the BaseType BT This cannot be called with BaseType::Float as it lacks information.
 
bool operator!= (const BaseType BT) const
 Return if this is known not to be the BaseType BT This cannot be called with BaseType::Float as it lacks information.
 
bool operator== (const ConcreteType CT) const
 Return if this is known to be the ConcreteType CT.
 
bool operator!= (const ConcreteType CT) const
 Return if this is known not to be the ConcreteType CT.
 
bool operator= (const ConcreteType CT)
 Set this to the given ConcreteType, returning true if this ConcreteType has changed.
 
bool operator= (const BaseType BT)
 Set this to the given BaseType, returning true if this ConcreteType has changed.
 
bool checkedOrIn (const ConcreteType CT, bool PointerIntSame, bool &LegalOr)
 Set this to the logical or of itself and CT, returning whether this value changed Setting PointerIntSame considers pointers and integers as equivalent If this is an illegal operation, LegalOr will be set to false.
 
bool orIn (const ConcreteType CT, bool PointerIntSame)
 Set this to the logical or of itself and CT, returning whether this value changed Setting PointerIntSame considers pointers and integers as equivalent This function will error if doing an illegal Operation.
 
bool operator|= (const ConcreteType CT)
 Set this to the logical or of itself and CT, returning whether this value changed This assumes that pointers and integers are distinct This function will error if doing an illegal Operation.
 
bool andIn (const ConcreteType CT)
 Set this to the logical and of itself and CT, returning whether this value changed If this and CT are incompatible, the result will be BaseType::Unknown.
 
bool operator&= (const ConcreteType CT)
 Set this to the logical and of itself and CT, returning whether this value changed If this and CT are incompatible, the result will be BaseType::Unknown.
 
ConcreteType PurgeAnything () const
 Keep only mappings where the type is not an Anything
 
bool binopIn (bool &Legal, const ConcreteType RHS, llvm::BinaryOperator::BinaryOps Op)
 Set this to the logical binop of itself and RHS, using the Binop Op, returning true if this was changed.
 
bool operator< (const ConcreteType dt) const
 Compare concrete types for use in map's.
 

Public Attributes

BaseType SubTypeEnum
 Category of underlying type.
 
llvm::Type * SubType
 Floating point type, if relevant, otherwise nullptr.
 

Detailed Description

Concrete SubType of a given value.

Consists of a category BaseType and the particular floating point value, if relevant.

Definition at line 41 of file ConcreteType.h.

Constructor & Destructor Documentation

◆ ConcreteType() [1/3]

ConcreteType::ConcreteType ( llvm::Type * SubType)
inline

Construct a ConcreteType from an existing FloatingPoint Type.

Definition at line 49 of file ConcreteType.h.

References SubType.

Referenced by operator=().

◆ ConcreteType() [2/3]

ConcreteType::ConcreteType ( BaseType SubTypeEnum)
inline

Construct a non-floating Concrete type from a BaseType.

Definition at line 60 of file ConcreteType.h.

References Float, and SubTypeEnum.

◆ ConcreteType() [3/3]

ConcreteType::ConcreteType ( llvm::StringRef Str,
llvm::LLVMContext & C )
inline

Construct a ConcreteType from a string A Concrete Type's string representation is given by the string of the enum If it is a floating point it is given by Float<specific_type>

Definition at line 68 of file ConcreteType.h.

References Float, parseBaseType(), SubType, and SubTypeEnum.

Member Function Documentation

◆ andIn()

bool ConcreteType::andIn ( const ConcreteType CT)
inline

Set this to the logical and of itself and CT, returning whether this value changed If this and CT are incompatible, the result will be BaseType::Unknown.

Definition at line 261 of file ConcreteType.h.

References Anything, SubType, SubTypeEnum, and Unknown.

Referenced by operator&=().

◆ binopIn()

bool ConcreteType::binopIn ( bool & Legal,
const ConcreteType RHS,
llvm::BinaryOperator::BinaryOps Op )
inline

Set this to the logical binop of itself and RHS, using the Binop Op, returning true if this was changed.

This function will error on an invalid type combination

Definition at line 299 of file ConcreteType.h.

References Anything, Integer, isFloat(), Pointer, SubType, SubTypeEnum, and Unknown.

Referenced by TypeTree::binopIn().

◆ checkedOrIn()

bool ConcreteType::checkedOrIn ( const ConcreteType CT,
bool PointerIntSame,
bool & LegalOr )
inline

Set this to the logical or of itself and CT, returning whether this value changed Setting PointerIntSame considers pointers and integers as equivalent If this is an illegal operation, LegalOr will be set to false.

Definition at line 202 of file ConcreteType.h.

References Anything, Integer, Pointer, SubType, SubTypeEnum, and Unknown.

Referenced by TypeTree::checkedOrIn(), and orIn().

◆ isFloat()

llvm::Type * ConcreteType::isFloat ( ) const
inline

Return the floating point type, if this is a float.

Definition at line 145 of file ConcreteType.h.

References SubType.

Referenced by binopIn(), ewrap(), and getOrInsertOpFloatSum().

◆ isIntegral()

bool ConcreteType::isIntegral ( ) const
inline

Whether this ConcreteType must an integer.

Definition at line 126 of file ConcreteType.h.

References Integer, and SubTypeEnum.

Referenced by mlir::enzyme::ActivityAnalyzer::isConstantValue().

◆ isKnown()

bool ConcreteType::isKnown ( ) const
inline

Whether this ConcreteType has information (is not unknown)

Definition at line 123 of file ConcreteType.h.

References SubTypeEnum, and Unknown.

Referenced by writesToMemoryReadBy().

◆ isPossibleFloat()

bool ConcreteType::isPossibleFloat ( ) const
inline

Whether this ConcreteType could be a float (SubTypeEnum is unknown or a float)

Definition at line 138 of file ConcreteType.h.

References Anything, Float, SubTypeEnum, and Unknown.

◆ isPossiblePointer()

bool ConcreteType::isPossiblePointer ( ) const
inline

Whether this ConcreteType could be a pointer (SubTypeEnum is unknown or a pointer)

Definition at line 130 of file ConcreteType.h.

References Anything, Pointer, SubTypeEnum, and Unknown.

◆ operator!=() [1/2]

bool ConcreteType::operator!= ( const BaseType BT) const
inline

Return if this is known not to be the BaseType BT This cannot be called with BaseType::Float as it lacks information.

Definition at line 161 of file ConcreteType.h.

References Float, and SubTypeEnum.

◆ operator!=() [2/2]

bool ConcreteType::operator!= ( const ConcreteType CT) const
inline

Return if this is known not to be the ConcreteType CT.

Definition at line 177 of file ConcreteType.h.

◆ operator&=()

bool ConcreteType::operator&= ( const ConcreteType CT)
inline

Set this to the logical and of itself and CT, returning whether this value changed If this and CT are incompatible, the result will be BaseType::Unknown.

Definition at line 287 of file ConcreteType.h.

References andIn().

◆ operator<()

bool ConcreteType::operator< ( const ConcreteType dt) const
inline

Compare concrete types for use in map's.

Definition at line 506 of file ConcreteType.h.

References SubType, and SubTypeEnum.

◆ operator=() [1/2]

bool ConcreteType::operator= ( const BaseType BT)
inline

Set this to the given BaseType, returning true if this ConcreteType has changed.

Definition at line 194 of file ConcreteType.h.

References ConcreteType(), Float, and operator=().

◆ operator=() [2/2]

bool ConcreteType::operator= ( const ConcreteType CT)
inline

Set this to the given ConcreteType, returning true if this ConcreteType has changed.

Definition at line 181 of file ConcreteType.h.

References SubType, and SubTypeEnum.

Referenced by operator=().

◆ operator==() [1/2]

bool ConcreteType::operator== ( const BaseType BT) const
inline

Return if this is known to be the BaseType BT This cannot be called with BaseType::Float as it lacks information.

Definition at line 149 of file ConcreteType.h.

References Float, and SubTypeEnum.

◆ operator==() [2/2]

bool ConcreteType::operator== ( const ConcreteType CT) const
inline

Return if this is known to be the ConcreteType CT.

Definition at line 172 of file ConcreteType.h.

References SubType, and SubTypeEnum.

◆ operator|=()

bool ConcreteType::operator|= ( const ConcreteType CT)
inline

Set this to the logical or of itself and CT, returning whether this value changed This assumes that pointers and integers are distinct This function will error if doing an illegal Operation.

Definition at line 254 of file ConcreteType.h.

References orIn().

◆ orIn()

bool ConcreteType::orIn ( const ConcreteType CT,
bool PointerIntSame )
inline

Set this to the logical or of itself and CT, returning whether this value changed Setting PointerIntSame considers pointers and integers as equivalent This function will error if doing an illegal Operation.

Definition at line 239 of file ConcreteType.h.

References checkedOrIn(), and str().

Referenced by operator|=(), and TypeTree::ShiftIndices().

◆ PurgeAnything()

ConcreteType ConcreteType::PurgeAnything ( ) const
inline

Keep only mappings where the type is not an Anything

Definition at line 290 of file ConcreteType.h.

References Anything, SubTypeEnum, and Unknown.

Referenced by TypeAnalyzer::visitCmpInst().

◆ str()

std::string ConcreteType::str ( ) const
inline

Member Data Documentation

◆ SubType

llvm::Type* ConcreteType::SubType

Floating point type, if relevant, otherwise nullptr.

Definition at line 46 of file ConcreteType.h.

Referenced by andIn(), binopIn(), checkedOrIn(), ConcreteType(), ConcreteType(), isFloat(), operator<(), operator=(), operator==(), and str().

◆ SubTypeEnum


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