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