Class FuncType

Inheritance Relationships

Base Type

Class Documentation

class FuncType : public seq::types::Type

Public Functions

FuncType(FuncType const&)
void operator=(FuncType const&)
unsigned argCount() const
Value *call(BaseFunc *base, llvm::Value *self, const std::vector<llvm::Value *> &args, llvm::BasicBlock *block, llvm::BasicBlock *normal, llvm::BasicBlock *unwind)

Calls this type. Usually a call to this method should be preceded by a call to getCallType() to validate types and determine the output type.

Return

value resulting from call

Parameters
  • base: the function containing block

  • self: a value of this type

  • args: vector of argument values

  • block: where to codegen this call in

  • normal: if in a try, block to branch to if call succeeds, or null otherwise

  • unwind: if in a try, block to branch to if call raises an exception, or null otherwise

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.

Return

value of the default value

Parameters
  • block: where to codegen the default value

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().

types::Type *getCallType(const std::vector<Type *> &inTypes)

Returns the result of calling this type with the given argument types.

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::FuncType *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.

Return

cloned type

Parameters
  • ref: generic object that is being cloned

Public Static Functions

types::FuncType *get(std::vector<Type *> inTypes, Type *outType)