]> granicus.if.org Git - clang/commitdiff
Added most of the boilerplate to the driver needed to run the graph-reachability
authorTed Kremenek <kremenek@apple.com>
Tue, 8 Jan 2008 18:04:06 +0000 (18:04 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 8 Jan 2008 18:04:06 +0000 (18:04 +0000)
constant propagation analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45747 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/ASTConsumers.cpp
Driver/ASTConsumers.h
Driver/clang.cpp

index 1dbfb040d3449be0ff0e3344cf94b83c6b93c18a..bf0fc10bfe6f06cd744565eba51818f05205b1b1 100644 (file)
@@ -551,6 +551,25 @@ ASTConsumer *clang::CreateUnitValsChecker(Diagnostic &Diags) {
   return new UninitValsVisitor(Diags);
 }
 
+//===----------------------------------------------------------------------===//
+// 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
 
index 38e9fa556669d6bf4673b88e37b78575650175a7..58a20449d76b47b62d2e0bfccfa0dd73c15d6114 100644 (file)
@@ -38,6 +38,8 @@ ASTConsumer *CreateLiveVarAnalyzer();
 ASTConsumer *CreateDeadStoreChecker(Diagnostic &Diags);
 
 ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags);
+  
+ASTConsumer *CreateGRConstProp();
 
 ASTConsumer *CreateLLVMEmitter(Diagnostic &Diags, const LangOptions &Features);
 
index cdcbb34a51ca19b350de35ddb412d3ddf01bbcaf..50ff6d0162ae7c861ba05ae1c788b6f8bca3a971 100644 (file)
@@ -64,6 +64,7 @@ enum ProgActions {
   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 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
                         "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 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile,
     case WarnUninitVals:
       return CreateUnitValsChecker(Diag);
       
+    case AnalysisGRConstProp:
+      return CreateGRConstProp();
+      
     case TestSerialization:
       return CreateSerializationTest(Diag, FileMgr, LangOpts);