Class RecordType

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class seq::types::RecordType : public seq::types::Type

Subclassed by seq::types::MethodType

Public Functions

RecordType(RecordType const&) = delete
void operator=(RecordType const&) = delete
void setContents(std::vector<Type*> types, std::vector<std::string> names)
bool named() const
bool empty() const
std::vector<Type*> getTypes()
std::string getName() const override

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

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(Type *type) const override

Checks whether this type “is” another type.

bool isStrict(Type *type) const
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.

void addLLVMTypesToStruct(llvm::StructType *structType)
size_t size(llvm::Module *module) const override

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

RecordType *asRec() override

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

RecordType *clone(Generic *ref) override

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.

Return

cloned type

Parameters
  • ref: generic object that is being cloned

Public Static Functions

RecordType *get(std::vector<Type*> types, std::vector<std::string> names = {}, std::string name = "")

Protected Functions

RecordType(std::vector<Type*> types, std::vector<std::string> names = {}, std::string name = "")

Protected Attributes

std::vector<Type*> types
std::vector<std::string> names