|
MLIR 24.0.0git
|
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 &builder)=0 |
| Rewrite a function definition to use ABI-lowered types. | |
| virtual LogicalResult | rewriteCallSite (Operation *callOp, const FunctionClassification &fc, OpBuilder &builder)=0 |
| Rewrite a call operation to match the callee's ABI-lowered signature. | |
| virtual LogicalResult | rewriteVAArg (Operation *vaArgOp, const ArgClassification &ac, OpBuilder &builder) |
| Rewrite a single "fetch the next vararg" operation (e.g. | |
| virtual StringRef | getDialectNamespace () const =0 |
| Return the dialect namespace this context handles (e.g. "cir"). | |
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 184 of file ABIRewriteContext.h.
|
virtualdefault |
|
pure virtual |
Return the dialect namespace this context handles (e.g. "cir").
|
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.
| callOp | The call operation to rewrite. |
| fc | The ABI classification for the callee. |
| builder | The OpBuilder to use for modifications. |
|
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.
| funcOp | The function to rewrite (via FunctionOpInterface). |
| fc | The ABI classification for this function. |
| builder | The OpBuilder to use for modifications. |
|
inlinevirtual |
Rewrite a single "fetch the next vararg" operation (e.g.
C va_arg) to match how ac says the fetched type is passed at the ABI level.
ac classifies only the one type being fetched, in isolation, with the whole register budget available. A vararg fetch advances a runtime cursor (the platform va_list) through registers and then memory, so whether a given fetch lands in a register depends on how much of the budget earlier variadic arguments already consumed at run time, not on the fetch's static position.
An implementation may erase vaArgOp and replace its result, so a caller walking the IR must collect the fetches before rewriting any of them.
The default implementation reports failure, so a dialect that has not implemented vararg fetches does not need to override this. An overrider that fails is responsible for emitting its own diagnostic.
| vaArgOp | The fetch to rewrite. May be erased. |
| ac | The ABI classification of the fetched type. |
| builder | The OpBuilder to use for modifications. |
Definition at line 239 of file ABIRewriteContext.h.