Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
[oota-llvm.git] / utils / TableGen / CodeGenRegisters.h
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.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef CODEGEN_REGISTERS_H
16 #define CODEGEN_REGISTERS_H
17
18 #include "llvm/CodeGen/ValueTypes.h"
19 #include <string>
20 #include <vector>
21 #include <cstdlib>
22
23 namespace llvm {
24   class Record;
25
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);
32   };
33
34
35   struct CodeGenRegisterClass {
36     Record *TheDef;
37     std::string Namespace;
38     std::vector<Record*> Elements;
39     std::vector<MVT::ValueType> VTs;
40     unsigned SpillSize;
41     unsigned SpillAlignment;
42     int CopyCost;
43     std::vector<Record*> SubRegClasses;
44     std::string MethodProtos, MethodBodies;
45
46     const std::string &getName() const;
47     const std::vector<MVT::ValueType> &getValueTypes() const { return VTs; }
48     unsigned getNumValueTypes() const { return VTs.size(); }
49     
50     MVT::ValueType 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();
55     }
56
57     CodeGenRegisterClass(Record *R);
58   };
59 }
60
61 #endif