21 LogicalResult mlir::LLVMImportInterface::convertUnregisteredIntrinsic(
24 StringRef intrinName = inst->getCalledFunction()->getName();
30 llvmOpBundles.reserve(inst->getNumOperandBundles());
31 for (
unsigned i = 0; i < inst->getNumOperandBundles(); ++i)
32 llvmOpBundles.push_back(inst->getOperandBundleAt(i));
37 llvmOperands, llvmOpBundles,
false, {}, {}, mlirOperands, mlirAttrs)))
41 auto op = builder.
create<::mlir::LLVM::CallIntrinsicOp>(
44 ValueRange{mlirOperands}, FastmathFlagsAttr{});
48 ArrayAttr argsAttr, resAttr;
50 op.setArgAttrsAttr(argsAttr);
51 op.setResAttrsAttr(resAttr);
54 unsigned numRes = op.getNumResults();
56 moduleImport.
mapValue(inst) = op.getResult(0);
61 "expected at most one result from target intrinsic call");
MLIRContext * getContext() const
Module import implementation class that provides methods to import globals and functions from an LLVM...
LogicalResult convertIntrinsicArguments(ArrayRef< llvm::Value * > values, ArrayRef< llvm::OperandBundleUse > opBundles, bool requiresOpBundles, ArrayRef< unsigned > immArgPositions, ArrayRef< StringLiteral > immArgAttrNames, SmallVectorImpl< Value > &valuesOut, SmallVectorImpl< NamedAttribute > &attrsOut)
Converts the LLVM values for an intrinsic to mixed MLIR values and attributes for LLVM_IntrOpBase.
Location translateLoc(llvm::DILocation *loc)
Translates the debug location.
void convertParameterAttributes(llvm::CallBase *call, ArrayAttr &argsAttr, ArrayAttr &resAttr, OpBuilder &builder)
Converts the parameter and result attributes in argsAttr and resAttr and add them to the callOp.
void mapNoResultOp(llvm::Instruction *llvm, Operation *mlir)
Stores a mapping between an LLVM instruction and the imported MLIR operation if the operation returns...
Type convertType(llvm::Type *type)
Converts the type from LLVM to MLIR LLVM dialect.
void setFastmathFlagsAttr(llvm::Instruction *inst, Operation *op) const
Sets the fastmath flags attribute for the imported operation op given the original instruction inst.
void mapValue(llvm::Value *llvm, Value mlir)
Stores the mapping between an LLVM value and its MLIR counterpart.
This class helps build Operations.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class provides an abstraction over the different types of ranges over Values.
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...