blob: 8dfbaddad160c442138d27fd0985f27fedf74e5a [file] [log] [blame]
Chris Lattner2c0f2c72003-08-06 04:23:04 +00001//===- 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>
Chris Lattner18a6a942003-08-06 04:31:26 +000013class Record;
14class RecordKeeper;
Chris Lattner2c0f2c72003-08-06 04:23:04 +000015
16struct TableGenBackend {
Chris Lattnera7ac3cf2003-08-06 05:39:03 +000017 virtual ~TableGenBackend() {}
Chris Lattner2c0f2c72003-08-06 04:23:04 +000018
19 // run - All TableGen backends should implement the run method, which should
20 // be the main entry point.
21 virtual void run(std::ostream &OS) = 0;
22
23
24public: // Useful helper routines...
Chris Lattner18a6a942003-08-06 04:31:26 +000025 /// EmitSourceFileHeader - Output a LLVM style file header to the specified
26 /// ostream.
Chris Lattner2c0f2c72003-08-06 04:23:04 +000027 void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const;
28
Chris Lattner18a6a942003-08-06 04:31:26 +000029 /// getQualifiedName - Return the name of the specified record, with a
30 /// namespace qualifier if the record contains one.
31 std::string getQualifiedName(Record *R) const;
Chris Lattner2c0f2c72003-08-06 04:23:04 +000032};
33
34#endif