Skip to content

Commit e5901e2

Browse files
authored
- print javaruntime.jar path when -v (verbose) is specified for (#2958)
debugging aid - replace printf with llvm::outs() for consistency - fix typo ouputNameWithExt Signed-off-by: Gong Su <[email protected]>
1 parent 2570159 commit e5901e2

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/Compiler/CompilerUtils.cpp

+18-13
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,9 @@ static int genJniJar(const mlir::OwningOpRef<ModuleOp> &module,
582582

583583
// Copy javaruntime.jar to model jar.
584584
llvm::sys::fs::copy_file(javaRuntimeJarPath, modelJniJarPath);
585+
if (VerboseOutput)
586+
llvm::outs() << "cp " << javaRuntimeJarPath << " " << modelJniJarPath
587+
<< "\n";
585588

586589
// Add shared library to model jar.
587590
Command jar(getToolPath("jar", true));
@@ -798,8 +801,8 @@ static int emitOutputFiles(std::string outputNameNoExt,
798801
return rc;
799802
}
800803
if (VerboseOutput)
801-
printf(
802-
"Object file '%s' has been compiled.\n", modelObjNameWithExt.c_str());
804+
llvm::outs() << "Object file '" << modelObjNameWithExt
805+
<< "' has been compiled.\n";
803806
} break;
804807
case EmitLib: {
805808
std::string sharedLibNameWithExt;
@@ -813,8 +816,8 @@ static int emitOutputFiles(std::string outputNameNoExt,
813816
return rc;
814817
}
815818
if (VerboseOutput)
816-
printf("Shared library '%s' has been compiled.\n",
817-
sharedLibNameWithExt.c_str());
819+
llvm::outs() << "Shared library '" << sharedLibNameWithExt
820+
<< "' has been compiled.\n";
818821
} break;
819822
case EmitJNI: {
820823
int rc = compileModuleToJniJar(module, outputNameNoExt);
@@ -826,16 +829,17 @@ static int emitOutputFiles(std::string outputNameNoExt,
826829
return rc;
827830
}
828831
if (VerboseOutput)
829-
printf(
830-
"JNI archive '%s.jar' has been compiled.\n", outputNameNoExt.c_str());
832+
llvm::outs() << "JNI archive '" << outputNameNoExt
833+
<< ".jar' has been compiled.\n";
831834
} break;
832835
default: {
833836
// Emit the version with all constants included.
834-
std::string ouputNameWithExt =
837+
std::string outputNameWithExt =
835838
getTargetFilename(outputNameNoExt, emissionTarget);
836-
int rc = outputCode(module, ouputNameWithExt);
839+
int rc = outputCode(module, outputNameWithExt);
837840
if (VerboseOutput)
838-
printf("Full MLIR code written to: \n\t%s\n\n", ouputNameWithExt.c_str());
841+
llvm::outs() << "Full MLIR code written to:\n"
842+
<< "\t" << outputNameWithExt << "\n\n";
839843
if (rc != CompilerSuccess)
840844
return rc;
841845

@@ -845,10 +849,11 @@ static int emitOutputFiles(std::string outputNameNoExt,
845849
std::string tempNameWithExt = outputNameNoExt + ".tmp";
846850
int rc = outputCode(module, tempNameWithExt, /*largeElementLimit=*/100);
847851
if (VerboseOutput) {
848-
printf("Constant-free MLIR Code written to: \n\t%s\n\n",
849-
tempNameWithExt.c_str());
850-
printf("Use:\n\t%s\nto continue lowering the code to other dialects.\n",
851-
ouputNameWithExt.c_str());
852+
llvm::outs() << "Constant-free MLIR Code written to:\n"
853+
<< "\t" << tempNameWithExt << "\n\n";
854+
llvm::outs() << "Use:\n"
855+
<< "\t" << outputNameWithExt
856+
<< "\nto continue lowering the code to other dialects.\n";
852857
}
853858
if (rc != CompilerSuccess)
854859
return rc;

0 commit comments

Comments
 (0)