blob: 47d08376bb172a91112058002d35c6d321d0a774 [file] [log] [blame]
Chris Lattnerdc3adc82007-02-27 04:43:02 +00001//===-- llvm/CallingConvLower.cpp - Calling Conventions -------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner 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 CCState class, used for lowering and implementing
11// calling conventions.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/CodeGen/CallingConvLower.h"
16#include "llvm/Target/MRegisterInfo.h"
17using namespace llvm;
18
19CCState::CCState(const MRegisterInfo &mri) : MRI(mri) {
20 // No stack is used.
21 StackOffset = 0;
22
23 UsedRegs.resize(MRI.getNumRegs());
24}
25
26
27/// MarkAllocated - Mark a register and all of its aliases as allocated.
28void CCState::MarkAllocated(unsigned Reg) {
29 UsedRegs[Reg/32] |= 1 << (Reg&31);
30
31 if (const unsigned *RegAliases = MRI.getAliasSet(Reg))
32 for (; (Reg = *RegAliases); ++RegAliases)
33 UsedRegs[Reg/32] |= 1 << (Reg&31);
34}