pub struct PatternOperation<'c> { /* private fields */ }
Expand description
A pattern
operation. Define a rewrite pattern.
pdl.pattern
operations provide a transformable representation for a
RewritePattern
. The attributes on this operation correspond to the various
metadata on a RewritePattern
, such as the benefit. The match section of
the pattern is specified within the region body, with the rewrite provided
by a terminating pdl.rewrite
.
Example:
// Provide a pattern matching "foo.op" that replaces the root with its
// operand.
pdl.pattern : benefit(1) {
%resultType = pdl.type
%inputOperand = pdl.operand
%root = pdl.operation "foo.op"(%inputOperand) -> (%resultType)
pdl.rewrite %root {
pdl.replace %root with (%inputOperand)
}
}
Implementations§
source§impl<'c> PatternOperation<'c>
impl<'c> PatternOperation<'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>
) -> PatternOperationBuilder<'c, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> PatternOperationBuilder<'c, Unset, Unset>
Creates a builder.
pub fn body_region(&self) -> Result<RegionRef<'c, '_>, Error>
pub fn benefit(&self) -> Result<IntegerAttribute<'c>, Error>
pub fn set_benefit(&mut self, value: IntegerAttribute<'c>)
pub fn sym_name(&self) -> Result<StringAttribute<'c>, Error>
pub fn set_sym_name(&mut self, value: StringAttribute<'c>)
pub fn remove_sym_name(&mut self) -> Result<(), Error>
Trait Implementations§
source§impl<'c> From<PatternOperation<'c>> for Operation<'c>
impl<'c> From<PatternOperation<'c>> for Operation<'c>
source§fn from(operation: PatternOperation<'c>) -> Self
fn from(operation: PatternOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for PatternOperation<'c>
impl<'c> !Send for PatternOperation<'c>
impl<'c> !Sync for PatternOperation<'c>
impl<'c> Unpin for PatternOperation<'c>
impl<'c> UnwindSafe for PatternOperation<'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