Class GenType

Nested Relationships

Inheritance Relationships

Base Type

Class Documentation

class GenType : public seq::types::Type

Public Types

enum GenTypeKind



Public Functions

GenType(GenType const&)
void operator=(FuncType const&)
bool isAtomic() const

Returns whether this type is “atomic”. A type is defined to be atomic if its LLVM representation contains no pointers to heap allocated data. This is used internally by the GC, as we can allocate “atomic” and “non-atomic” blocks separately. Atomic blocks do not need to be scanned when searching for pointers.

Value *defaultValue(llvm::BasicBlock *block)

Codegens the default value of this type. Usually this is just what you’d expect: zero for integral types, null for pointer and reference types, recursively defined for aggregate types.


value of the default value

  • block: where to codegen the default value

Value *done(llvm::Value *self, llvm::BasicBlock *block)
void resume(llvm::Value *self, llvm::BasicBlock *block, llvm::BasicBlock *normal, llvm::BasicBlock *unwind)
Value *promise(llvm::Value *self, llvm::BasicBlock *block, bool returnPtr = false)
void send(llvm::Value *self, llvm::Value *val, llvm::BasicBlock *block)
void destroy(llvm::Value *self, llvm::BasicBlock *block)
bool fromPrefetch()
bool fromInterAlign()
void setAlignParams(InterAlignParams alnParams)
types::GenType::InterAlignParams getAlignParams()
void initOps()

Performs a one-time initialization of this type’s methods, including magic methods.

bool is(Type *type) const

Checks whether this type “is” another type.

unsigned numBaseTypes() const

Returns the number of “base types” of this type. E.g., int.numBaseTypes() would return 0, whereas array[str].numBaseTypes() would return 1, and (int,float,str).numBaseTypes() would return 3.

types::Type *getBaseType(unsigned idx) const

Obtain the base type at index idx. idx should be less than numBaseTypes().

Type *getLLVMType(llvm::LLVMContext &context) const

Returns the LLVM type corresponding to this type.

size_t size(llvm::Module *module) const

Returns the size (in bytes) of the LLVM type corresponding to this type.

types::GenType *asGen()

Returns this type as a generator type, or null if it isn’t a generator type. This is basically for overriding C++’s RTTI/dynamic_cast so that generic types can be converted to their actual types.

types::GenType *clone(Generic *ref)

Clones this type and all of its methods. ref is used internally to keep track of cloned objects, and to make sure we don’t clone certain objects twice.


cloned type

  • ref: generic object that is being cloned

Public Static Functions

types::GenType *get(Type *outType, GenTypeKind kind = GenTypeKind::NORMAL)
types::GenType *get(GenTypeKind kind = GenTypeKind::NORMAL)
struct InterAlignParams

Public Functions


Public Members

Expr *a
Expr *b
Expr *ambig
Expr *gapo
Expr *gape
Expr *bandwidth
Expr *zdrop
Expr *end_bonus