Class RefType

Inheritance Relationships

Base Types

Class Documentation

class seq::types::RefType : public seq::types::Type, public seq::Generic

Public Functions

RefType(RefType const&) = delete
void operator=(RefType const&) = delete
void setDone()
void setContents(RecordType *contents)
void addMember(std::string name, Expr *expr)
std::string getName() const override

Returns the full name (e.g. array[int], Foo[str,bool]) of this type.

std::string genericName() override
types::Type *realize(std::vector<types::Type*> types)
std::vector<types::Type*> deduceTypesFromArgTypes(std::vector<types::Type*> argTypes, std::vector<std::string> names = {})
llvm::Value *memb(llvm::Value *self, const std::string &name, llvm::BasicBlock *block) override

Extract a given member (field or method) from this type.

Return

member value

Parameters
  • self: a value of this type

  • name: name of the member

  • block: where to codegen the member

Type *membType(const std::string &name) override

Return the type of a given member (field or method) of this type.

Return

type of the member

Parameters
  • name: name of the member

llvm::Value *setMemb(llvm::Value *self, const std::string &name, llvm::Value *val, llvm::BasicBlock *block) override

Sets the specified member of this type.

Return

value (possibly self) containing new member

Parameters
  • self: a value of this type

  • name: name of the member

  • val: value to assign to member

  • block: where to codegen the assignment

llvm::Value *defaultValue(llvm::BasicBlock *block) override

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.

Return

value of the default value

Parameters
  • block: where to codegen the default value

void initOps() override

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

void initFields() override

Performs a one-time initialization of this type’s fields.

bool isAtomic() const override

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.

bool is(types::Type *type) const override

Checks whether this type “is” another type.

unsigned numBaseTypes() const override

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.

Type *getBaseType(unsigned idx) const override

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

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

Returns the LLVM type corresponding to this type.

size_t size(llvm::Module *module) const override

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

RefType *asRef() override

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

llvm::Value *make(llvm::BasicBlock *block, std::vector<llvm::Value*> vals = {})
types::RefType *clone(Generic *ref) override
void addCachedRealized(std::vector<types::Type*> types, Generic *x) override

Public Static Functions

RefType *get(std::string name)
RefType *none()