Class PassContext#
Defined in File transform.h
Inheritance Relationships#
Base Type#
public ffi::ObjectRef
Class Documentation#
-
class PassContext : public ffi::ObjectRef#
PassContext that is used to configure the pass behavior.
auto new_ctx = PassContext::Create(); ctx->opt_level = 2; With<PassContext> scope(ctx); // pass context in effect.
See also
Public Types
-
using ContainerType = PassContextObj#
Public Functions
-
inline explicit PassContext(ffi::UnsafeInit tag)#
constructor with UnsafeInit
-
inline explicit PassContext(ffi::UnsafeInit tag, ffi::ObjectPtr<PassContextObj> n)#
constructor with ffi::ObjectPtr
-
inline const PassContextObj *operator->() const#
const accessor.
- Returns:
const access pointer.
-
inline PassContextObj *operator->()#
mutable accessor.
- Returns:
mutable access pointer.
-
void InstrumentEnterPassContext()#
Call instrument implementations’ callbacks when entering PassContext. The callbacks are called in order, and if one raises an exception, the rest will not be called.
-
void InstrumentExitPassContext()#
Call instrument implementations’ callbacks when exiting PassContext. The callbacks are called in order, and if one raises an exception, the rest will not be called.
-
bool InstrumentBeforePass(const IRModule &mod, const PassInfo &info) const#
Call instrument implementations’ callbacks before a pass run. The callbacks are called in order, and if one raises an exception, the rest will not be called.
- Parameters:
mod – The module that an optimization pass runs on.
info – The pass information.
- Returns:
false: the pass is skipped; true: the pass runs.
-
inline void InstrumentAfterPass(const IRModule &mod, const PassInfo &info) const#
Call instrument implementations callbacks after a pass run. The callbacks are called in order, and if one raises an exception, the rest will not be called.
- Parameters:
mod – The module that an optimization pass runs on.
info – The pass information.
Public Static Functions
-
static inline PassContext Create()#
Construct a PassContext containing the default configurations.
- Returns:
The new PassContext.
-
static PassContext Current()#
Get the default pass context in the current scope.
- Returns:
The pass context.
-
static ffi::Map<ffi::String, ffi::Map<ffi::String, ffi::String>> ListConfigs()#
Get all supported configuration names and metadata, registered within the PassContext.
- Returns:
Map indexed by the config name, pointing to the metadata map as key-value
-
template<typename ValueType>
static inline void RegisterConfigOption(const char *key)# Register a valid configuration option and its ValueType for validation.
- Parameters:
key – The configuration key.
- Template Parameters:
ValueType – The value type to be registered
-
using ContainerType = PassContextObj#