1 //===- CodeGenRegisters.h - Register and RegisterClass Info -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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 "llvm/ADT/DenseMap.h"
27 /// CodeGenRegister - Represents a register definition.
28 struct CodeGenRegister {
30 const std::string &getName() const;
31 unsigned DeclaredSpillSize, DeclaredSpillAlignment;
32 CodeGenRegister(Record *R);
36 struct CodeGenRegisterClass {
38 std::string Namespace;
39 std::vector<Record*> Elements;
40 std::vector<MVT::SimpleValueType> VTs;
42 unsigned SpillAlignment;
44 // Map SubRegIndex -> RegisterClass
45 DenseMap<Record*,Record*> SubRegClasses;
46 std::string MethodProtos, MethodBodies;
48 const std::string &getName() const;
49 const std::vector<MVT::SimpleValueType> &getValueTypes() const {return VTs;}
50 unsigned getNumValueTypes() const { return VTs.size(); }
52 MVT::SimpleValueType getValueTypeNum(unsigned VTNum) const {
53 if (VTNum < VTs.size())
55 assert(0 && "VTNum greater than number of ValueTypes in RegClass!");
59 CodeGenRegisterClass(Record *R);