[MLIR] Refactor library initialization of JitRunner.
authorStephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Thu, 27 Feb 2020 17:47:37 +0000 (09:47 -0800)
committerStephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Fri, 28 Feb 2020 19:35:17 +0000 (11:35 -0800)
commitb7d50ba1ee39bbcea9497f105d8e9c651cc925b4
treee5cde677249b83d08e92638754682e1b02df9477
parentc07fb9e016b3b1190a66e02a6aa212dbe8c1a3e3
[MLIR] Refactor library initialization of JitRunner.

Previously, lib/Support/JitRunner.cpp was essentially a complete application,
performing all library initialization, along with dealing with command line
arguments and actually running passes.  This differs significantly from
mlir-opt and required a dependency on InitAllDialects.h.  This dependency
is significant, since it requires a dependency on all of the resulting
libraries.

This patch refactors the code so that tools are responsible for library
initialization, including registering all dialects, prior to calling
JitRunnerMain.  This places the concern about what dialect to support
with the end application, enabling more extensibility at the cost of
a small amount of code duplication between tools.  It also fixes
BUILD_SHARED_LIBS=on.

Differential Revision: https://reviews.llvm.org/D75272
mlir/lib/Support/JitRunner.cpp
mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp
mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp
mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp