15 #ifndef MLIR_IR_ACTION_H
16 #define MLIR_IR_ACTION_H
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/Sequence.h"
22 #include "llvm/ADT/StringMap.h"
23 #include "llvm/Support/TypeName.h"
24 #include "llvm/Support/raw_ostream.h"
26 #include <type_traits>
48 virtual StringRef
getTag()
const = 0;
50 virtual void print(raw_ostream &os)
const {
51 os <<
"Action \"" <<
getTag() <<
"\"";
75 template <
typename Derived>
83 return action->
getActionID() == TypeID::get<Derived>();
87 StringRef
getTag() const final {
return Derived::tag; }
This class provides an efficient unique identifier for a specific C++ type.
CRTP Implementation of an action.
static bool classof(const Action *action)
Provide classof to allow casting between action types.
ActionImpl(ArrayRef< IRUnit > irUnits={})
StringRef getTag() const final
Forward tag access to the derived class.
An action is a specific action that is to be taken by the compiler, that can be toggled and controlle...
virtual ~Action()=default
TypeID getActionID() const
Return the unique action id of this action, use for casting functionality.
Action(TypeID actionID, ArrayRef< IRUnit > irUnits)
virtual void print(raw_ostream &os) const
virtual ArrayRef< IRUnit > getContextIRUnits() const
Return the set of IR units that are associated with this action.
virtual StringRef getTag() const =0
Return a string "tag" which intends to uniquely identify this type of action.
ArrayRef< IRUnit > irUnits
Set of IR units (operations, regions, blocks, values) that are associated with this action.
TypeID actionID
The type of the derived action class, used for isa/dyn_cast.
Include the generated interface declarations.