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"
18 MRegisterInfo::MRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
19 regclass_iterator RCB, regclass_iterator RCE,
21 : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) {
22 assert(NumRegs < FirstVirtualRegister &&
23 "Target has too many physical registers!");
25 CallFrameSetupOpcode = CFSO;
26 CallFrameDestroyOpcode = CFDO;
29 MRegisterInfo::~MRegisterInfo() {}
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;
43 } // End llvm namespace