Add new function
[oota-llvm.git] / utils / TableGen / CodeGenTarget.h
1 //===- CodeGenWrappers.h - Code Generation Class Wrappers -------*- C++ -*-===//
2 //
3 // These classes wrap target description classes used by the various code
4 // generation TableGen backends.  This makes it easier to access the data and
5 // provides a single place that needs to check it for validity.  All of these
6 // classes throw exceptions on error conditions.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef CODEGENWRAPPERS_H
11 #define CODEGENWRAPPERS_H
12
13 #include "llvm/CodeGen/ValueTypes.h"
14 #include <iosfwd>
15 #include <vector>
16 class Record;
17 class RecordKeeper;
18
19 /// getValueType - Return the MVT::ValueType that the specified TableGen record
20 /// corresponds to.
21 MVT::ValueType getValueType(Record *Rec);
22
23 std::ostream &operator<<(std::ostream &OS, MVT::ValueType T);
24 std::string getName(MVT::ValueType T);
25 std::string getEnumName(MVT::ValueType T);
26
27
28 /// CodeGenTarget - This class corresponds to the Target class in the .td files.
29 ///
30 class CodeGenTarget {
31   Record *TargetRec;
32   std::vector<Record*> CalleeSavedRegisters;
33   MVT::ValueType PointerType;
34
35 public:
36   CodeGenTarget();
37
38   Record *getTargetRecord() const { return TargetRec; }
39   const std::string &getName() const;
40
41   const std::vector<Record*> &getCalleeSavedRegisters() const {
42     return CalleeSavedRegisters;
43   }
44
45   MVT::ValueType getPointerType() const { return PointerType; }
46
47   // getInstructionSet - Return the InstructionSet object...
48   Record *getInstructionSet() const;
49
50   // getInstructionSet - Return the CodeGenInstructionSet object for this
51   // target, lazily reading it from the record keeper as needed.
52   // CodeGenInstructionSet *getInstructionSet -
53 };
54
55 #endif