]> granicus.if.org Git - clang/commitdiff
Make clang-tblgen backends functions instead of TableGenBackends.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 13 Jun 2012 05:12:41 +0000 (05:12 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 13 Jun 2012 05:12:41 +0000 (05:12 +0000)
Get rid of a bunch of header files. TableGen output should be unaffected.

Patch by Sean Silva!

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

14 files changed:
utils/TableGen/ClangASTNodesEmitter.cpp
utils/TableGen/ClangASTNodesEmitter.h [deleted file]
utils/TableGen/ClangAttrEmitter.cpp
utils/TableGen/ClangAttrEmitter.h [deleted file]
utils/TableGen/ClangDiagnosticsEmitter.cpp
utils/TableGen/ClangDiagnosticsEmitter.h [deleted file]
utils/TableGen/ClangSACheckersEmitter.cpp
utils/TableGen/ClangSACheckersEmitter.h [deleted file]
utils/TableGen/NeonEmitter.cpp
utils/TableGen/NeonEmitter.h [deleted file]
utils/TableGen/OptParserEmitter.cpp
utils/TableGen/OptParserEmitter.h [deleted file]
utils/TableGen/TableGen.cpp
utils/TableGen/TableGenBackends.h [new file with mode: 0644]

index d9d5a3ccd90720c29cab0a8ccc69ae1461c0487c..c51ca9645db011052b804ec1507758a92a00c5be 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "ClangASTNodesEmitter.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
+#include <cctype>
+#include <map>
 #include <set>
+#include <string>
 using namespace llvm;
 
+/// ClangASTNodesEmitter - The top-level class emits .inc files containing
+///  declarations of Clang statements.
+///
+namespace {
+class ClangASTNodesEmitter {
+  // A map from a node to each of its derived nodes.
+  typedef std::multimap<Record*, Record*> ChildMap;
+  typedef ChildMap::const_iterator ChildIterator;
+
+  RecordKeeper &Records;
+  Record Root;
+  const std::string &BaseSuffix;
+
+  // Create a macro-ized version of a name
+  static std::string macroName(std::string S) {
+    for (unsigned i = 0; i < S.size(); ++i)
+      S[i] = std::toupper(S[i]);
+
+    return S;
+  }
+
+  // Return the name to be printed in the base field. Normally this is
+  // the record's name plus the base suffix, but if it is the root node and
+  // the suffix is non-empty, it's just the suffix.
+  std::string baseName(Record &R) {
+    if (&R == &Root && !BaseSuffix.empty())
+      return BaseSuffix;
+
+    return R.getName() + BaseSuffix;
+  }
+
+  std::pair<Record *, Record *> EmitNode (const ChildMap &Tree, raw_ostream& OS,
+                                          Record *Base);
+public:
+  explicit ClangASTNodesEmitter(RecordKeeper &R, const std::string &N,
+                                const std::string &S)
+    : Records(R), Root(N, SMLoc(), R), BaseSuffix(S)
+    {}
+
+  // run - Output the .inc file contents
+  void run(raw_ostream &OS);
+};
+} // end anonymous namespace
+
 //===----------------------------------------------------------------------===//
 // Statement Node Tables (.inc file) generation.
 //===----------------------------------------------------------------------===//
@@ -124,7 +172,15 @@ void ClangASTNodesEmitter::run(raw_ostream &OS) {
   OS << "#undef ABSTRACT_" << macroName(Root.getName()) << "\n";
 }
 
-void ClangDeclContextEmitter::run(raw_ostream &OS) {
+namespace clang {
+void EmitClangASTNodes(RecordKeeper &RK, raw_ostream &OS,
+                       const std::string &N, const std::string &S) {
+  ClangASTNodesEmitter(RK, N, S).run(OS);
+}
+
+// Emits and addendum to a .inc file to enumerate the clang declaration
+// contexts.
+void EmitClangDeclContext(RecordKeeper &Records, raw_ostream &OS) {
   // FIXME: Find a .td file format to allow for this to be represented better.
 
   OS << "#ifndef DECL_CONTEXT\n";
@@ -166,3 +222,4 @@ void ClangDeclContextEmitter::run(raw_ostream &OS) {
   OS << "#undef DECL_CONTEXT\n";
   OS << "#undef DECL_CONTEXT_BASE\n";
 }
+} // end namespace clang
diff --git a/utils/TableGen/ClangASTNodesEmitter.h b/utils/TableGen/ClangASTNodesEmitter.h
deleted file mode 100644 (file)
index edd9316..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-//===- ClangASTNodesEmitter.h - Generate Clang AST node tables -*- C++ -*--===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These tablegen backends emit Clang AST node tables
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef CLANGAST_EMITTER_H
-#define CLANGAST_EMITTER_H
-
-#include "llvm/TableGen/TableGenBackend.h"
-#include "llvm/TableGen/Record.h"
-#include <string>
-#include <cctype>
-#include <map>
-
-namespace llvm {
-
-/// ClangASTNodesEmitter - The top-level class emits .inc files containing
-///  declarations of Clang statements.
-///
-class ClangASTNodesEmitter : public TableGenBackend {
-  // A map from a node to each of its derived nodes.
-  typedef std::multimap<Record*, Record*> ChildMap;
-  typedef ChildMap::const_iterator ChildIterator;
-
-  RecordKeeper &Records;
-  Record Root;
-  const std::string &BaseSuffix;
-
-  // Create a macro-ized version of a name
-  static std::string macroName(std::string S) {
-    for (unsigned i = 0; i < S.size(); ++i)
-      S[i] = std::toupper(S[i]);
-
-    return S;
-  }
-
-  // Return the name to be printed in the base field. Normally this is
-  // the record's name plus the base suffix, but if it is the root node and
-  // the suffix is non-empty, it's just the suffix.
-  std::string baseName(Record &R) {
-    if (&R == &Root && !BaseSuffix.empty())
-      return BaseSuffix;
-    
-    return R.getName() + BaseSuffix;
-  }
-
-  std::pair<Record *, Record *> EmitNode (const ChildMap &Tree, raw_ostream& OS,
-                                          Record *Base);
-public:
-  explicit ClangASTNodesEmitter(RecordKeeper &R, const std::string &N,
-                                const std::string &S)
-    : Records(R), Root(N, SMLoc(), R), BaseSuffix(S)
-    {}
-
-  // run - Output the .inc file contents
-  void run(raw_ostream &OS);
-};
-
-/// ClangDeclContextEmitter - Emits an addendum to a .inc file to enumerate the
-/// clang declaration contexts.
-///
-class ClangDeclContextEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
-public:
-  explicit ClangDeclContextEmitter(RecordKeeper &R)
-    : Records(R)
-  {}
-
-  // run - Output the .inc file contents
-  void run(raw_ostream &OS);
-};
-
-} // End llvm namespace
-
-#endif
index 8a8987720ef627c102b893067325e4fe0fba4a70..abca58d578375ae56ccea1034fbcab9f66032a4c 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "ClangAttrEmitter.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/TableGen/Record.h"
 #include "llvm/TableGen/StringMatcher.h"
+#include "llvm/TableGen/TableGenBackend.h"
 #include <algorithm>
 #include <cctype>
 #include <set>
@@ -661,7 +661,10 @@ static void writeAvailabilityValue(raw_ostream &OS) {
      << "  OS << \"";
 }
 
-void ClangAttrClassEmitter::run(raw_ostream &OS) {
+namespace clang {
+
+// Emits the class definitions for attributes.
+void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
   OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
   OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n\n";
@@ -750,7 +753,8 @@ void ClangAttrClassEmitter::run(raw_ostream &OS) {
   OS << "#endif\n";
 }
 
-void ClangAttrImplEmitter::run(raw_ostream &OS) {
+// Emits the class method definitions for attributes.
+void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
 
   std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
@@ -801,6 +805,8 @@ void ClangAttrImplEmitter::run(raw_ostream &OS) {
   }
 }
 
+} // end namespace clang
+
 static void EmitAttrList(raw_ostream &OS, StringRef Class,
                          const std::vector<Record*> &AttrList) {
   std::vector<Record*>::const_iterator i = AttrList.begin(), e = AttrList.end();
@@ -818,7 +824,10 @@ static void EmitAttrList(raw_ostream &OS, StringRef Class,
   }
 }
 
-void ClangAttrListEmitter::run(raw_ostream &OS) {
+namespace clang {
+
+// Emits the enumeration list for attributes.
+void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
 
   OS << "#ifndef LAST_ATTR\n";
@@ -870,7 +879,8 @@ void ClangAttrListEmitter::run(raw_ostream &OS) {
   OS << "#undef ATTR\n";
 }
 
-void ClangAttrPCHReadEmitter::run(raw_ostream &OS) {
+// Emits the code to read an attribute from a precompiled header.
+void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
 
   Record *InhClass = Records.getClass("InheritableAttr");
@@ -913,7 +923,8 @@ void ClangAttrPCHReadEmitter::run(raw_ostream &OS) {
   OS << "  }\n";
 }
 
-void ClangAttrPCHWriteEmitter::run(raw_ostream &OS) {
+// Emits the code to write an attribute to a precompiled header.
+void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
   Record *InhClass = Records.getClass("InheritableAttr");
   std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr"), Args;
   std::vector<Record*>::iterator i = Attrs.begin(), e = Attrs.end(), ai, ae;
@@ -941,7 +952,8 @@ void ClangAttrPCHWriteEmitter::run(raw_ostream &OS) {
   OS << "  }\n";
 }
 
-void ClangAttrSpellingListEmitter::run(raw_ostream &OS) {
+// Emits the list of spellings for attributes.
+void EmitClangAttrSpellingList(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
 
   std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
@@ -959,7 +971,8 @@ void ClangAttrSpellingListEmitter::run(raw_ostream &OS) {
 
 }
 
-void ClangAttrLateParsedListEmitter::run(raw_ostream &OS) {
+// Emits the LateParsed property for attributes.
+void EmitClangAttrLateParsedList(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
 
   std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
@@ -982,8 +995,8 @@ void ClangAttrLateParsedListEmitter::run(raw_ostream &OS) {
   }
 }
 
-
-void ClangAttrTemplateInstantiateEmitter::run(raw_ostream &OS) {
+// Emits code to instantiate dependent attributes on templates.
+void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
 
   std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
@@ -1055,7 +1068,8 @@ void ClangAttrTemplateInstantiateEmitter::run(raw_ostream &OS) {
      << "} // end namespace clang\n";
 }
 
-void ClangAttrParsedAttrListEmitter::run(raw_ostream &OS) {
+// Emits the list of parsed attributes.
+void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
   
   OS << "#ifndef PARSED_ATTR\n";
@@ -1096,7 +1110,8 @@ void ClangAttrParsedAttrListEmitter::run(raw_ostream &OS) {
   }
 }
 
-void ClangAttrParsedAttrKindsEmitter::run(raw_ostream &OS) {
+// Emits the kind list of parsed attributes
+void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
   OS << "// This file is generated by TableGen. Do not edit.\n\n";
   OS << "\n";
   
@@ -1141,4 +1156,4 @@ void ClangAttrParsedAttrKindsEmitter::run(raw_ostream &OS) {
      << "}\n";
 }
 
-
+} // end namespace clang
diff --git a/utils/TableGen/ClangAttrEmitter.h b/utils/TableGen/ClangAttrEmitter.h
deleted file mode 100644 (file)
index d119a09..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-//===- ClangAttrEmitter.h - Generate Clang attribute handling =-*- C++ -*--===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These tablegen backends emit Clang attribute processing code
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef CLANGATTR_EMITTER_H
-#define CLANGATTR_EMITTER_H
-
-#include "llvm/TableGen/TableGenBackend.h"
-
-namespace llvm {
-
-/// ClangAttrClassEmitter - class emits the class defintions for attributes for
-///   clang.
-class ClangAttrClassEmitter : public TableGenBackend {
-  RecordKeeper &Records;
- public:
-  explicit ClangAttrClassEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrImplEmitter - class emits the class method defintions for
-///   attributes for clang.
-class ClangAttrImplEmitter : public TableGenBackend {
-  RecordKeeper &Records;
- public:
-  explicit ClangAttrImplEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrListEmitter - class emits the enumeration list for attributes for
-///   clang.
-class ClangAttrListEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
- public:
-  explicit ClangAttrListEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrPCHReadEmitter - class emits the code to read an attribute from
-///   a clang precompiled header.
-class ClangAttrPCHReadEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
-public:
-  explicit ClangAttrPCHReadEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrPCHWriteEmitter - class emits the code to read an attribute from
-///   a clang precompiled header.
-class ClangAttrPCHWriteEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
-public:
-  explicit ClangAttrPCHWriteEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrSpellingListEmitter - class emits the list of spellings for attributes for
-///   clang.
-class ClangAttrSpellingListEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
- public:
-  explicit ClangAttrSpellingListEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrLateParsedListEmitter emits the LateParsed property for attributes
-/// for clang.
-class ClangAttrLateParsedListEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
- public:
-  explicit ClangAttrLateParsedListEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrTemplateInstantiateEmitter emits code to instantiate dependent
-/// attributes on templates.
-class ClangAttrTemplateInstantiateEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
- public:
-  explicit ClangAttrTemplateInstantiateEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrParsedAttrListEmitter emits the list of parsed attributes
-/// for clang.
-class ClangAttrParsedAttrListEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
-public:
-  explicit ClangAttrParsedAttrListEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-/// ClangAttrParsedAttrKindsEmitter emits the kind list of parsed attributes
-/// for clang.
-class ClangAttrParsedAttrKindsEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-
-public:
-  explicit ClangAttrParsedAttrKindsEmitter(RecordKeeper &R)
-    : Records(R)
-    {}
-
-  void run(raw_ostream &OS);
-};
-
-}
-
-#endif
index 520ec0a2c5483276345f7054f9369afe486ba35f..2df7ca97ce4f47234d53b4cb9866787e3502d585 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "ClangDiagnosticsEmitter.h"
-#include "llvm/TableGen/Record.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/SmallString.h"
-#include <map>
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
 #include <algorithm>
 #include <functional>
+#include <map>
 #include <set>
 using namespace llvm;
 
@@ -163,7 +163,11 @@ static void groupDiagnostics(const std::vector<Record*> &Diags,
 // Warning Tables (.inc file) generation.
 //===----------------------------------------------------------------------===//
 
-void ClangDiagsDefsEmitter::run(raw_ostream &OS) {
+/// ClangDiagsDefsEmitter - The top-level class emits .def files containing
+/// declarations of Clang diagnostics.
+namespace clang {
+void EmitClangDiagsDefs(RecordKeeper &Records, raw_ostream &OS,
+                        const std::string &Component) {
   // Write the #if guard
   if (!Component.empty()) {
     std::string ComponentName = StringRef(Component).upper();
@@ -244,6 +248,7 @@ void ClangDiagsDefsEmitter::run(raw_ostream &OS) {
     OS << ")\n";
   }
 }
+} // end namespace clang
 
 //===----------------------------------------------------------------------===//
 // Warning Group Tables generation
@@ -258,7 +263,8 @@ static std::string getDiagCategoryEnum(llvm::StringRef name) {
   return enumName.str();
 }
 
-void ClangDiagGroupsEmitter::run(raw_ostream &OS) {
+namespace clang {
+void EmitClangDiagGroups(RecordKeeper &Records, raw_ostream &OS) {
   // Compute a mapping from a DiagGroup to all of its parents.
   DiagGroupParentMap DGParentMap(Records);
   
@@ -339,6 +345,7 @@ void ClangDiagGroupsEmitter::run(raw_ostream &OS) {
     OS << "CATEGORY(\"" << *I << "\", " << getDiagCategoryEnum(*I) << ")\n";
   OS << "#endif // GET_CATEGORY_TABLE\n\n";
 }
+} // end namespace clang
 
 //===----------------------------------------------------------------------===//
 // Diagnostic name index generation
@@ -366,7 +373,8 @@ struct RecordIndexElementSorter :
 
 } // end anonymous namespace.
 
-void ClangDiagsIndexNameEmitter::run(raw_ostream &OS) {
+namespace clang {
+void EmitClangDiagsIndexName(RecordKeeper &Records, raw_ostream &OS) {
   const std::vector<Record*> &Diags =
     Records.getAllDerivedDefinitions("Diagnostic");
   
@@ -385,3 +393,4 @@ void ClangDiagsIndexNameEmitter::run(raw_ostream &OS) {
     OS << "DIAG_NAME_INDEX(" << R.Name << ")\n";
   }
 }
+} // end namespace clang
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.h b/utils/TableGen/ClangDiagnosticsEmitter.h
deleted file mode 100644 (file)
index 73d3c4d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//===- ClangDiagnosticsEmitter.h - Generate Clang diagnostics tables -*- C++ -*-
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These tablegen backends emit Clang diagnostics tables.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef CLANGDIAGS_EMITTER_H
-#define CLANGDIAGS_EMITTER_H
-
-#include "llvm/TableGen/TableGenBackend.h"
-
-namespace llvm {
-
-/// ClangDiagsDefsEmitter - The top-level class emits .def files containing
-///  declarations of Clang diagnostics.
-///
-class ClangDiagsDefsEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-  const std::string& Component;
-public:
-  explicit ClangDiagsDefsEmitter(RecordKeeper &R, const std::string& component)
-    : Records(R), Component(component) {}
-
-  // run - Output the .def file contents
-  void run(raw_ostream &OS);
-};
-
-class ClangDiagGroupsEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-public:
-  explicit ClangDiagGroupsEmitter(RecordKeeper &R) : Records(R) {}
-    
-  void run(raw_ostream &OS);
-};
-
-class ClangDiagsIndexNameEmitter : public TableGenBackend {
-  RecordKeeper &Records;
-public:
-  explicit ClangDiagsIndexNameEmitter(RecordKeeper &R) : Records(R) {}
-  
-  void run(raw_ostream &OS);
-};
-
-  
-} // End llvm namespace
-
-#endif
index 423b68a6484239078966cc004ca3b217256fe6fd..5a0db501dff97ab0bfac3bda5ab6b83bcaf3f5fe 100644 (file)
@@ -11,9 +11,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "ClangSACheckersEmitter.h"
-#include "llvm/TableGen/Record.h"
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
 #include <map>
 #include <string>
 using namespace llvm;
@@ -93,7 +93,8 @@ static void addPackageToCheckerGroup(const Record *package, const Record *group,
     addPackageToCheckerGroup(*I, group, recordGroupMap);
 }
 
-void ClangSACheckersEmitter::run(raw_ostream &OS) {
+namespace clang {
+void EmitClangSACheckers(RecordKeeper &Records, raw_ostream &OS) {
   std::vector<Record*> checkers = Records.getAllDerivedDefinitions("Checker");
   llvm::DenseMap<const Record *, unsigned> checkerRecIndexMap;
   for (unsigned i = 0, e = checkers.size(); i != e; ++i)
@@ -317,3 +318,4 @@ void ClangSACheckersEmitter::run(raw_ostream &OS) {
   }
   OS << "#endif // GET_CHECKNAME_TABLE\n\n";
 }
+} // end namespace clang
diff --git a/utils/TableGen/ClangSACheckersEmitter.h b/utils/TableGen/ClangSACheckersEmitter.h
deleted file mode 100644 (file)
index 5a0e148..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-//===- ClangSACheckersEmitter.h - Generate Clang SA checkers tables -*- C++ -*-
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This tablegen backend emits Clang Static Analyzer checkers tables.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef CLANGSACHECKERS_EMITTER_H
-#define CLANGSACHECKERS_EMITTER_H
-
-#include "llvm/TableGen/TableGenBackend.h"
-
-namespace llvm {
-
-class ClangSACheckersEmitter : public TableGenBackend {
-    RecordKeeper &Records;
-public:
-  explicit ClangSACheckersEmitter(RecordKeeper &R) : Records(R) {}
-
-  void run(raw_ostream &OS);
-};
-
-} // End llvm namespace
-
-#endif
index 385deb8a1c7e58983b14c7ceee0d8ade58a3b540..5cb40c501f818f3530938ff1f869c9813f83d4bb 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "NeonEmitter.h"
-#include "llvm/TableGen/Error.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/TableGen/Error.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
 #include <string>
-
 using namespace llvm;
 
+enum OpKind {
+  OpNone,
+  OpUnavailable,
+  OpAdd,
+  OpAddl,
+  OpAddw,
+  OpSub,
+  OpSubl,
+  OpSubw,
+  OpMul,
+  OpMla,
+  OpMlal,
+  OpMls,
+  OpMlsl,
+  OpMulN,
+  OpMlaN,
+  OpMlsN,
+  OpMlalN,
+  OpMlslN,
+  OpMulLane,
+  OpMullLane,
+  OpMlaLane,
+  OpMlsLane,
+  OpMlalLane,
+  OpMlslLane,
+  OpQDMullLane,
+  OpQDMlalLane,
+  OpQDMlslLane,
+  OpQDMulhLane,
+  OpQRDMulhLane,
+  OpEq,
+  OpGe,
+  OpLe,
+  OpGt,
+  OpLt,
+  OpNeg,
+  OpNot,
+  OpAnd,
+  OpOr,
+  OpXor,
+  OpAndNot,
+  OpOrNot,
+  OpCast,
+  OpConcat,
+  OpDup,
+  OpDupLane,
+  OpHi,
+  OpLo,
+  OpSelect,
+  OpRev16,
+  OpRev32,
+  OpRev64,
+  OpReinterpret,
+  OpAbdl,
+  OpAba,
+  OpAbal
+};
+
+enum ClassKind {
+  ClassNone,
+  ClassI,           // generic integer instruction, e.g., "i8" suffix
+  ClassS,           // signed/unsigned/poly, e.g., "s8", "u8" or "p8" suffix
+  ClassW,           // width-specific instruction, e.g., "8" suffix
+  ClassB            // bitcast arguments with enum argument to specify type
+};
+
+/// NeonTypeFlags - Flags to identify the types for overloaded Neon
+/// builtins.  These must be kept in sync with the flags in
+/// include/clang/Basic/TargetBuiltins.h.
+namespace {
+class NeonTypeFlags {
+  enum {
+    EltTypeMask = 0xf,
+    UnsignedFlag = 0x10,
+    QuadFlag = 0x20
+  };
+  uint32_t Flags;
+
+public:
+  enum EltType {
+    Int8,
+    Int16,
+    Int32,
+    Int64,
+    Poly8,
+    Poly16,
+    Float16,
+    Float32
+  };
+
+  NeonTypeFlags(unsigned F) : Flags(F) {}
+  NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
+    if (IsUnsigned)
+      Flags |= UnsignedFlag;
+    if (IsQuad)
+      Flags |= QuadFlag;
+  }
+
+  uint32_t getFlags() const { return Flags; }
+};
+} // end anonymous namespace
+
+namespace {
+class NeonEmitter {
+  RecordKeeper &Records;
+  StringMap<OpKind> OpMap;
+  DenseMap<Record*, ClassKind> ClassMap;
+
+public:
+  NeonEmitter(RecordKeeper &R) : Records(R) {
+    OpMap["OP_NONE"]  = OpNone;
+    OpMap["OP_UNAVAILABLE"] = OpUnavailable;
+    OpMap["OP_ADD"]   = OpAdd;
+    OpMap["OP_ADDL"]  = OpAddl;
+    OpMap["OP_ADDW"]  = OpAddw;
+    OpMap["OP_SUB"]   = OpSub;
+    OpMap["OP_SUBL"]  = OpSubl;
+    OpMap["OP_SUBW"]  = OpSubw;
+    OpMap["OP_MUL"]   = OpMul;
+    OpMap["OP_MLA"]   = OpMla;
+    OpMap["OP_MLAL"]  = OpMlal;
+    OpMap["OP_MLS"]   = OpMls;
+    OpMap["OP_MLSL"]  = OpMlsl;
+    OpMap["OP_MUL_N"] = OpMulN;
+    OpMap["OP_MLA_N"] = OpMlaN;
+    OpMap["OP_MLS_N"] = OpMlsN;
+    OpMap["OP_MLAL_N"] = OpMlalN;
+    OpMap["OP_MLSL_N"] = OpMlslN;
+    OpMap["OP_MUL_LN"]= OpMulLane;
+    OpMap["OP_MULL_LN"] = OpMullLane;
+    OpMap["OP_MLA_LN"]= OpMlaLane;
+    OpMap["OP_MLS_LN"]= OpMlsLane;
+    OpMap["OP_MLAL_LN"] = OpMlalLane;
+    OpMap["OP_MLSL_LN"] = OpMlslLane;
+    OpMap["OP_QDMULL_LN"] = OpQDMullLane;
+    OpMap["OP_QDMLAL_LN"] = OpQDMlalLane;
+    OpMap["OP_QDMLSL_LN"] = OpQDMlslLane;
+    OpMap["OP_QDMULH_LN"] = OpQDMulhLane;
+    OpMap["OP_QRDMULH_LN"] = OpQRDMulhLane;
+    OpMap["OP_EQ"]    = OpEq;
+    OpMap["OP_GE"]    = OpGe;
+    OpMap["OP_LE"]    = OpLe;
+    OpMap["OP_GT"]    = OpGt;
+    OpMap["OP_LT"]    = OpLt;
+    OpMap["OP_NEG"]   = OpNeg;
+    OpMap["OP_NOT"]   = OpNot;
+    OpMap["OP_AND"]   = OpAnd;
+    OpMap["OP_OR"]    = OpOr;
+    OpMap["OP_XOR"]   = OpXor;
+    OpMap["OP_ANDN"]  = OpAndNot;
+    OpMap["OP_ORN"]   = OpOrNot;
+    OpMap["OP_CAST"]  = OpCast;
+    OpMap["OP_CONC"]  = OpConcat;
+    OpMap["OP_HI"]    = OpHi;
+    OpMap["OP_LO"]    = OpLo;
+    OpMap["OP_DUP"]   = OpDup;
+    OpMap["OP_DUP_LN"] = OpDupLane;
+    OpMap["OP_SEL"]   = OpSelect;
+    OpMap["OP_REV16"] = OpRev16;
+    OpMap["OP_REV32"] = OpRev32;
+    OpMap["OP_REV64"] = OpRev64;
+    OpMap["OP_REINT"] = OpReinterpret;
+    OpMap["OP_ABDL"]  = OpAbdl;
+    OpMap["OP_ABA"]   = OpAba;
+    OpMap["OP_ABAL"]  = OpAbal;
+
+    Record *SI = R.getClass("SInst");
+    Record *II = R.getClass("IInst");
+    Record *WI = R.getClass("WInst");
+    ClassMap[SI] = ClassS;
+    ClassMap[II] = ClassI;
+    ClassMap[WI] = ClassW;
+  }
+
+  // run - Emit arm_neon.h.inc
+  void run(raw_ostream &o);
+
+  // runHeader - Emit all the __builtin prototypes used in arm_neon.h
+  void runHeader(raw_ostream &o);
+
+  // runTests - Emit tests for all the Neon intrinsics.
+  void runTests(raw_ostream &o);
+
+private:
+  void emitIntrinsic(raw_ostream &OS, Record *R);
+};
+} // end anonymous namespace
+
 /// ParseTypes - break down a string such as "fQf" into a vector of StringRefs,
 /// which each StringRef representing a single type declared in the string.
 /// for "fQf" we would end up with 2 StringRefs, "f", and "Qf", representing
@@ -1576,3 +1766,14 @@ void NeonEmitter::runTests(raw_ostream &OS) {
   }
 }
 
+namespace clang {
+void EmitNeon(RecordKeeper &Records, raw_ostream &OS) {
+  NeonEmitter(Records).run(OS);
+}
+void EmitNeonSema(RecordKeeper &Records, raw_ostream &OS) {
+  NeonEmitter(Records).runHeader(OS);
+}
+void EmitNeonTest(RecordKeeper &Records, raw_ostream &OS) {
+  NeonEmitter(Records).runTests(OS);
+}
+} // End namespace clang
diff --git a/utils/TableGen/NeonEmitter.h b/utils/TableGen/NeonEmitter.h
deleted file mode 100644 (file)
index 7a703fe..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-//===- NeonEmitter.h - Generate arm_neon.h for use with clang ---*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This tablegen backend is responsible for emitting arm_neon.h, which includes
-// a declaration and definition of each function specified by the ARM NEON
-// compiler interface.  See ARM document DUI0348B.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef NEON_EMITTER_H
-#define NEON_EMITTER_H
-
-#include "llvm/TableGen/Record.h"
-#include "llvm/TableGen/TableGenBackend.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/StringMap.h"
-
-enum OpKind {
-  OpNone,
-  OpUnavailable,
-  OpAdd,
-  OpAddl,
-  OpAddw,
-  OpSub,
-  OpSubl,
-  OpSubw,
-  OpMul,
-  OpMla,
-  OpMlal,
-  OpMls,
-  OpMlsl,
-  OpMulN,
-  OpMlaN,
-  OpMlsN,
-  OpMlalN,
-  OpMlslN,
-  OpMulLane,
-  OpMullLane,
-  OpMlaLane,
-  OpMlsLane,
-  OpMlalLane,
-  OpMlslLane,
-  OpQDMullLane,
-  OpQDMlalLane,
-  OpQDMlslLane,
-  OpQDMulhLane,
-  OpQRDMulhLane,
-  OpEq,
-  OpGe,
-  OpLe,
-  OpGt,
-  OpLt,
-  OpNeg,
-  OpNot,
-  OpAnd,
-  OpOr,
-  OpXor,
-  OpAndNot,
-  OpOrNot,
-  OpCast,
-  OpConcat,
-  OpDup,
-  OpDupLane,
-  OpHi,
-  OpLo,
-  OpSelect,
-  OpRev16,
-  OpRev32,
-  OpRev64,
-  OpReinterpret,
-  OpAbdl,
-  OpAba,
-  OpAbal
-};
-
-enum ClassKind {
-  ClassNone,
-  ClassI,           // generic integer instruction, e.g., "i8" suffix
-  ClassS,           // signed/unsigned/poly, e.g., "s8", "u8" or "p8" suffix
-  ClassW,           // width-specific instruction, e.g., "8" suffix
-  ClassB            // bitcast arguments with enum argument to specify type
-};
-
-/// NeonTypeFlags - Flags to identify the types for overloaded Neon
-/// builtins.  These must be kept in sync with the flags in
-/// include/clang/Basic/TargetBuiltins.h.
-class NeonTypeFlags {
-  enum {
-    EltTypeMask = 0xf,
-    UnsignedFlag = 0x10,
-    QuadFlag = 0x20
-  };
-  uint32_t Flags;
-
-public:
-  enum EltType {
-    Int8,
-    Int16,
-    Int32,
-    Int64,
-    Poly8,
-    Poly16,
-    Float16,
-    Float32
-  };
-
-  NeonTypeFlags(unsigned F) : Flags(F) {}
-  NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) {
-    if (IsUnsigned)
-      Flags |= UnsignedFlag;
-    if (IsQuad)
-      Flags |= QuadFlag;
-  }
-
-  uint32_t getFlags() const { return Flags; }
-};
-
-namespace llvm {
-
-  class NeonEmitter : public TableGenBackend {
-    RecordKeeper &Records;
-    StringMap<OpKind> OpMap;
-    DenseMap<Record*, ClassKind> ClassMap;
-
-  public:
-    NeonEmitter(RecordKeeper &R) : Records(R) {
-      OpMap["OP_NONE"]  = OpNone;
-      OpMap["OP_UNAVAILABLE"] = OpUnavailable;
-      OpMap["OP_ADD"]   = OpAdd;
-      OpMap["OP_ADDL"]  = OpAddl;
-      OpMap["OP_ADDW"]  = OpAddw;
-      OpMap["OP_SUB"]   = OpSub;
-      OpMap["OP_SUBL"]  = OpSubl;
-      OpMap["OP_SUBW"]  = OpSubw;
-      OpMap["OP_MUL"]   = OpMul;
-      OpMap["OP_MLA"]   = OpMla;
-      OpMap["OP_MLAL"]  = OpMlal;
-      OpMap["OP_MLS"]   = OpMls;
-      OpMap["OP_MLSL"]  = OpMlsl;
-      OpMap["OP_MUL_N"] = OpMulN;
-      OpMap["OP_MLA_N"] = OpMlaN;
-      OpMap["OP_MLS_N"] = OpMlsN;
-      OpMap["OP_MLAL_N"] = OpMlalN;
-      OpMap["OP_MLSL_N"] = OpMlslN;
-      OpMap["OP_MUL_LN"]= OpMulLane;
-      OpMap["OP_MULL_LN"] = OpMullLane;
-      OpMap["OP_MLA_LN"]= OpMlaLane;
-      OpMap["OP_MLS_LN"]= OpMlsLane;
-      OpMap["OP_MLAL_LN"] = OpMlalLane;
-      OpMap["OP_MLSL_LN"] = OpMlslLane;
-      OpMap["OP_QDMULL_LN"] = OpQDMullLane;
-      OpMap["OP_QDMLAL_LN"] = OpQDMlalLane;
-      OpMap["OP_QDMLSL_LN"] = OpQDMlslLane;
-      OpMap["OP_QDMULH_LN"] = OpQDMulhLane;
-      OpMap["OP_QRDMULH_LN"] = OpQRDMulhLane;
-      OpMap["OP_EQ"]    = OpEq;
-      OpMap["OP_GE"]    = OpGe;
-      OpMap["OP_LE"]    = OpLe;
-      OpMap["OP_GT"]    = OpGt;
-      OpMap["OP_LT"]    = OpLt;
-      OpMap["OP_NEG"]   = OpNeg;
-      OpMap["OP_NOT"]   = OpNot;
-      OpMap["OP_AND"]   = OpAnd;
-      OpMap["OP_OR"]    = OpOr;
-      OpMap["OP_XOR"]   = OpXor;
-      OpMap["OP_ANDN"]  = OpAndNot;
-      OpMap["OP_ORN"]   = OpOrNot;
-      OpMap["OP_CAST"]  = OpCast;
-      OpMap["OP_CONC"]  = OpConcat;
-      OpMap["OP_HI"]    = OpHi;
-      OpMap["OP_LO"]    = OpLo;
-      OpMap["OP_DUP"]   = OpDup;
-      OpMap["OP_DUP_LN"] = OpDupLane;
-      OpMap["OP_SEL"]   = OpSelect;
-      OpMap["OP_REV16"] = OpRev16;
-      OpMap["OP_REV32"] = OpRev32;
-      OpMap["OP_REV64"] = OpRev64;
-      OpMap["OP_REINT"] = OpReinterpret;
-      OpMap["OP_ABDL"]  = OpAbdl;
-      OpMap["OP_ABA"]   = OpAba;
-      OpMap["OP_ABAL"]  = OpAbal;
-
-      Record *SI = R.getClass("SInst");
-      Record *II = R.getClass("IInst");
-      Record *WI = R.getClass("WInst");
-      ClassMap[SI] = ClassS;
-      ClassMap[II] = ClassI;
-      ClassMap[WI] = ClassW;
-    }
-
-    // run - Emit arm_neon.h.inc
-    void run(raw_ostream &o);
-
-    // runHeader - Emit all the __builtin prototypes used in arm_neon.h
-    void runHeader(raw_ostream &o);
-
-    // runTests - Emit tests for all the Neon intrinsics.
-    void runTests(raw_ostream &o);
-
-  private:
-    void emitIntrinsic(raw_ostream &OS, Record *R);
-  };
-
-} // End llvm namespace
-
-#endif
index dea22d3886121fe9654bec2da239ebc7c8bbedb4..b0431a9be16b715ce45619f66e2061eef91347bd 100644 (file)
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "OptParserEmitter.h"
 #include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
 #include "llvm/ADT/STLExtras.h"
 using namespace llvm;
 
@@ -69,16 +69,20 @@ static raw_ostream &write_cstring(raw_ostream &OS, llvm::StringRef Str) {
   return OS;
 }
 
-void OptParserEmitter::run(raw_ostream &OS) {
+/// OptParserEmitter - This tablegen backend takes an input .td file
+/// describing a list of options and emits a data structure for parsing and
+/// working with those options when given an input command line.
+namespace clang {
+void EmitOptParser(RecordKeeper &Records, raw_ostream &OS, bool GenDefs) {
   // Get the option groups and options.
   const std::vector<Record*> &Groups =
     Records.getAllDerivedDefinitions("OptionGroup");
   std::vector<Record*> Opts = Records.getAllDerivedDefinitions("Option");
 
   if (GenDefs)
-    EmitSourceFileHeader("Option Parsing Definitions", OS);
+    emitSourceFileHeader("Option Parsing Definitions", OS);
   else
-    EmitSourceFileHeader("Option Parsing Table", OS);
+    emitSourceFileHeader("Option Parsing Table", OS);
 
   array_pod_sort(Opts.begin(), Opts.end(), CompareOptionRecords);
   if (GenDefs) {
@@ -192,3 +196,4 @@ void OptParserEmitter::run(raw_ostream &OS) {
     }
   }
 }
+} // end namespace clang
diff --git a/utils/TableGen/OptParserEmitter.h b/utils/TableGen/OptParserEmitter.h
deleted file mode 100644 (file)
index ca667ca..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- OptParserEmitter.h - Table Driven Command Line Parsing ---*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef UTILS_TABLEGEN_OPTPARSEREMITTER_H
-#define UTILS_TABLEGEN_OPTPARSEREMITTER_H
-
-#include "llvm/TableGen/TableGenBackend.h"
-
-namespace llvm {
-  /// OptParserEmitter - This tablegen backend takes an input .td file
-  /// describing a list of options and emits a data structure for parsing and
-  /// working with those options when given an input command line.
-  class OptParserEmitter : public TableGenBackend {
-    RecordKeeper &Records;
-    bool GenDefs;
-
-  public:
-    OptParserEmitter(RecordKeeper &R, bool _GenDefs)
-      : Records(R), GenDefs(_GenDefs) {}
-
-    /// run - Output the option parsing information.
-    ///
-    /// \param GenHeader - Generate the header describing the option IDs.x
-    void run(raw_ostream &OS);
-  };
-}
-
-#endif
index 5ff88db30156f2391923829545ee5736bd463946..d98cc72cf84e3429c236f80e0bd5348c9c63e314 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "ClangASTNodesEmitter.h"
-#include "ClangAttrEmitter.h"
-#include "ClangDiagnosticsEmitter.h"
-#include "ClangSACheckersEmitter.h"
-#include "NeonEmitter.h"
-#include "OptParserEmitter.h"
+#include "TableGenBackends.h" // Declares all backends.
 
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/PrettyStackTrace.h"
@@ -27,6 +22,7 @@
 #include "llvm/TableGen/TableGenAction.h"
 
 using namespace llvm;
+using namespace clang;
 
 enum ActionType {
   GenClangAttrClasses,
@@ -114,68 +110,68 @@ public:
   bool operator()(raw_ostream &OS, RecordKeeper &Records) {
     switch (Action) {
     case GenClangAttrClasses:
-      ClangAttrClassEmitter(Records).run(OS);
+      EmitClangAttrClass(Records, OS);
       break;
     case GenClangAttrImpl:
-      ClangAttrImplEmitter(Records).run(OS);
+      EmitClangAttrImpl(Records, OS);
       break;
     case GenClangAttrList:
-      ClangAttrListEmitter(Records).run(OS);
+      EmitClangAttrList(Records, OS);
       break;
     case GenClangAttrPCHRead:
-      ClangAttrPCHReadEmitter(Records).run(OS);
+      EmitClangAttrPCHRead(Records, OS);
       break;
     case GenClangAttrPCHWrite:
-      ClangAttrPCHWriteEmitter(Records).run(OS);
+      EmitClangAttrPCHWrite(Records, OS);
       break;
     case GenClangAttrSpellingList:
-      ClangAttrSpellingListEmitter(Records).run(OS);
+      EmitClangAttrSpellingList(Records, OS);
       break;
     case GenClangAttrLateParsedList:
-      ClangAttrLateParsedListEmitter(Records).run(OS);
+      EmitClangAttrLateParsedList(Records, OS);
       break;
     case GenClangAttrTemplateInstantiate:
-      ClangAttrTemplateInstantiateEmitter(Records).run(OS);
+      EmitClangAttrTemplateInstantiate(Records, OS);
       break;
     case GenClangAttrParsedAttrList:
-      ClangAttrParsedAttrListEmitter(Records).run(OS);
+      EmitClangAttrParsedAttrList(Records, OS);
       break;
     case GenClangAttrParsedAttrKinds:
-      ClangAttrParsedAttrKindsEmitter(Records).run(OS);
+      EmitClangAttrParsedAttrKinds(Records, OS);
       break;
     case GenClangDiagsDefs:
-      ClangDiagsDefsEmitter(Records, ClangComponent).run(OS);
+      EmitClangDiagsDefs(Records, OS, ClangComponent);
       break;
     case GenClangDiagGroups:
-      ClangDiagGroupsEmitter(Records).run(OS);
+      EmitClangDiagGroups(Records, OS);
       break;
     case GenClangDiagsIndexName:
-      ClangDiagsIndexNameEmitter(Records).run(OS);
+      EmitClangDiagsIndexName(Records, OS);
       break;
     case GenClangDeclNodes:
-      ClangASTNodesEmitter(Records, "Decl", "Decl").run(OS);
-      ClangDeclContextEmitter(Records).run(OS);
+      EmitClangASTNodes(Records, OS, "Decl", "Decl");
+      EmitClangDeclContext(Records, OS);
       break;
     case GenClangStmtNodes:
-      ClangASTNodesEmitter(Records, "Stmt", "").run(OS);
+      EmitClangASTNodes(Records, OS, "Stmt", "");
       break;
     case GenClangSACheckers:
-      ClangSACheckersEmitter(Records).run(OS);
+      EmitClangSACheckers(Records, OS);
       break;
     case GenOptParserDefs:
-      OptParserEmitter(Records, true).run(OS);
+      EmitOptParser(Records, OS, true);
       break;
     case GenOptParserImpl:
-      OptParserEmitter(Records, false).run(OS);
+      EmitOptParser(Records, OS, false);
       break;
     case GenArmNeon:
-      NeonEmitter(Records).run(OS);
+      EmitNeon(Records, OS);
       break;
     case GenArmNeonSema:
-      NeonEmitter(Records).runHeader(OS);
+      EmitNeonSema(Records, OS);
       break;
     case GenArmNeonTest:
-      NeonEmitter(Records).runTests(OS);
+      EmitNeonTest(Records, OS);
       break;
     }
 
diff --git a/utils/TableGen/TableGenBackends.h b/utils/TableGen/TableGenBackends.h
new file mode 100644 (file)
index 0000000..779de7c
--- /dev/null
@@ -0,0 +1,56 @@
+//===- TableGenBackends.h - Declarations for Clang TableGen Backends ------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the declarations for all of the Clang TableGen
+// backends. A "TableGen backend" is just a function. See
+// "$LLVM_ROOT/utils/TableGen/TableGenBackends.h" for more info.
+//
+//===----------------------------------------------------------------------===//
+
+#include <string>
+
+namespace llvm {
+  class raw_ostream;
+  class RecordKeeper;
+}
+
+using llvm::raw_ostream;
+using llvm::RecordKeeper;
+
+namespace clang {
+
+void EmitClangDeclContext(RecordKeeper &RK, raw_ostream &OS);
+void EmitClangASTNodes(RecordKeeper &RK, raw_ostream &OS,
+                       const std::string &N, const std::string &S);
+
+void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrSpellingList(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrLateParsedList(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS);
+
+void EmitClangDiagsDefs(RecordKeeper &Records, raw_ostream &OS,
+                        const std::string &Component);
+void EmitClangDiagGroups(RecordKeeper &Records, raw_ostream &OS);
+void EmitClangDiagsIndexName(RecordKeeper &Records, raw_ostream &OS);
+
+void EmitClangSACheckers(RecordKeeper &Records, raw_ostream &OS);
+
+void EmitNeon(RecordKeeper &Records, raw_ostream &OS);
+void EmitNeonSema(RecordKeeper &Records, raw_ostream &OS);
+void EmitNeonTest(RecordKeeper &Records, raw_ostream &OS);
+
+void EmitOptParser(RecordKeeper &Records, raw_ostream &OS, bool GenDefs);
+
+} // end namespace clang