Merge branch 'master' into msp430
[llvm/msp430.git] / utils / TableGen / CodeGenRegisters.h
blob6f8682be59d3d42fa9b423a30441ea778ef7d3ae
1 //===- CodeGenRegisters.h - Register and RegisterClass Info -----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines structures to encapsulate information gleaned from the
11 // target register and register class definitions.
13 //===----------------------------------------------------------------------===//
15 #ifndef CODEGEN_REGISTERS_H
16 #define CODEGEN_REGISTERS_H
18 #include "llvm/CodeGen/ValueTypes.h"
19 #include <string>
20 #include <vector>
21 #include <cstdlib>
23 namespace llvm {
24 class Record;
26 /// CodeGenRegister - Represents a register definition.
27 struct CodeGenRegister {
28 Record *TheDef;
29 const std::string &getName() const;
30 unsigned DeclaredSpillSize, DeclaredSpillAlignment;
31 CodeGenRegister(Record *R);
35 struct CodeGenRegisterClass {
36 Record *TheDef;
37 std::string Namespace;
38 std::vector<Record*> Elements;
39 std::vector<MVT::SimpleValueType> VTs;
40 unsigned SpillSize;
41 unsigned SpillAlignment;
42 int CopyCost;
43 std::vector<Record*> SubRegClasses;
44 std::string MethodProtos, MethodBodies;
46 const std::string &getName() const;
47 const std::vector<MVT::SimpleValueType> &getValueTypes() const {return VTs;}
48 unsigned getNumValueTypes() const { return VTs.size(); }
50 MVT::SimpleValueType getValueTypeNum(unsigned VTNum) const {
51 if (VTNum < VTs.size())
52 return VTs[VTNum];
53 assert(0 && "VTNum greater than number of ValueTypes in RegClass!");
54 abort();
57 CodeGenRegisterClass(Record *R);
61 #endif