llir-opt  0.0.1
Low-Level Post-Link Optimiser for OCaml and C
Public Member Functions | Static Public Attributes | List of all members
PhiInst Class Referencefinal

#include <core/insts/phi.h>

Inheritance diagram for PhiInst:
Inheritance graph
[legend]
Collaboration diagram for PhiInst:
Collaboration graph
[legend]

Public Member Functions

 PhiInst (Type type, AnnotSet &&annot={})
 
 PhiInst (Type type, const AnnotSet &annot)
 
unsigned GetNumRets () const override
 Returns the number of return values.
 
Type GetType (unsigned i) const override
 Returns the type of the ith return value.
 
void Add (Block *block, Ref< Inst > value)
 Adds an incoming value.
 
unsigned GetNumIncoming () const
 Returns the number of predecessors.
 
void SetBlock (unsigned i, Block *block)
 Updates the nth block.
 
const BlockGetBlock (unsigned i) const
 Returns the nth block.
 
BlockGetBlock (unsigned i)
 Returns the nth block.
 
void SetValue (unsigned i, Ref< Inst > value)
 Sets the value attached to a block.
 
ConstRef< InstGetValue (unsigned i) const
 Returns the nth value.
 
Ref< InstGetValue (unsigned i)
 Returns the nth value.
 
Ref< InstGetValue (const Block *block)
 Returns an operand for a block.
 
ConstRef< InstGetValue (const Block *block) const
 Returns an operand for a block.
 
void Remove (const Block *block)
 Removes an incoming value.
 
bool HasValue (const Block *block) const
 Checks if the PHI has a value for a block.
 
Type GetType () const
 Returns the immediate type.
 
bool HasSideEffects () const override
 This instruction has no side effects.
 
bool IsConstant () const override
 Instruction is not constant.
 
bool IsReturn () const override
 Instruction does not return.
 
- Public Member Functions inherited from Inst
virtual ~Inst ()
 Destroys an instruction.
 
unsigned GetOrder () const
 Returns a unique, stable identifier for the instruction.
 
void removeFromParent ()
 Removes an instruction from the parent.
 
void eraseFromParent ()
 Removes an instruction from the parent and deletes it.
 
Kind GetKind () const
 Returns the instruction kind.
 
bool Is (Kind kind) const
 Checks if the instruction is of a specific kind.
 
BlockgetParent () const
 Returns the parent node.
 
bool IsVoid () const
 Checks if the instruction is void.
 
virtual bool IsTerminator () const
 Checks if the instruction is a terminator.
 
template<typename T >
bool HasAnnot () const
 Checks if a flag is set.
 
template<typename T >
bool ClearAnnot ()
 Removes an annotation.
 
template<typename T >
const T * GetAnnot () const
 Returns an annotation.
 
template<typename T , typename... Args>
bool SetAnnot (Args &&... args)
 Sets an annotation.
 
bool AddAnnot (const Annot &annot)
 Adds an annotation.
 
const AnnotSetGetAnnots () const
 Returns the instruction's annotation.
 
size_t annot_size () const
 Returns the number of annotations.
 
bool annot_empty () const
 Checks if any flags are set.
 
llvm::iterator_range< AnnotSet::const_iterator > annots () const
 Iterator over annotations.
 
Ref< InstGetSubValue (unsigned i)
 Returns the ith sub-value.
 
ConstRef< InstGetSubValue (unsigned i) const
 Returns the ith sub-value.
 
void replaceAllUsesWith (Value *v) override
 Replaces all uses of this value.
 
void replaceAllUsesWith (llvm::ArrayRef< Ref< Inst >> v)
 Replaces all uses of a multi-type value.
 
template<typename T >
std::enable_if< std::is_base_of< Inst, T >::value >::type replaceAllUsesWith (llvm::ArrayRef< Ref< T >> insts)
 Replaces all uses of a multi-type value.
 
void dump (llvm::raw_ostream &os=llvm::errs()) const
 Dumps the textual representation of the instruction.
 
- Public Member Functions inherited from User
 User (Kind kind, unsigned numOps)
 Creates a new user.
 
virtual ~User ()
 Cleans up after the use.
 
size_t size () const
 
op_iterator op_begin ()
 
op_iterator op_end ()
 
op_range operands ()
 
const_op_iterator op_begin () const
 
