blob: f0b7200edc11771b263617860456da49804335f4 [file] [log] [blame]
Chris Lattner45872072003-08-07 05:38:11 +00001//===- CodeGenWrappers.h - Code Generation Class Wrappers -------*- C++ -*-===//
John Criswell01d45822003-10-20 20:20:30 +00002//
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 Lattner45872072003-08-07 05:38:11 +00009//
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 Brukman6ad90762003-08-13 22:27:15 +000022#include <string>
Chris Lattner45872072003-08-07 05:38:11 +000023#include <vector>
24class Record;
25class RecordKeeper;
26
27/// getValueType - Return the MVT::ValueType that the specified TableGen record
28/// corresponds to.
29MVT::ValueType getValueType(Record *Rec);
30
31std::ostream &operator<<(std::ostream &OS, MVT::ValueType T);
Chris Lattnerd3464c12003-08-07 23:15:21 +000032std::string getName(MVT::ValueType T);
Chris Lattnerb72fb7e2003-08-10 19:50:32 +000033std::string getEnumName(MVT::ValueType T);
Chris Lattner45872072003-08-07 05:38:11 +000034
35
36/// CodeGenTarget - This class corresponds to the Target class in the .td files.
37///
38class CodeGenTarget {
39 Record *TargetRec;
40 std::vector<Record*> CalleeSavedRegisters;
41 MVT::ValueType PointerType;
42
43public:
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 Lattner54c66fe2003-08-07 06:01:44 +000053 MVT::ValueType getPointerType() const { return PointerType; }
54
Chris Lattner45872072003-08-07 05:38:11 +000055 // 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