summaryrefslogtreecommitdiff
path: root/tools/opt/opt.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-01-13 03:08:40 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-01-13 03:08:40 +0000
commit4a76032da63f0c9006336d9b9ab1074cf657b2c3 (patch)
tree54de43766a12eea76e6ea84c56df76eaa53b5849 /tools/opt/opt.cpp
parent63735e79ff83cf8b123231cceac10903b3d0ef22 (diff)
downloadllvm-4a76032da63f0c9006336d9b9ab1074cf657b2c3.tar.gz
llvm-4a76032da63f0c9006336d9b9ab1074cf657b2c3.tar.bz2
llvm-4a76032da63f0c9006336d9b9ab1074cf657b2c3.tar.xz
[PM] Add an enum for describing the desired output strategy, and run
that through the interface rather than a simple bool. This should allow starting to wire up real output to round-trip IR through opt with the new pass manager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r--tools/opt/opt.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 92b63bd830..c4ab342650 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -49,6 +49,7 @@
#include <algorithm>
#include <memory>
using namespace llvm;
+using namespace opt_tool;
// The OptimizationList is automatically populated with registered Passes by the
// PassNameParser.
@@ -670,14 +671,19 @@ int main(int argc, char **argv) {
if (CheckBitcodeOutputToConsole(Out->os(), !Quiet))
NoOutput = true;
- if (PassPipeline.getNumOccurrences() > 0)
+ if (PassPipeline.getNumOccurrences() > 0) {
+ OutputKind OK = OK_NoOutput;
+ if (!NoOutput)
+ OK = OutputAssembly ? OK_OutputAssembly : OK_OutputBitcode;
+
// The user has asked to use the new pass manager and provided a pipeline
// string. Hand off the rest of the functionality to the new code for that
// layer.
return runPassPipeline(argv[0], Context, *M.get(), Out.get(), PassPipeline,
- NoOutput)
+ OK)
? 0
: 1;
+ }
// Create a PassManager to hold and optimize the collection of passes we are
// about to build.