Convert internal representation to use DAG. This gives us more flexibility and enables future improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50724 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvmc2/llvmc.cpp b/tools/llvmc2/llvmc.cpp
index feed61f..65f5e11 100644
--- a/tools/llvmc2/llvmc.cpp
+++ b/tools/llvmc2/llvmc.cpp
@@ -28,13 +28,21 @@
namespace sys = llvm::sys;
using namespace llvmcc;
+// Built-in command-line options.
// External linkage here is intentional.
-cl::list<std::string> InputFilenames(cl::Positional,
- cl::desc("<input file>"), cl::OneOrMore);
+
+cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input file>"),
+ cl::OneOrMore);
cl::opt<std::string> OutputFilename("o", cl::desc("Output file name"),
cl::value_desc("file"));
-cl::opt<bool> VerboseMode("v", cl::desc("Enable verbose mode"));
-
+cl::opt<bool> VerboseMode("v",
+ cl::desc("Enable verbose mode"));
+cl::opt<bool> WriteGraph("write-graph",
+ cl::desc("Write CompilationGraph.dot file"),
+ cl::Hidden);
+cl::opt<bool> ViewGraph("view-graph",
+ cl::desc("Show compilation graph in GhostView"),
+ cl::Hidden);
namespace {
int BuildTargets(const CompilationGraph& graph) {
@@ -61,6 +69,12 @@
cl::ParseCommandLineOptions(argc, argv,
"LLVM Compiler Driver(Work In Progress)");
PopulateCompilationGraph(graph);
+
+ if(WriteGraph)
+ graph.writeGraph();
+ if(ViewGraph)
+ graph.viewGraph();
+
return BuildTargets(graph);
}
catch(const std::exception& ex) {