|
clang 24.0.0git
|
CIR-specific implementation of mlir::abi::ABIRewriteContext. More...
Public Member Functions | |
| CIRABIRewriteContext (mlir::ModuleOp module, const mlir::DataLayout &dl) | |
| ~CIRABIRewriteContext () | |
| mlir::LogicalResult | rewriteFunctionDefinition (mlir::FunctionOpInterface funcOp, const mlir::abi::FunctionClassification &fc, mlir::OpBuilder &builder) override |
| mlir::LogicalResult | rewriteCallSite (mlir::Operation *callOp, const mlir::abi::FunctionClassification &fc, mlir::OpBuilder &builder) override |
| mlir::LogicalResult | rewriteVAArg (mlir::Operation *vaArgOp, const mlir::abi::ArgClassification &ac, mlir::OpBuilder &builder) override |
| Expand a cir.va_arg into the x86-64 SysV register-save-area / overflow-area sequence. | |
| void | rewriteFunctionAddress (cir::GetGlobalOp addrOp, cir::FuncOp funcOp, mlir::OpBuilder &builder) |
Retype addrOp, which holds the address of funcOp, to the signature funcOp was rewritten to, and cast it back so existing uses keep the type they were built for. | |
| void | normalizeParameterSlotAlignments (cir::FuncOp funcOp, const mlir::abi::FunctionClassification &fc) |
| Restate each non-byval indirect parameter's CIRGen slot alignment as the alignment the ABI promises for that parameter. | |
| void | finalizeParameterSlots () |
| Replace each non-byval indirect parameter's CIRGen slot with the incoming pointer, so the body operates on the caller's storage in place. | |
| mlir::StringRef | getDialectNamespace () const override |
CIR-specific implementation of mlir::abi::ABIRewriteContext.
The driver pass (CallConvLoweringPass) computes a FunctionClassification for each cir.func / cir.call and dispatches to this class to perform the actual IR rewriting using cir dialect operations.
Holds a reference to the module's DataLayout for coercion alignment queries. The DataLayout must outlive the rewrite context.
Definition at line 41 of file CIRABIRewriteContext.h.
|
inline |
Definition at line 43 of file CIRABIRewriteContext.h.
|
inline |
Definition at line 46 of file CIRABIRewriteContext.h.
| void CIRABIRewriteContext::finalizeParameterSlots | ( | ) |
Replace each non-byval indirect parameter's CIRGen slot with the incoming pointer, so the body operates on the caller's storage in place.
Call once, after every function and call site has been rewritten: a call forwarding such a parameter reads the slot to recognise it. Not an override, since deferring this has no counterpart in the generic contract.
Definition at line 1098 of file CIRABIRewriteContext.cpp.
|
inlineoverride |
Definition at line 95 of file CIRABIRewriteContext.h.
| void CIRABIRewriteContext::normalizeParameterSlotAlignments | ( | cir::FuncOp | funcOp, |
| const mlir::abi::FunctionClassification & | fc ) |
Restate each non-byval indirect parameter's CIRGen slot alignment as the alignment the ABI promises for that parameter.
CIRGen picked the slot's alignment for a local copy of the record, but the slot is about to stand in for the parameter, and a call forwarding it may only promise what the incoming pointer does. Call for every function before any call site is rewritten, since a call is rewritten with its callee rather than with its enclosing function and so may be reached first. Not an override, since this has no counterpart in the generic contract.
Definition at line 1075 of file CIRABIRewriteContext.cpp.
|
override |
Definition at line 1282 of file CIRABIRewriteContext.cpp.
References cir::RecordType::isStruct().
| void CIRABIRewriteContext::rewriteFunctionAddress | ( | cir::GetGlobalOp | addrOp, |
| cir::FuncOp | funcOp, | ||
| mlir::OpBuilder & | builder ) |
Retype addrOp, which holds the address of funcOp, to the signature funcOp was rewritten to, and cast it back so existing uses keep the type they were built for.
A no-op when the ABI left funcOp's type alone. Call after funcOp has been rewritten. Not an override, since taking a function's address has no counterpart in the generic contract.
Definition at line 1498 of file CIRABIRewriteContext.cpp.
|
override |
Definition at line 1106 of file CIRABIRewriteContext.cpp.
|
override |
Expand a cir.va_arg into the x86-64 SysV register-save-area / overflow-area sequence.
Definition at line 1787 of file CIRABIRewriteContext.cpp.
References cir::CIRBaseBuilderTy::createAlloca(), clang::CharUnits::fromQuantity(), cir::CIRBaseBuilderTy::getPointerTo(), and cir::CIRBaseBuilderTy::getUIntNTy().