MLIR 24.0.0git
LLVMCallOps.cpp File Reference
#include "mlir/Dialect/LLVMIR/LLVMCallOps.h"
#include "IR/LLVMOps.h"
#include "mlir/Dialect/LLVMIR/LLVMConstantOps.h"
#include "mlir/Dialect/LLVMIR/LLVMConversionOps.h"
#include "mlir/Dialect/LLVMIR/LLVMModuleOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "llvm/ADT/STLExtras.h"
#include <optional>
#include "mlir/Dialect/LLVMIR/LLVMCallOps.cpp.inc"

Go to the source code of this file.

Macros

#define GET_OP_CLASSES

Functions

static auto processFMFAttr (ArrayRef< NamedAttribute > attrs)
static void printOneOpBundle (OpAsmPrinter &p, OperandRange operands, TypeRange operandTypes, StringRef tag)
static ParseResult parseOneOpBundle (OpAsmParser &p, SmallVector< SmallVector< OpAsmParser::UnresolvedOperand > > &opBundleOperands, SmallVector< SmallVector< Type > > &opBundleOperandTypes, SmallVector< Attribute > &opBundleTags)
static SmallVector< Type, 1 > getCallOpResultTypes (LLVMFunctionType calleeType)
 Gets the MLIR Op-like result types of a LLVMFunctionType.
static TypeAttr getCallOpVarCalleeType (LLVMFunctionType calleeType)
 Gets the variadic callee type for a LLVMFunctionType.
static LLVMFunctionType getLLVMFuncType (MLIRContext *context, TypeRange results, ValueRange args)
 Constructs a LLVMFunctionType from MLIR results and args.
template<typename OpTy>
static unsigned getNumConsumedCalleeOperands (OpTy callOp)
 Return the number of leading callee operands of callOp that the operation consumes instead of passing them to the callee.
template<typename OpTy>
static Operation::operand_range getOperandsPassedToCallee (OpTy callOp)
 Return the operands of callOp that are passed to the callee, including the variadic arguments in case of a call to a variadic callee.
template<typename OpTy>
static Operation::operand_range getArgOperandsImpl (OpTy callOp)
 Return the operands of callOp that correspond to the declared parameters of the callee, i.e., its CallOpInterface argument operands.
template<typename OpTy>
static LogicalResult verifyCallOpDebugInfo (OpTy callOp, LLVMFuncOp callee)
 Verify that an inlinable callsite of a debug-info-bearing function in a debug-info-bearing function has a debug location attached to it.
template<typename OpTy>
static LogicalResult verifyCallOpVarCalleeType (OpTy callOp)
 Verify that the parameter and return types of the variadic callee type match the callOp argument and result types.
template<typename OpTy>
static LogicalResult verifyCallOpSymbolUses (OpTy callOp, SymbolTableCollection &symbolTable)
static ParseResult parseCallTypeAndResolveOperands (OpAsmParser &parser, OperationState &result, bool isDirect, ArrayRef< OpAsmParser::UnresolvedOperand > operands, SmallVectorImpl< DictionaryAttr > &argAttrs, SmallVectorImpl< DictionaryAttr > &resultAttrs)
 Parses the type of a call operation and resolves the operands if the parsing succeeds.
static ParseResult parseOptionalCallFuncPtr (OpAsmParser &parser, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &operands)
 Parses an optional function pointer operand before the call argument list for indirect calls, or stops parsing at the function identifier otherwise.
static ParseResult resolveOpBundleOperands (OpAsmParser &parser, SMLoc loc, OperationState &state, ArrayRef< SmallVector< OpAsmParser::UnresolvedOperand > > opBundleOperands, ArrayRef< SmallVector< Type > > opBundleOperandTypes, StringAttr opBundleSizesAttrName)

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 1283 of file LLVMCallOps.cpp.

Function Documentation

◆ getArgOperandsImpl()

template<typename OpTy>
Operation::operand_range getArgOperandsImpl ( OpTy callOp)
static

Return the operands of callOp that correspond to the declared parameters of the callee, i.e., its CallOpInterface argument operands.

The variadic arguments of a call to a variadic callee are not included: they do not correspond to any argument of the callee. The callee does not receive them as block arguments but reads them with llvm.intr.vastart and friends, so in terms of CallOpInterface they are consumed operands rather than forwarded ones.

