Explicitly cast type, so we aren't passing output_vbr a size_t.
[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 MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR,
17                              regclass_iterator RCB, regclass_iterator RCE,
18                              int CFSO, int CFDO)
19   : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) {
20   assert(NumRegs < FirstVirtualRegister &&
21          "Target has too many physical registers!");
22
23   PhysRegClasses = new const TargetRegisterClass*[NumRegs];
24   for (unsigned i = 0; i != NumRegs; ++i)
25     PhysRegClasses[i] = 0;
26
27   // Fill in the PhysRegClasses map
28   for (MRegisterInfo::regclass_iterator I = regclass_begin(),
29          E = regclass_end(); I != E; ++I)
30     for (unsigned i = 0, e = (*I)->getNumRegs(); i != e; ++i) {
31       unsigned Reg = (*I)->getRegister(i);
32       assert(PhysRegClasses[Reg] == 0 && "Register in more than one class?");
33       PhysRegClasses[Reg] = *I;
34     }
35
36   CallFrameSetupOpcode   = CFSO;
37   CallFrameDestroyOpcode = CFDO;
38 }
39
40
41 MRegisterInfo::~MRegisterInfo() {
42   delete[] PhysRegClasses;
43 }