Chris Lattner | 2c0f2c7 | 2003-08-06 04:23:04 +0000 | [diff] [blame] | 1 | //===- TableGenBackend.h - Base class for TableGen Backends -----*- C++ -*-===// |
Misha Brukman | 3da94ae | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 2 | // |
John Criswell | 01d4582 | 2003-10-20 20:20:30 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
Misha Brukman | 3da94ae | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 7 | // |
John Criswell | 01d4582 | 2003-10-20 20:20:30 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | 2c0f2c7 | 2003-08-06 04:23:04 +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 | |
| 18 | #include <string> |
| 19 | #include <iosfwd> |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 20 | |
| 21 | namespace llvm { |
| 22 | |
Chris Lattner | 18a6a94 | 2003-08-06 04:31:26 +0000 | [diff] [blame] | 23 | class Record; |
| 24 | class RecordKeeper; |
Chris Lattner | 2c0f2c7 | 2003-08-06 04:23:04 +0000 | [diff] [blame] | 25 | |
| 26 | struct TableGenBackend { |
Chris Lattner | a7ac3cf | 2003-08-06 05:39:03 +0000 | [diff] [blame] | 27 | virtual ~TableGenBackend() {} |
Chris Lattner | 2c0f2c7 | 2003-08-06 04:23:04 +0000 | [diff] [blame] | 28 | |
| 29 | // run - All TableGen backends should implement the run method, which should |
| 30 | // be the main entry point. |
| 31 | virtual void run(std::ostream &OS) = 0; |
| 32 | |
| 33 | |
| 34 | public: // Useful helper routines... |
Chris Lattner | 18a6a94 | 2003-08-06 04:31:26 +0000 | [diff] [blame] | 35 | /// EmitSourceFileHeader - Output a LLVM style file header to the specified |
| 36 | /// ostream. |
Chris Lattner | 2c0f2c7 | 2003-08-06 04:23:04 +0000 | [diff] [blame] | 37 | void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const; |
| 38 | |
Chris Lattner | 18a6a94 | 2003-08-06 04:31:26 +0000 | [diff] [blame] | 39 | /// getQualifiedName - Return the name of the specified record, with a |
| 40 | /// namespace qualifier if the record contains one. |
| 41 | std::string getQualifiedName(Record *R) const; |
Chris Lattner | 2c0f2c7 | 2003-08-06 04:23:04 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 44 | } // End llvm namespace |
| 45 | |
Chris Lattner | 2c0f2c7 | 2003-08-06 04:23:04 +0000 | [diff] [blame] | 46 | #endif |