#include <Type.h>
Public Types | |
enum | ContainmentResult { Is_Contained, Not_Contained, Maybe_Contained } |
Public Member Functions | |
virtual IdentifierInfo * | getIdInfo () const =0 |
Returns the defining identifier for this type. | |
virtual void | getUpperLimit (llvm::APInt &res) const =0 |
virtual void | getLowerLimit (llvm::APInt &res) const =0 |
virtual uint64_t | getSize () const =0 |
uint64_t | length () const |
ContainmentResult | contains (const DiscreteType *target) const |
ContainmentResult | contains (const llvm::APInt &value) const |
Returns a ContainmentResult for the given integer value. | |
bool | isSigned () const |
bool | isStaticallyConstrained () const |
Returns true if this type is constrained and the constraints are static. | |
bool | isDynamicallyConstrained () const |
virtual PosAD * | getPosAttribute ()=0 |
virtual ValAD * | getValAttribute ()=0 |
const DiscreteType * | getRootType () const |
Specialization of PrimaryType::getRootType(). | |
DiscreteType * | getRootType () |
Specialization of PrimaryType::getRootType(). | |
virtual Range * | getConstraint ()=0 |
virtual const Range * | getConstraint () const =0 |
Specialization of PrimaryType::getRootType(). | |
Static Public Member Functions | |
static bool | classof (const DiscreteType *node) |
Support isa and dyn_cast. | |
static bool | classof (const Ast *node) |
Protected Member Functions | |
DiscreteType (AstKind kind, DiscreteType *rootOrParent, bool subtype) | |
Static Protected Member Functions | |
static unsigned | getPreferredSize (uint64_t bits) |
The DiscreteType class forms a common base for integer and enumeration types.
Definition at line 599 of file Type.h.
comma::DiscreteType::DiscreteType | ( | AstKind | kind, | |
DiscreteType * | rootOrParent, | |||
bool | subtype | |||
) | [inline, protected] |
static bool comma::DiscreteType::classof | ( | const Ast * | node | ) | [inline, static] |
Reimplemented from comma::PrimaryType.
Reimplemented in comma::EnumerationType, and comma::IntegerType.
static bool comma::DiscreteType::classof | ( | const DiscreteType * | node | ) | [inline, static] |
Support isa and dyn_cast.
Reimplemented from comma::PrimaryType.
Reimplemented in comma::EnumerationType, and comma::IntegerType.
DiscreteType::ContainmentResult DiscreteType::contains | ( | const llvm::APInt & | value | ) | const |
DiscreteType::ContainmentResult DiscreteType::contains | ( | const DiscreteType * | target | ) | const |
Returns a ContainmentResult indicating if this DiscreteType contains another.
This type and the target type must be of the same category. That is, both must be integer, enumeration, or (when implemented) modular types.
Containment is with respect to the bounds on the types. If a type is constrained, then the constraint is used for the bounds, otherwise the representational limits of the root type are used.
If this type is constrained to a null range it can never contain the target, including other null types (with the only exception being that all types trivially contain themselves). If this type is not constrained to a null range, then it always contains a target type that is.
If this type has a non-static constraint, this method always returns Maby_Contained. If the target has a non-static constraint but the bounds for this type are known, containment is known only if this type contains the root type of the target.
virtual const Range* comma::DiscreteType::getConstraint | ( | ) | const [pure virtual] |
Specialization of PrimaryType::getRootType().
Implemented in comma::EnumerationType, and comma::IntegerType.
virtual Range* comma::DiscreteType::getConstraint | ( | ) | [pure virtual] |
Returns the constraint associated with this DiscreteType or null if this type is unconstrained.
Implemented in comma::EnumerationType, and comma::IntegerType.
virtual IdentifierInfo* comma::DiscreteType::getIdInfo | ( | ) | const [pure virtual] |
Returns the defining identifier for this type.
virtual void comma::DiscreteType::getLowerLimit | ( | llvm::APInt & | res | ) | const [pure virtual] |
Returns the lower limit for this type.
The lower limit is the smallest value which can be represented by the underlying root type. Note that this is not a bound as expressed via a subtype constraint.
Implemented in comma::EnumerationType, and comma::IntegerType.
virtual PosAD* comma::DiscreteType::getPosAttribute | ( | ) | [pure virtual] |
Returns the declaration corresponding to the Pos attribute for this type.
Implemented in comma::EnumerationType, and comma::IntegerType.
unsigned DiscreteType::getPreferredSize | ( | uint64_t | bits | ) | [static, protected] |
DiscreteType* comma::DiscreteType::getRootType | ( | ) | [inline] |
Specialization of PrimaryType::getRootType().
Reimplemented from comma::PrimaryType.
Reimplemented in comma::EnumerationType, and comma::IntegerType.
const DiscreteType* comma::DiscreteType::getRootType | ( | ) | const [inline] |
Specialization of PrimaryType::getRootType().
Reimplemented from comma::PrimaryType.
Reimplemented in comma::EnumerationType, and comma::IntegerType.
virtual uint64_t comma::DiscreteType::getSize | ( | ) | const [pure virtual] |
Returns the number of bits needed to represent this type.
The value returned by this method is equivalent to Size attribute. The number returned specifies the minimum number of bits needed to represent values of this type, as opposed to the number of bits used to represent values of this type at runtime.
Implemented in comma::EnumerationType, and comma::IntegerType.
virtual void comma::DiscreteType::getUpperLimit | ( | llvm::APInt & | res | ) | const [pure virtual] |
Returns the upper limit for this type.
The upper limit is the greatest value which can be represented by the underlying root type. Note that this is not a bound as expressed via a subtype constraint.
Implemented in comma::EnumerationType, and comma::IntegerType.
virtual ValAD* comma::DiscreteType::getValAttribute | ( | ) | [pure virtual] |
Returns the declaration corresponding to the Val attribute for this type.
Implemented in comma::EnumerationType, and comma::IntegerType.
bool comma::DiscreteType::isDynamicallyConstrained | ( | ) | const [inline] |
bool DiscreteType::isSigned | ( | ) | const |
bool comma::DiscreteType::isStaticallyConstrained | ( | ) | const [inline] |
uint64_t DiscreteType::length | ( | ) | const |