blob: 00ca3fcc60322a1677b52b9d2a03c0e3ae7ed837 [file] [log] [blame]
Chris Lattner45872072003-08-07 05:38:11 +00001//===- 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>
Misha Brukman6ad90762003-08-13 22:27:15 +000015#include <string>
Chris Lattner45872072003-08-07 05:38:11 +000016#include <vector>
17class Record;
18class RecordKeeper;
19
20/// getValueType - Return the MVT::ValueType that the specified TableGen record
21/// corresponds to.
22MVT::ValueType getValueType(Record *Rec);
23
24std::ostream &operator<<(std::ostream &OS, MVT::ValueType T);
Chris Lattnerd3464c12003-08-07 23:15:21 +000025std::string getName(MVT::ValueType T);
Chris Lattnerb72fb7e2003-08-10 19:50:32 +000026std::string getEnumName(MVT::ValueType T);
Chris Lattner45872072003-08-07 05:38:11 +000027
28
29/// CodeGenTarget - This class corresponds to the Target class in the .td files.
30///
31class CodeGenTarget {
32 Record *TargetRec;
33 std::vector<Record*> CalleeSavedRegisters;
34 MVT::ValueType PointerType;
35
36public:
37 CodeGenTarget();
38
39 Record *getTargetRecord() const { return TargetRec; }
40 const std::string &getName() const;
41
42 const std::vector<Record*> &getCalleeSavedRegisters() const {
43 return CalleeSavedRegisters;
44 }
45
Chris Lattner54c66fe2003-08-07 06:01:44 +000046 MVT::ValueType getPointerType() const { return PointerType; }
47
Chris Lattner45872072003-08-07 05:38:11 +000048 // getInstructionSet - Return the InstructionSet object...
49 Record *getInstructionSet() const;
50
51 // getInstructionSet - Return the CodeGenInstructionSet object for this
52 // target, lazily reading it from the record keeper as needed.
53 // CodeGenInstructionSet *getInstructionSet -
54};
55
56#endif