Convert tabs to spaces
[oota-llvm.git] / lib / Target / MRegisterInfo.cpp
1 //===- MRegisterInfo.cpp - Target Register Information Implementation -----===//
2 //
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 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the MRegisterInfo interface.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/Target/MRegisterInfo.h"
15
16 namespace llvm {
17
18 MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR,
19                              regclass_iterator RCB, regclass_iterator RCE,
20                              int CFSO, int CFDO)
21   : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) {
22   assert(NumRegs < FirstVirtualRegister &&
23          "Target has too many physical registers!");
24
25   CallFrameSetupOpcode   = CFSO;
26   CallFrameDestroyOpcode = CFDO;
27 }
28
29 MRegisterInfo::~MRegisterInfo() {}
30
31 std::vector<bool> MRegisterInfo::getAllocatableSet(MachineFunction &MF) const {
32   std::vector<bool> Allocatable(NumRegs);
33   for (MRegisterInfo::regclass_iterator I = regclass_begin(),
34          E = regclass_end(); I != E; ++I) {
35     const TargetRegisterClass *RC = *I;
36     for (TargetRegisterClass::iterator I = RC->allocation_order_begin(MF),
37            E = RC->allocation_order_end(MF); I != E; ++I)
38       Allocatable[*I] = true;
39   }
40   return Allocatable;
41 }
42
43 } // End llvm namespace