Split out altivec notes into their own README
[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 using namespace llvm;
16
17 MRegisterInfo::MRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
18                              regclass_iterator RCB, regclass_iterator RCE,
19                              int CFSO, int CFDO)
20   : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) {
21   assert(NumRegs < FirstVirtualRegister &&
22          "Target has too many physical registers!");
23
24   CallFrameSetupOpcode   = CFSO;
25   CallFrameDestroyOpcode = CFDO;
26 }
27
28 MRegisterInfo::~MRegisterInfo() {}
29
30 std::vector<bool> MRegisterInfo::getAllocatableSet(MachineFunction &MF) const {
31   std::vector<bool> Allocatable(NumRegs);
32   for (MRegisterInfo::regclass_iterator I = regclass_begin(),
33          E = regclass_end(); I != E; ++I) {
34     const TargetRegisterClass *RC = *I;
35     for (TargetRegisterClass::iterator I = RC->allocation_order_begin(MF),
36            E = RC->allocation_order_end(MF); I != E; ++I)
37       Allocatable[*I] = true;
38   }
39   return Allocatable;
40 }