LLVM 19.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::SetTheory Class Reference

#include "llvm/TableGen/SetTheory.h"

Classes

class  Expander
 Expander - A callback function that can transform a Record representing a set into a fully expanded list of elements. More...
 
class  Operator
 Operator - A callback representing a DAG operator. More...
 

Public Types

using RecVec = std::vector< Record * >
 
using RecSet = SmallSetVector< Record *, 16 >
 

Public Member Functions

 SetTheory ()
 Create a SetTheory instance with only the standard operators.
 
void addExpander (StringRef ClassName, std::unique_ptr< Expander >)
 addExpander - Add an expander for Records with the named super class.
 
void addFieldExpander (StringRef ClassName, StringRef FieldName)
 addFieldExpander - Add an expander for ClassName that simply evaluates FieldName in the Record to get the set elements.
 
void addOperator (StringRef Name, std::unique_ptr< Operator >)
 addOperator - Add a DAG operator.
 
void evaluate (Init *Expr, RecSet &Elts, ArrayRef< SMLoc > Loc)
 evaluate - Evaluate Expr and append the resulting set to Elts.
 
template<typename Iter >
void evaluate (Iter begin, Iter end, RecSet &Elts, ArrayRef< SMLoc > Loc)
 evaluate - Evaluate a sequence of Inits and append to Elts.
 
const RecVecexpand (Record *Set)
 expand - Expand a record into a set of elements if possible.
 

Detailed Description

Definition at line 65 of file SetTheory.h.

Member Typedef Documentation

◆ RecSet

Definition at line 68 of file SetTheory.h.

◆ RecVec

using llvm::SetTheory::RecVec = std::vector<Record *>

Definition at line 67 of file SetTheory.h.

Constructor & Destructor Documentation

◆ SetTheory()

SetTheory::SetTheory ( )

Create a SetTheory instance with only the standard operators.

Definition at line 256 of file SetTheory.cpp.

References addOperator().

Member Function Documentation

◆ addExpander()

void SetTheory::addExpander ( StringRef  ClassName,
std::unique_ptr< Expander E 
)

addExpander - Add an expander for Records with the named super class.

Definition at line 273 of file SetTheory.cpp.

Referenced by addFieldExpander().

◆ addFieldExpander()

void SetTheory::addFieldExpander ( StringRef  ClassName,
StringRef  FieldName 
)

addFieldExpander - Add an expander for ClassName that simply evaluates FieldName in the Record to get the set elements.

That is all that is needed for a class like:

class Set<dag d> { dag Elts = d; }

Definition at line 277 of file SetTheory.cpp.

References addExpander().

◆ addOperator()

void SetTheory::addOperator ( StringRef  Name,
std::unique_ptr< Operator Op 
)

addOperator - Add a DAG operator.

Definition at line 269 of file SetTheory.cpp.

References Name.

Referenced by SetTheory().

◆ evaluate() [1/2]

void SetTheory::evaluate ( Init Expr,
RecSet Elts,
ArrayRef< SMLoc Loc 
)

evaluate - Evaluate Expr and append the resulting set to Elts.

Definition at line 281 of file SetTheory.cpp.

References evaluate(), expand(), llvm::Init::getAsString(), llvm::DagInit::getOperator(), I, llvm::SetVector< T, Vector, Set, N >::insert(), and llvm::PrintFatalError().

Referenced by evaluate().

◆ evaluate() [2/2]

template<typename Iter >
void llvm::SetTheory::evaluate ( Iter  begin,
Iter  end,
RecSet Elts,
ArrayRef< SMLoc Loc 
)
inline

evaluate - Evaluate a sequence of Inits and append to Elts.

Definition at line 132 of file SetTheory.h.

References evaluate().

◆ expand()

const RecVec * SetTheory::expand ( Record Set)

expand - Expand a record into a set of elements if possible.

Return a pointer to the expanded elements, or NULL if Set cannot be expanded further.

Definition at line 307 of file SetTheory.cpp.

References llvm::SetVector< T, Vector, Set, N >::begin(), llvm::SetVector< T, Vector, Set, N >::end(), llvm::Record::getSuperClasses(), and I.

Referenced by evaluate().


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