const_op_iterator op_end () const
 
const_op_range operands () const
 
value_op_iterator value_op_begin ()
 
value_op_iterator value_op_end ()
 
value_op_range operand_values ()
 
const_value_op_iterator value_op_begin () const
 
const_value_op_iterator value_op_end () const
 
const_value_op_range operand_values () const
 
- Public Member Functions inherited from Value
 Value (Kind kind)
 Constructs a new value.
 
 Value (const Value &)=delete
 Do not allow copying.
 
 Value (Value &&)=delete
 Do not allow moving.
 
virtual ~Value ()
 Destroy the value.
 
Kind GetKind () const
 Returns the value kind.
 
bool Is (Kind kind) const
 Checks if the value is of a specific kind.
 
bool IsConstant () const
 Checks whether the value is a compile-time constant.
 
virtual void replaceAllUsesWith (Ref< Value > v)
 Replaces all uses of this with a refernce.
 
size_t use_size () const
 
bool use_empty () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
llvm::iterator_range< use_iteratoruses ()
 
llvm::iterator_range< const_use_iteratoruses () const
 
bool user_empty () const
 
user_iterator user_begin ()
 
const_user_iterator user_begin () const
 
user_iterator user_end ()
 
const_user_iterator user_end () const
 
llvm::iterator_range< user_iteratorusers ()
 
llvm::iterator_range< const_user_iteratorusers () const
 
void operator= (const Value &)=delete
 Do not allow assignments.
 
void operator= (Value &&)=delete
 Do not allow move assignments.
 

Static Public Attributes

static constexpr Inst::Kind kInstKind = Inst::Kind::PHI
 Kind of the instruction.
 
- Static Public Attributes inherited from Inst
static constexpr Value::Kind kValueKind = Value::Kind::INST
 Kind of the instruction.
 

Additional Inherited Members

- Public Types inherited from Inst
enum  Kind : uint8_t { GET_INST }
 
- Public Types inherited from User
using op_iterator = Use *
 
using const_op_iterator = const Use *
 
using op_range = llvm::iterator_range< op_iterator >
 
using const_op_range = llvm::iterator_range< const_op_iterator >
 
using value_op_range = llvm::iterator_range< value_op_iterator >
 
using const_value_op_range = llvm::iterator_range< const_value_op_iterator >
 
template<typename T >
using conv_op_range = llvm::iterator_range< conv_op_iterator< T > >
 
template<typename T >
using const_conv_op_range = llvm::iterator_range< const_conv_op_iterator< T > >
 
template<typename T >
using unref_range = llvm::iterator_range< unref_iterator< T > >
 
template<typename T >
using const_unref_range = llvm::iterator_range< const_unref_iterator< T > >
 
- Public Types inherited from Value
enum  Kind { INST, GLOBAL, EXPR, CONST }
 Enumeration of value types.
 
template<typename T >
using forward_it = std::iterator< std::forward_iterator_tag, T >
 
using use_iterator = use_iterator_impl< Use >
 
using const_use_iterator = use_iterator_impl< const Use >
 
using user_iterator = user_iterator_impl< User >
 
using const_user_iterator = user_iterator_impl< const User >
 
- Protected Member Functions inherited from Inst
 Inst (Kind kind, unsigned numOps, AnnotSet &&annot)
 Constructs an instruction of a given type.
 
 Inst (Kind kind, unsigned numOps, const AnnotSet &annot)
 Constructs an instruction of a given type.
 
- Protected Member Functions inherited from User
template<int I>
void Set (Ref< Value > val)
 Setter for an operand.
 
void Set (int i, Ref< Value > val)
 Setter for an operand.
 
template<int I>
Ref< ValueGet ()
 Accessor for an operand.
 
Ref< ValueGet (int i)
 Accessor for an operand.
 
template<int I>
ConstRef< ValueGet () const
 Accessor for an operand.
 
ConstRef< ValueGet (int i) const
 Accessor for an operand.
 
void resizeUses (unsigned n)
 Grows the operand list.
 
- Protected Attributes inherited from Inst
Blockparent_
 Parent node.
 
unsigned order_
 Unique number for stable ordering.
 
- Protected Attributes inherited from User
unsigned numOps_
 Number of operands.
 
Useuses_
 Head of the use list.
 

Detailed Description

PHI instruction.


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