namespace mlir {
void registerFromLLVMIRTranslation() {
TranslateToMLIRRegistration registration(
- "import-llvm", "translate llvmir to mlir",
+ "import-llvm", "Translate LLVMIR to MLIR",
[](llvm::SourceMgr &sourceMgr,
MLIRContext *context) -> OwningOpRef<Operation *> {
llvm::SMDiagnostic err;
namespace mlir {
void registerToLLVMIRTranslation() {
TranslateFromMLIRRegistration registration(
- "mlir-to-llvmir", "translate mlir to llvmir",
+ "mlir-to-llvmir", "Translate MLIR to LLVMIR",
[](Operation *op, raw_ostream &output) {
llvm::LLVMContext llvmContext;
auto llvmModule = translateModuleToLLVMIR(op, llvmContext);
#include "mlir/Parser/Parser.h"
#include "mlir/Support/FileUtilities.h"
#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/Timing.h"
#include "mlir/Support/ToolUtilities.h"
#include "mlir/Tools/mlir-translate/Translation.h"
#include "llvm/Support/InitLLVM.h"
registerAsmPrinterCLOptions();
registerMLIRContextCLOptions();
registerTranslationCLOptions();
+ registerDefaultTimingManagerCLOptions();
llvm::cl::ParseCommandLineOptions(argc, argv, toolName);
+ // Initialize the timing manager.
+ DefaultTimingManager tm;
+ applyDefaultTimingManagerCLOptions(tm);
+ TimingScope timing = tm.getRootScope();
+
std::string errorMessage;
std::unique_ptr<llvm::MemoryBuffer> input;
if (auto inputAlignment = translationsRequested[0]->getInputAlignment())
}
const Translation *translationRequested = translationsRequested[i];
+ TimingScope translationTiming =
+ timing.nest(translationRequested->getDescription());
+
MLIRContext context;
context.allowUnregisteredDialects(allowUnregisteredDialects);
context.printOpOnDiagnostic(!verifyDiagnostics);
--- /dev/null
+// RUN: mlir-translate %s --mlir-to-llvmir -mlir-timing 2>&1 | FileCheck %s
+
+// CHECK: Execution time report
+// CHECK: Total Execution Time:
+// CHECK: Name
+// CHECK-NEXT: Translate MLIR to LLVMIR
+
+llvm.func @foo() {
+ llvm.return
+}
--- /dev/null
+; RUN: mlir-translate %s -import-llvm -mlir-timing 2>&1 | FileCheck %s
+
+; CHECK: Execution time report
+; CHECK: Total Execution Time:
+; CHECK: Name
+; CHECK-NEXT: Translate LLVMIR to MLIR
+
+define void @foo() {
+ ret void
+}