MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::Dispatch Class Reference

Matches a dispatch through a jump table of the form: (target_0, target_1, ...)#index arg where index is not a Literal. More...

#include <mim/tuple.h>

Public Member Functions

 Dispatch (const Def *)
 
 operator bool () const noexcept
 
const Appapp () const
 
const Defcallee () const
 
const Defarg () const
 
const Extractextract () const
 
const Deftuple () const
 
const Defindex () const
 
size_t num_targets () const
 
const Deftarget (size_t i) const
 

Detailed Description

Matches a dispatch through a jump table of the form: (target_0, target_1, ...)#index arg where index is not a Literal.

Note
Subsumes Branch. If you want to deal with Branch separately, match Branch first:
if (auto branch = Branch(def)) {
// special case first
} else if (auto dispatch = Dispatch(def)) {
// now, the generic case
}
Matches (ff, tt)#cond arg where cond is not a Literal.
Definition tuple.h:279
Dispatch(const Def *)
Definition tuple.cpp:67

Definition at line 304 of file tuple.h.

Constructor & Destructor Documentation

◆ Dispatch()

mim::Dispatch::Dispatch ( const Def * def)

Definition at line 67 of file tuple.cpp.

References app(), extract(), and mim::Lit::isa().

Member Function Documentation

◆ app()

const App * mim::Dispatch::app ( ) const
inline

Definition at line 310 of file tuple.h.

Referenced by arg(), callee(), and Dispatch().

◆ arg()

const Def * mim::Dispatch::arg ( ) const

Definition at line 79 of file tuple.cpp.

References app(), and mim::App::arg().

◆ callee()

const Def * mim::Dispatch::callee ( ) const

Definition at line 78 of file tuple.cpp.

References app(), and mim::App::callee().

◆ extract()

const Extract * mim::Dispatch::extract ( ) const
inline

Definition at line 314 of file tuple.h.

Referenced by Dispatch(), index(), num_targets(), and tuple().

◆ index()

const Def * mim::Dispatch::index ( ) const
inline

Definition at line 316 of file tuple.h.

References extract().

◆ num_targets()

size_t mim::Dispatch::num_targets ( ) const
inline

Definition at line 318 of file tuple.h.

References mim::Lit::as(), extract(), and tuple().

◆ operator bool()

mim::Dispatch::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 308 of file tuple.h.

◆ target()

const Def * mim::Dispatch::target ( size_t i) const
inline

Definition at line 319 of file tuple.h.

References tuple().

◆ tuple()

const Def * mim::Dispatch::tuple ( ) const
inline

Definition at line 315 of file tuple.h.

References extract().

Referenced by num_targets(), and target().


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