Chris Lattner | 4587207 | 2003-08-07 05:38:11 +0000 | [diff] [blame] | 1 | //===- CodeGenWrappers.h - Code Generation Class Wrappers -------*- C++ -*-===// |
John Criswell | 01d4582 | 2003-10-20 20:20:30 +0000 | [diff] [blame^] | 2 | // |
| 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. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | 4587207 | 2003-08-07 05:38:11 +0000 | [diff] [blame] | 9 | // |
| 10 | // These classes wrap target description classes used by the various code |
| 11 | // generation TableGen backends. This makes it easier to access the data and |
| 12 | // provides a single place that needs to check it for validity. All of these |
| 13 | // classes throw exceptions on error conditions. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
| 17 | #ifndef CODEGENWRAPPERS_H |
| 18 | #define CODEGENWRAPPERS_H |
| 19 | |
| 20 | #include "llvm/CodeGen/ValueTypes.h" |
| 21 | #include <iosfwd> |
Misha Brukman | 6ad9076 | 2003-08-13 22:27:15 +0000 | [diff] [blame] | 22 | #include <string> |
Chris Lattner | 4587207 | 2003-08-07 05:38:11 +0000 | [diff] [blame] | 23 | #include <vector> |
| 24 | class Record; |
| 25 | class RecordKeeper; |
| 26 | |
| 27 | /// getValueType - Return the MVT::ValueType that the specified TableGen record |
| 28 | /// corresponds to. |
| 29 | MVT::ValueType getValueType(Record *Rec); |
| 30 | |
| 31 | std::ostream &operator<<(std::ostream &OS, MVT::ValueType T); |
Chris Lattner | d3464c1 | 2003-08-07 23:15:21 +0000 | [diff] [blame] | 32 | std::string getName(MVT::ValueType T); |
Chris Lattner | b72fb7e | 2003-08-10 19:50:32 +0000 | [diff] [blame] | 33 | std::string getEnumName(MVT::ValueType T); |
Chris Lattner | 4587207 | 2003-08-07 05:38:11 +0000 | [diff] [blame] | 34 | |
| 35 | |
| 36 | /// CodeGenTarget - This class corresponds to the Target class in the .td files. |
| 37 | /// |
| 38 | class CodeGenTarget { |
| 39 | Record *TargetRec; |
| 40 | std::vector<Record*> CalleeSavedRegisters; |
| 41 | MVT::ValueType PointerType; |
| 42 | |
| 43 | public: |
| 44 | CodeGenTarget(); |
| 45 | |
| 46 | Record *getTargetRecord() const { return TargetRec; } |
| 47 | const std::string &getName() const; |
| 48 | |
| 49 | const std::vector<Record*> &getCalleeSavedRegisters() const { |
| 50 | return CalleeSavedRegisters; |
| 51 | } |
| 52 | |
Chris Lattner | 54c66fe | 2003-08-07 06:01:44 +0000 | [diff] [blame] | 53 | MVT::ValueType getPointerType() const { return PointerType; } |
| 54 | |
Chris Lattner | 4587207 | 2003-08-07 05:38:11 +0000 | [diff] [blame] | 55 | // getInstructionSet - Return the InstructionSet object... |
| 56 | Record *getInstructionSet() const; |
| 57 | |
| 58 | // getInstructionSet - Return the CodeGenInstructionSet object for this |
| 59 | // target, lazily reading it from the record keeper as needed. |
| 60 | // CodeGenInstructionSet *getInstructionSet - |
| 61 | }; |
| 62 | |
| 63 | #endif |