[all-commits] [llvm/llvm-project] 26eb42: [MLIR][LLVM] Add vararg support in LLVM::CallOp an...

Ivan R. Ivanov via All-commits all-commits at lists.llvm.org
Wed Sep 27 23:26:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 26eb4285b56edd8c897642078d91f16ff0fd3472
      https://github.com/llvm/llvm-project/commit/26eb4285b56edd8c897642078d91f16ff0fd3472
  Author: Ivan R. Ivanov <ivanov.i.aa at m.titech.ac.jp>
  Date:   2023-09-28 (Thu, 28 Sep 2023)

  Changed paths:
    M mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
    M mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp
    M mlir/lib/Target/LLVMIR/ModuleImport.cpp
    M mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl-opencl.mlir
    M mlir/test/Conversion/GPUToROCDL/typed-pointers.mlir
    M mlir/test/Dialect/LLVMIR/invalid-typed-pointers.mlir
    M mlir/test/Dialect/LLVMIR/invalid.mlir
    M mlir/test/Dialect/LLVMIR/roundtrip.mlir
    M mlir/test/Target/LLVMIR/Import/exception.ll
    M mlir/test/Target/LLVMIR/Import/instructions.ll
    M mlir/test/Target/LLVMIR/llvmir.mlir
    M mlir/test/Target/LLVMIR/openmp-nested.mlir
    M mlir/test/mlir-cpu-runner/x86-varargs.mlir

  Log Message:
  -----------
  [MLIR][LLVM] Add vararg support in LLVM::CallOp and InvokeOp (#67274)

In order to support indirect vararg calls, we need to have information about the
callee type - this patch adds a `callee_type` attribute that holds that.

The attribute is required for vararg calls, else, it is optional and the callee
type is inferred by the operands and results of the operation if not present.

The syntax for non-vararg calls remains the same, whereas for vararg calls, it
is changed to this:

```
llvm.call %p(%arg0, %arg0) vararg(!llvm.func<void (i32, ...)>) : !llvm.ptr, (i32, i32) -> ()
llvm.call @s(%arg0, %arg0) vararg(!llvm.func<void (i32, ...)>) : (i32, i32) -> ()
```




More information about the All-commits mailing list