mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-16 00:33:10 +00:00
llvm-as: Simplify, and don't create empty output files with -disable-output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84304 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9c7ca4a745
commit
79ec717193
@ -50,34 +50,7 @@ static cl::opt<bool>
|
|||||||
DisableVerify("disable-verify", cl::Hidden,
|
DisableVerify("disable-verify", cl::Hidden,
|
||||||
cl::desc("Do not run verifier on input LLVM (dangerous!)"));
|
cl::desc("Do not run verifier on input LLVM (dangerous!)"));
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
static void WriteOutputFile(const Module *M) {
|
||||||
// Print a stack trace if we signal out.
|
|
||||||
sys::PrintStackTraceOnErrorSignal();
|
|
||||||
PrettyStackTraceProgram X(argc, argv);
|
|
||||||
LLVMContext &Context = getGlobalContext();
|
|
||||||
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
|
||||||
cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n");
|
|
||||||
|
|
||||||
// Parse the file now...
|
|
||||||
SMDiagnostic Err;
|
|
||||||
std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
|
|
||||||
if (M.get() == 0) {
|
|
||||||
Err.Print(argv[0], errs());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DisableVerify) {
|
|
||||||
std::string Err;
|
|
||||||
if (verifyModule(*M.get(), ReturnStatusAction, &Err)) {
|
|
||||||
errs() << argv[0]
|
|
||||||
<< ": assembly parsed, but does not verify as correct!\n";
|
|
||||||
errs() << Err;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DumpAsm) errs() << "Here's the assembly:\n" << *M.get();
|
|
||||||
|
|
||||||
// Infer the output filename if needed.
|
// Infer the output filename if needed.
|
||||||
if (OutputFilename.empty()) {
|
if (OutputFilename.empty()) {
|
||||||
if (InputFilename == "-") {
|
if (InputFilename == "-") {
|
||||||
@ -106,12 +79,43 @@ int main(int argc, char **argv) {
|
|||||||
raw_fd_ostream::F_Binary));
|
raw_fd_ostream::F_Binary));
|
||||||
if (!ErrorInfo.empty()) {
|
if (!ErrorInfo.empty()) {
|
||||||
errs() << ErrorInfo << '\n';
|
errs() << ErrorInfo << '\n';
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Force || !CheckBitcodeOutputToConsole(*Out, true))
|
||||||
|
WriteBitcodeToFile(M, *Out);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
// Print a stack trace if we signal out.
|
||||||
|
sys::PrintStackTraceOnErrorSignal();
|
||||||
|
PrettyStackTraceProgram X(argc, argv);
|
||||||
|
LLVMContext &Context = getGlobalContext();
|
||||||
|
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
|
||||||
|
cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n");
|
||||||
|
|
||||||
|
// Parse the file now...
|
||||||
|
SMDiagnostic Err;
|
||||||
|
std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
|
||||||
|
if (M.get() == 0) {
|
||||||
|
Err.Print(argv[0], errs());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DisableVerify) {
|
||||||
|
std::string Err;
|
||||||
|
if (verifyModule(*M.get(), ReturnStatusAction, &Err)) {
|
||||||
|
errs() << argv[0]
|
||||||
|
<< ": assembly parsed, but does not verify as correct!\n";
|
||||||
|
errs() << Err;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DumpAsm) errs() << "Here's the assembly:\n" << *M.get();
|
||||||
|
|
||||||
if (!DisableOutput)
|
if (!DisableOutput)
|
||||||
if (Force || !CheckBitcodeOutputToConsole(*Out, true))
|
WriteOutputFile(M.get());
|
||||||
WriteBitcodeToFile(M.get(), *Out);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user