Add more helper methods
[oota-llvm.git] / support / tools / TableGen / TableGenBackend.h
1 //===- TableGenBackend.h - Base class for TableGen Backends -----*- C++ -*-===//
2 //
3 // The TableGenBackend class is provided as a common interface for all TableGen
4 // backends.  It provides useful services and an standardized interface.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef TABLEGENBACKEND_H
9 #define TABLEGENBACKEND_H
10
11 #include <string>
12 #include <iosfwd>
13 class Record;
14 class RecordKeeper;
15
16 struct TableGenBackend {
17
18   // run - All TableGen backends should implement the run method, which should
19   // be the main entry point.
20   virtual void run(std::ostream &OS) = 0;
21
22
23 public:   // Useful helper routines...
24   /// EmitSourceFileHeader - Output a LLVM style file header to the specified
25   /// ostream.
26   void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const;
27
28   /// getQualifiedName - Return the name of the specified record, with a
29   /// namespace qualifier if the record contains one.
30   std::string getQualifiedName(Record *R) const;
31
32   /// getTarget - Return the current instance of the Target class.
33   Record *getTarget(RecordKeeper &RC) const;
34 };
35
36 #endif