[Mlir-commits] [mlir] [MLIR][LLVM] Add vararg support in LLVM::LLVMFuncOp (PR #67274)
Ivan R. Ivanov
llvmlistbot at llvm.org
Tue Sep 26 07:47:48 PDT 2023
================
@@ -1018,6 +1018,27 @@ static void printStoreType(OpAsmPrinter &printer, Operation *op,
// CallOp
//===----------------------------------------------------------------------===//
+/// Get the MLIR Op-like result types of a LLVMFunctionType
+static SmallVector<Type, 1> getCallOpResults(LLVMFunctionType calleeType) {
+ SmallVector<Type, 1> results;
+ Type resultType = calleeType.getReturnType();
+ if (!isa<LLVM::LLVMVoidType>(resultType))
+ results.push_back(resultType);
+ return results;
+}
+
+/// Construct a LLVMFunctionType from MLIR results and args
+static LLVMFunctionType getLLVMFuncType(OpBuilder &builder, TypeRange results,
+ ValueRange args) {
+ Type resultType;
+ if (results.empty())
+ resultType = LLVMVoidType::get(builder.getContext());
+ else
+ resultType = results.front();
+ return LLVMFunctionType::get(resultType, llvm::to_vector(args.getTypes()),
----------------
ivanradanov wrote:
```
tools/mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h.inc:108:27: note: candidate function not viable: no known conversion from 'mlir::ValueRange::type_range' (aka 'ValueTypeRange<mlir::ValueRange>') to 'ArrayRef<mlir::Type>' for 2nd argument
static LLVMFunctionType get(Type result, ArrayRef<Type> arguments, bool isVarArg = false);
```
I am getting this hence I added the `to_vector`
https://github.com/llvm/llvm-project/pull/67274
More information about the Mlir-commits
mailing list