| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 1 | //===- TableGenBackend.h - Base class for TableGen Backends -----*- C++ -*-===// | 
| Misha Brukman | 650ba8e | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 2 | // | 
| John Criswell | d303203 | 2003-10-20 20:20:30 +0000 | [diff] [blame] | 3 | //                     The LLVM Compiler Infrastructure | 
|  | 4 | // | 
| Chris Lattner | 8adcd9f | 2007-12-29 20:37:13 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source | 
|  | 6 | // License. See LICENSE.TXT for details. | 
| Misha Brukman | 650ba8e | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 7 | // | 
| John Criswell | d303203 | 2003-10-20 20:20:30 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// | 
| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 9 | // | 
|  | 10 | // The TableGenBackend class is provided as a common interface for all TableGen | 
|  | 11 | // backends.  It provides useful services and an standardized interface. | 
|  | 12 | // | 
|  | 13 | //===----------------------------------------------------------------------===// | 
|  | 14 |  | 
|  | 15 | #ifndef TABLEGENBACKEND_H | 
|  | 16 | #define TABLEGENBACKEND_H | 
|  | 17 |  | 
| Daniel Dunbar | 38a22bf | 2009-07-03 00:10:29 +0000 | [diff] [blame] | 18 | #include "llvm/Support/raw_ostream.h" | 
| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 19 | #include <string> | 
| Brian Gaeke | 960707c | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 20 |  | 
|  | 21 | namespace llvm { | 
|  | 22 |  | 
| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 23 | class Record; | 
|  | 24 | class RecordKeeper; | 
|  | 25 |  | 
|  | 26 | struct TableGenBackend { | 
|  | 27 | virtual ~TableGenBackend() {} | 
|  | 28 |  | 
|  | 29 | // run - All TableGen backends should implement the run method, which should | 
|  | 30 | // be the main entry point. | 
| Daniel Dunbar | 38a22bf | 2009-07-03 00:10:29 +0000 | [diff] [blame] | 31 | virtual void run(raw_ostream &OS) = 0; | 
| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 32 |  | 
|  | 33 |  | 
|  | 34 | public:   // Useful helper routines... | 
|  | 35 | /// EmitSourceFileHeader - Output a LLVM style file header to the specified | 
|  | 36 | /// ostream. | 
| Daniel Dunbar | 38a22bf | 2009-07-03 00:10:29 +0000 | [diff] [blame] | 37 | void EmitSourceFileHeader(const std::string &Desc, raw_ostream &OS) const; | 
| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 38 |  | 
| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 39 | }; | 
|  | 40 |  | 
| Brian Gaeke | 960707c | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 41 | } // End llvm namespace | 
|  | 42 |  | 
| Chris Lattner | f5bd1b7 | 2003-10-05 19:27:59 +0000 | [diff] [blame] | 43 | #endif |