Added most of the boilerplate to the driver needed to run the graph-reachability
constant propagation analysis.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45747 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index 1dbfb04..bf0fc10 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -552,6 +552,25 @@
 }
 
 //===----------------------------------------------------------------------===//
+// GRConstProp - Perform intra-procedural, path-sensitive constant propagation.
+
+namespace {
+  class GRConstPropVisitor : public CFGVisitor {
+  public:
+    virtual void Initialize(ASTContext &Context) {}
+    
+    virtual void VisitCFG(CFG& C) {
+      // FIXME: Implement.
+      assert (false && "Not yet implemented.");
+    }
+  };
+} // end anonymous namespace
+
+ASTConsumer *clang::CreateGRConstProp() {
+  return new GRConstPropVisitor();
+}
+
+//===----------------------------------------------------------------------===//
 // LLVM Emitter
 
 #include "clang/Basic/Diagnostic.h"
diff --git a/Driver/ASTConsumers.h b/Driver/ASTConsumers.h
index 38e9fa5..58a2044 100644
--- a/Driver/ASTConsumers.h
+++ b/Driver/ASTConsumers.h
@@ -38,6 +38,8 @@
 ASTConsumer *CreateDeadStoreChecker(Diagnostic &Diags);
 
 ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags);
+  
+ASTConsumer *CreateGRConstProp();
 
 ASTConsumer *CreateLLVMEmitter(Diagnostic &Diags, const LangOptions &Features);
 
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index cdcbb34..50ff6d0 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -64,6 +64,7 @@
   ParseCFGDump,                 // Parse ASTS. Build CFGs. Print CFGs.
   ParseCFGView,                 // Parse ASTS. Build CFGs. View CFGs.
   AnalysisLiveVariables,        // Print results of live-variable analysis.
+  AnalysisGRConstProp,          // Perform graph-reachability constant prop.
   WarnDeadStores,               // Run DeadStores checker on parsed ASTs.
   WarnDeadStoresCheck,          // Check diagnostics for "DeadStores".
   WarnUninitVals,               // Run UnitializedVariables checker.
@@ -108,6 +109,8 @@
                         "Flag warnings of stores to dead variables."),
              clEnumValN(WarnUninitVals, "warn-uninit-values",
                         "Flag warnings of uses of unitialized variables."),
+             clEnumValN(AnalysisGRConstProp, "gr-const-prop",
+                        "Perform path-sensitive constant propagation."),                            
              clEnumValN(TestSerialization, "test-pickling",
                         "Run prototype serializtion code."),
              clEnumValN(EmitLLVM, "emit-llvm",
@@ -925,6 +928,9 @@
     case WarnUninitVals:
       return CreateUnitValsChecker(Diag);
       
+    case AnalysisGRConstProp:
+      return CreateGRConstProp();
+      
     case TestSerialization:
       return CreateSerializationTest(Diag, FileMgr, LangOpts);