MLIR 23.0.0git
mlir::abi::ABIRewriteContext Class Referenceabstract

ABIRewriteContext is the abstract interface that each dialect implements to perform ABI-specific rewrites on its operations. More...

#include "mlir/ABI/ABIRewriteContext.h"

Public Member Functions

virtual ~ABIRewriteContext ()=default
virtual LogicalResult rewriteFunctionDefinition (FunctionOpInterface funcOp, const FunctionClassification &fc, OpBuilder &rewriter)=0
 Rewrite a function definition to use ABI-lowered types.
virtual LogicalResult rewriteCallSite (Operation *callOp, const FunctionClassification &fc, OpBuilder &rewriter)=0
 Rewrite a call operation to match the callee's ABI-lowered signature.
virtual StringRef getDialectNamespace () const =0
 Return the dialect namespace this context handles (e.g. "cir").

Detailed Description

ABIRewriteContext is the abstract interface that each dialect implements to perform ABI-specific rewrites on its operations.

The pass orchestrator calls these methods after ABI classification to rewrite function definitions and call sites.

Definition at line 119 of file ABIRewriteContext.h.

Constructor & Destructor Documentation

◆ ~ABIRewriteContext()

virtual mlir::abi::ABIRewriteContext::~ABIRewriteContext ( )
virtualdefault

Member Function Documentation

◆ getDialectNamespace()

virtual StringRef mlir::abi::ABIRewriteContext::getDialectNamespace ( ) const
pure virtual

Return the dialect namespace this context handles (e.g. "cir").

◆ rewriteCallSite()

virtual LogicalResult mlir::abi::ABIRewriteContext::rewriteCallSite ( Operation * callOp,
const FunctionClassification & fc,
OpBuilder & rewriter )
pure virtual

Rewrite a call operation to match the callee's ABI-lowered signature.

This coerces arguments, handles indirect returns (sret), and adapts the call result back to the original high-level type.

Parameters
callOpThe call operation to rewrite.
fcThe ABI classification for the callee.
rewriterThe pattern rewriter to use for modifications.
Returns
success() if the call was rewritten.

◆ rewriteFunctionDefinition()

virtual LogicalResult mlir::abi::ABIRewriteContext::rewriteFunctionDefinition ( FunctionOpInterface funcOp,
const FunctionClassification & fc,
OpBuilder & rewriter )
pure virtual

Rewrite a function definition to use ABI-lowered types.

This creates a new function with the lowered signature, rewrites the function body to adapt between the ABI types and the original high-level types, and replaces the original function.

Parameters
funcOpThe function to rewrite (via FunctionOpInterface).
fcThe ABI classification for this function.
rewriterThe pattern rewriter to use for modifications.
Returns
success() if the function was rewritten.

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