Definition at line 340 of file LLVMCallOps.cpp.

References getOperandsPassedToCallee().

◆ getCallOpResultTypes()

SmallVector< Type, 1 > getCallOpResultTypes ( LLVMFunctionType calleeType)
static

Gets the MLIR Op-like result types of a LLVMFunctionType.

Definition at line 139 of file LLVMCallOps.cpp.

◆ getCallOpVarCalleeType()

TypeAttr getCallOpVarCalleeType ( LLVMFunctionType calleeType)
static

Gets the variadic callee type for a LLVMFunctionType.

Definition at line 148 of file LLVMCallOps.cpp.

◆ getLLVMFuncType()

LLVMFunctionType getLLVMFuncType ( MLIRContext * context,
TypeRange results,
ValueRange args )
static

Constructs a LLVMFunctionType from MLIR results and args.

Definition at line 153 of file LLVMCallOps.cpp.

References mlir::ValueRange::getTypes().

◆ getNumConsumedCalleeOperands()

template<typename OpTy>
unsigned getNumConsumedCalleeOperands ( OpTy callOp)
static

Return the number of leading callee operands of callOp that the operation consumes instead of passing them to the callee.

Definition at line 316 of file LLVMCallOps.cpp.

Referenced by getOperandsPassedToCallee().

◆ getOperandsPassedToCallee()

template<typename OpTy>
Operation::operand_range getOperandsPassedToCallee ( OpTy callOp)
static

Return the operands of callOp that are passed to the callee, including the variadic arguments in case of a call to a variadic callee.

Definition at line 326 of file LLVMCallOps.cpp.

References getNumConsumedCalleeOperands().

Referenced by getArgOperandsImpl(), and verifyCallOpVarCalleeType().

◆ parseCallTypeAndResolveOperands()

ParseResult parseCallTypeAndResolveOperands ( OpAsmParser & parser,
OperationState & result,
bool isDirect,
ArrayRef< OpAsmParser::UnresolvedOperand > operands,
SmallVectorImpl< DictionaryAttr > & argAttrs,
SmallVectorImpl< DictionaryAttr > & resultAttrs )
static

◆ parseOneOpBundle()

◆ parseOptionalCallFuncPtr()

ParseResult parseOptionalCallFuncPtr ( OpAsmParser & parser,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > & operands )
static

Parses an optional function pointer operand before the call argument list for indirect calls, or stops parsing at the function identifier otherwise.

Definition at line 630 of file LLVMCallOps.cpp.

References mlir::OptionalParseResult::has_value(), mlir::OpAsmParser::parseOptionalOperand(), and success().

◆ printOneOpBundle()

void printOneOpBundle ( OpAsmPrinter & p,
OperandRange operands,
TypeRange operandTypes,
StringRef tag )
static

◆ processFMFAttr()

auto processFMFAttr ( ArrayRef< NamedAttribute > attrs)
static

◆ resolveOpBundleOperands()

ParseResult resolveOpBundleOperands ( OpAsmParser & parser,
SMLoc loc,
OperationState & state,
ArrayRef< SmallVector< OpAsmParser::UnresolvedOperand > > opBundleOperands,
ArrayRef< SmallVector< Type > > opBundleOperandTypes,
StringAttr opBundleSizesAttrName )
static

◆ verifyCallOpDebugInfo()

template<typename OpTy>
LogicalResult verifyCallOpDebugInfo ( OpTy callOp,
LLVMFuncOp callee )
static

Verify that an inlinable callsite of a debug-info-bearing function in a debug-info-bearing function has a debug location attached to it.

This mirrors an LLVM IR verifier.

Definition at line 362 of file LLVMCallOps.cpp.

References mlir::LocationAttr::findInstanceOf(), mlir::Operation::getLoc(), and success().

Referenced by verifyCallOpSymbolUses().

◆ verifyCallOpSymbolUses()

◆ verifyCallOpVarCalleeType()

template<typename OpTy>
LogicalResult verifyCallOpVarCalleeType ( OpTy callOp)
static

Verify that the parameter and return types of the variadic callee type match the callOp argument and result types.

Definition at line 387 of file LLVMCallOps.cpp.

References getOperandsPassedToCallee(), and success().

Referenced by verifyCallOpSymbolUses().