1 //===- MRegisterInfo.cpp - Target Register Information Implementation -----===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This file implements the MRegisterInfo interface.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Target/MRegisterInfo.h"
16 MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR,
17 regclass_iterator RCB, regclass_iterator RCE,
19 : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) {
20 assert(NumRegs < FirstVirtualRegister &&
21 "Target has too many physical registers!");
23 PhysRegClasses = new const TargetRegisterClass*[NumRegs];
24 for (unsigned i = 0; i != NumRegs; ++i)
25 PhysRegClasses[i] = 0;
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;
36 CallFrameSetupOpcode = CFSO;
37 CallFrameDestroyOpcode = CFDO;
41 MRegisterInfo::~MRegisterInfo() {
42 delete[] PhysRegClasses;