Added LLVM copyright header.
[oota-llvm.git] / utils / TableGen / CodeGenWrappers.h
1 //===- CodeGenWrappers.h - Code Generation Class Wrappers -------*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
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>
22 #include <string>
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);
32 std::string getName(MVT::ValueType T);
33 std::string getEnumName(MVT::ValueType T);
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
53   MVT::ValueType getPointerType() const { return PointerType; }
54
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