[all-commits] [llvm/llvm-project] 047400: [mlir][LLVMIR] Add support for InlineAsmOp

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Mon Nov 30 00:41:31 PST 2020


  Branch: refs/heads/temp-test-main
  Home:   https://github.com/llvm/llvm-project
  Commit: 047400ed8204ebcc0b361ca9285b34ea91479b69
      https://github.com/llvm/llvm-project/commit/047400ed8204ebcc0b361ca9285b34ea91479b69
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2020-11-30 (Mon, 30 Nov 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    A mlir/integration_test/Dialect/LLVMIR/CPU/X86/lit.local.cfg
    A mlir/integration_test/Dialect/LLVMIR/CPU/X86/test-inline-asm.mlir
    M mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M mlir/test/Dialect/LLVMIR/roundtrip.mlir
    M mlir/test/Target/llvmir.mlir
    M mlir/tools/mlir-cpu-runner/CMakeLists.txt
    M mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp

  Log Message:
  -----------
  [mlir][LLVMIR] Add support for InlineAsmOp

The InlineAsmOp mirrors the underlying LLVM semantics with a notable
exception: the embedded `asm_string` is not allowed to define or reference
any symbol or any global variable: only the operands of the op may be read,
written, or referenced.
Attempting to define or reference any symbol or any global behavior is
considered undefined behavior at this time.

The asm dialect syntax is currently specified with an integer (0 [default] for the "att dialect", 1 for the intel dialect) to circumvent the ODS limitation on string enums.

Translation to LLVM is provided and raises the fact that the asm constraints string must be well-formed with respect to in/out operands. No check is performed on the asm_string.

An InlineAsm instruction in LLVM is a special call operation to a function that is constructed on the fly.
It does not fit the current model of MLIR calls with symbols.
As a consequence, the current implementation constructs the function type in ModuleTranslation.cpp.
This should be refactored in the future.

The mlir-cpu-runner is augmented with the global initialization of the X86 asm parser to allow proper execution in JIT mode. Previously, only the X86 asm printer was initialized.

Differential revision: https://reviews.llvm.org/D92166




More information about the All-commits mailing list