Chris Lattner | 9208bbf | 2002-12-17 04:03:08 +0000 | [diff] [blame] | 1 | //===- MRegisterInfo.cpp - Target Register Information Implementation -----===// |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 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 | //===----------------------------------------------------------------------===// |
Chris Lattner | 9208bbf | 2002-12-17 04:03:08 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file implements the MRegisterInfo interface. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/Target/MRegisterInfo.h" |
| 15 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 16 | namespace llvm { |
| 17 | |
Chris Lattner | 9208bbf | 2002-12-17 04:03:08 +0000 | [diff] [blame] | 18 | MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR, |
Chris Lattner | 3ad7642 | 2002-12-28 20:34:18 +0000 | [diff] [blame] | 19 | regclass_iterator RCB, regclass_iterator RCE, |
| 20 | int CFSO, int CFDO) |
Chris Lattner | 9208bbf | 2002-12-17 04:03:08 +0000 | [diff] [blame] | 21 | : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) { |
| 22 | assert(NumRegs < FirstVirtualRegister && |
| 23 | "Target has too many physical registers!"); |
| 24 | |
Chris Lattner | 3ad7642 | 2002-12-28 20:34:18 +0000 | [diff] [blame] | 25 | CallFrameSetupOpcode = CFSO; |
| 26 | CallFrameDestroyOpcode = CFDO; |
Chris Lattner | 9208bbf | 2002-12-17 04:03:08 +0000 | [diff] [blame] | 27 | } |
| 28 | |
Nate Begeman | 0aafc32 | 2004-10-27 06:00:53 +0000 | [diff] [blame^] | 29 | MRegisterInfo::~MRegisterInfo() {} |
| 30 | |
Alkis Evlogimenos | bb4bdf4 | 2004-08-26 22:21:04 +0000 | [diff] [blame] | 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; |
| 39 | } |
| 40 | return Allocatable; |
| 41 | } |
| 42 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 43 | } // End llvm namespace |