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"
17 MRegisterInfo::MRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
18 regclass_iterator RCB, regclass_iterator RCE,
20 : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) {
21 assert(NumRegs < FirstVirtualRegister &&
22 "Target has too many physical registers!");
24 CallFrameSetupOpcode = CFSO;
25 CallFrameDestroyOpcode = CFDO;
28 MRegisterInfo::~MRegisterInfo() {}
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;