diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-26 08:19:09 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-26 08:19:09 +0000 |
commit | 950bf6030101d670ea205efd307ea5d3b375544d (patch) | |
tree | dcc8bdebff4129d0d919ae5ea53bb45af9d32fba /tools/llvm-upgrade/llvm-upgrade.cpp | |
parent | efd53d57a6606bfe0549a7e4bd1f29c5582d5b75 (diff) |
Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-upgrade/llvm-upgrade.cpp')
-rw-r--r-- | tools/llvm-upgrade/llvm-upgrade.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tools/llvm-upgrade/llvm-upgrade.cpp b/tools/llvm-upgrade/llvm-upgrade.cpp index 38aa9ad052..d3a60cfa82 100644 --- a/tools/llvm-upgrade/llvm-upgrade.cpp +++ b/tools/llvm-upgrade/llvm-upgrade.cpp @@ -20,6 +20,8 @@ //===----------------------------------------------------------------------===// #include "UpgradeInternals.h" +#include "llvm/Module.h" +#include "llvm/Bytecode/Writer.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Streams.h" @@ -45,7 +47,11 @@ AddAttrs("add-attrs", cl::desc("Add function result and argument attributes"), cl::init(false)); static cl::opt<bool> -Debug("debug", cl::desc("Print debug output from yacc parser"),cl::Hidden, +Debug("debug-upgrade-yacc", cl::desc("Print debug output from yacc parser"), + cl::Hidden, cl::init(false)); + +static cl::opt<bool> +EmitByteCode("emit-bytecode", cl::desc("Emit bytecode instead of assembly"), cl::init(false)); int main(int argc, char **argv) { @@ -119,7 +125,20 @@ int main(int argc, char **argv) { return 1; } - UpgradeAssembly(InputFilename, *In, *Out, Debug, AddAttrs); + Module *M = UpgradeAssembly(InputFilename, *In, Debug, AddAttrs); + if (!M) { + cerr << argv[0] << ": No module returned from assembly parsing\n"; + if (!EmitByteCode) + *Out << argv[0] << ": parse failed."; + exit(1); + } + + // Finally, print the module on the output stream. + if (EmitByteCode) { + OStream OS(*Out); + WriteBytecodeToFile(M, OS); + } else + M->print(Out); } catch (const std::string& caught_message) { cerr << argv[0] << ": " << caught_message << "\n"; |