Joos1W Compiler Framework
All Classes Functions Typedefs Pages
tir::Function Class Referencefinal
Inheritance diagram for tir::Function:

Public Member Functions

std::ostream & print (std::ostream &os) const override
 
auto * parent () const
 
auto args () const
 
auto numParams () const
 
auto getParamType (int index) const
 
auto getReturnType () const
 
bool hasBody () const
 
BasicBlockgetEntryBlock () const
 Gets the entry BB of the function or nullptr if it doesn't exist.
 
auto body () const
 Create a new basic block and add it to the function.
 
void removeBlock (BasicBlock *block)
 
AllocaInstcreateAlloca (Type *type)
 Create an alloca instruction for the given type. This will be at the start of the entry BB of the function. If no entry BB exists, this will fail. More...
 
auto isNoReturn () const
 
void setNoReturn ()
 
void setExternalLinkage ()
 
bool isExternalLinkage () const override
 
void printDot (std::ostream &os) const
 
utils::Generator< BasicBlock * > reversePostOrder () const
 
utils::Generator< AllocaInst * > allocas () const
 
- Public Member Functions inherited from tir::User
 User (Context &ctx, Type *type)
 
auto children () const
 
auto numChildren () const
 
ValuegetChild (unsigned idx) const
 
- Public Member Functions inherited from tir::Value
 Value (Context &ctx, Type *type)
 
tir::Contextctx ()
 
auto users ()
 
auto users () const
 
Typetype () const
 
void addUser (User *user)
 
void removeUser (User *user)
 
std::string_view name () const
 
auto nameOpt () const
 
void replaceAllUsesWith (Value *newValue)
 
void setName (std::string_view name)
 
std::ostream & printName (std::ostream &os) const
 
void dump () const
 

Friends

class CompilationUnit
 
class BasicBlock
 

Additional Inherited Members

- Static Public Member Functions inherited from tir::Constant
static ConstantIntCreateInt (Context &ctx, uint8_t bits, uint32_t value)
 
static ConstantIntCreateBool (Context &ctx, bool value)
 
static ConstantIntCreateInt32 (Context &ctx, uint32_t value)
 
static ConstantNullPointerCreateNullPointer (Context &ctx)
 
- Protected Member Functions inherited from tir::GlobalObject
 GlobalObject (Context &ctx, Type *type)
 
- Protected Member Functions inherited from tir::Constant
 Constant (Context &ctx, Type *type)
 
virtual bool isNullPointer () const
 
virtual bool isNumeric () const
 
virtual bool isBoolean () const
 
- Protected Member Functions inherited from tir::User
void addChild (Value *operand)
 
void replaceChild (unsigned idx, Value *operand)
 
void destroy ()
 
bool isDestroyed () const
 

Detailed Description

Definition at line 144 of file Constant.h.

Member Function Documentation

◆ createAlloca()

AllocaInst* tir::Function::createAlloca ( Type type)
inline

Create an alloca instruction for the given type. This will be at the start of the entry BB of the function. If no entry BB exists, this will fail.

Parameters
typeThe type of the alloca instruction.
Returns
AllocaInst* The alloca instruction created.

Definition at line 196 of file Constant.h.

196  {
197  assert(getEntryBlock());
198  auto* inst = AllocaInst::Create(ctx(), type);
199  getEntryBlock()->insertBeforeBegin(inst);
200  return inst;
201  }
BasicBlock * getEntryBlock() const
Gets the entry BB of the function or nullptr if it doesn't exist.
Definition: Constant.h:179

References getEntryBlock().


The documentation for this class was generated from the following files: