Value
Value Class is the base class of all the following classes. Here, we document some of their most useful member functions for our Tiger Compiler.
llvm::BasicBlock
See LLVM Basic Block Representation.
// Creates a new :code:`BasicBlock`. If the Parent parameter is specified, the basic block is automatically inserted at either the end of // the function (if InsertBefore is 0), or before the specified basic block. static BasicBlock* Create(LLVMContext &Context, const Twine &Name = "", Function* Parent = nullptr, BasicBlock* InsertBefore = nullptr);
llvm::Function
This file contains the declaration of the
Function
class, which represents a single function/procedure in LLVM.
- A function consists of:
a list of basic blocks
a list of arguments
a symbol table
Linkage
represents the linkage of the function. Relevant values in Tiger compiler are:
llvm::Function::ExternalLinkage
for external linkage (i.e. externally accessible)
llvm::Function::InternalLinkage
for internal linkage (i.e. static functions)// Creates a new function and attaches it to a module. static Function* Create(FunctionType* Ty, LinkageTypes Linkage, const Twine &N = "", Module* M = nullptr);
llvm::ConstantInt
This class represents both boolean and integral constants.
// Return a ConstantInt with the specified value for the specified type. static ConstantInt* getSigned(IntegerType* Ty, int64_t V);
llvm::ConstantPointerNull
A constant pointer value that points to
null
.// Returns object of the specified type. static ConstantPointerNull* get(PointerType* T);
llvm::AllocaInst
This class represents instruction to allocate memory on the stack.
llvm::CallInst
This class represents a function call, abstracting a target machine’s calling convention.
llvm::ConstantExpr
A constant value that is initialized with an expression using other constant values.
static Constant* getTruncOrBitCast(Constant* C, Type* Ty);For more information on this method, check out the ‘trunc’ and ‘bitcast’ instructions.
// Computes the (alloc) size of a type (in address-units, not bits) in a target independent way (the return type is an i64). static Constant* ConstantExpr::getSizeOf(Type* Ty)