pub struct ApplyNativeRewriteOperation<'c> { /* private fields */ }
Expand description
An apply_native_rewrite
operation. Apply a native rewrite method inside of pdl.rewrite region.
pdl.apply_native_rewrite
operations apply a native C++ function, that has
been registered externally with the consumer of PDL, to perform a rewrite
and optionally return a number of values. The native function may accept any
number of arguments. This operation is used within a pdl.rewrite region to enable
the interleaving of native rewrite methods with other pdl constructs.
Example:
// Apply a native rewrite method that returns an attribute.
%ret = pdl.apply_native_rewrite "myNativeFunc"(%arg0, %attr1) : !pdl.attribute
// The native rewrite as defined in C++:
static Attribute myNativeFunc(PatternRewriter &rewriter, Value arg0, Attribute arg1) {
// Just return the second arg.
return arg1;
}
void registerNativeRewrite(PDLPatternModule &pdlModule) {
pdlModule.registerRewriteFunction("myNativeFunc", myNativeFunc);
}
Implementations§
source§impl<'c> ApplyNativeRewriteOperation<'c>
impl<'c> ApplyNativeRewriteOperation<'c>
sourcepub fn as_operation(&self) -> &Operation<'c>
pub fn as_operation(&self) -> &Operation<'c>
Returns a generic operation.
sourcepub fn builder(
context: &'c Context,
location: Location<'c>
) -> ApplyNativeRewriteOperationBuilder<'c, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> ApplyNativeRewriteOperationBuilder<'c, Unset, Unset, Unset>
Creates a builder.
pub fn results(&self) -> impl Iterator<Item = OperationResult<'c, '_>>
pub fn args(&self) -> impl Iterator<Item = Value<'c, '_>>
pub fn _name(&self) -> Result<StringAttribute<'c>, Error>
pub fn set_name(&mut self, value: StringAttribute<'c>)
Trait Implementations§
source§impl<'c> From<ApplyNativeRewriteOperation<'c>> for Operation<'c>
impl<'c> From<ApplyNativeRewriteOperation<'c>> for Operation<'c>
source§fn from(operation: ApplyNativeRewriteOperation<'c>) -> Self
fn from(operation: ApplyNativeRewriteOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for ApplyNativeRewriteOperation<'c>
impl<'c> !Send for ApplyNativeRewriteOperation<'c>
impl<'c> !Sync for ApplyNativeRewriteOperation<'c>
impl<'c> Unpin for ApplyNativeRewriteOperation<'c>
impl<'c> UnwindSafe for ApplyNativeRewriteOperation<'c>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more