1 //===-- llvm/CallingConvLower.cpp - Calling Conventions -------------------===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This file implements the CCState class, used for lowering and implementing
11 // calling conventions.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/CodeGen/CallingConvLower.h"
16 #include "llvm/Target/MRegisterInfo.h"
17 #include "llvm/Target/TargetMachine.h"
20 CCState::CCState(unsigned CC, const TargetMachine &tm,
21 SmallVector<CCValAssign, 16> &locs)
22 : CallingConv(CC), TM(tm), MRI(*TM.getRegisterInfo()), Locs(locs) {
26 UsedRegs.resize(MRI.getNumRegs());
30 /// MarkAllocated - Mark a register and all of its aliases as allocated.
31 void CCState::MarkAllocated(unsigned Reg) {
32 UsedRegs[Reg/32] |= 1 << (Reg&31);
34 if (const unsigned *RegAliases = MRI.getAliasSet(Reg))
35 for (; (Reg = *RegAliases); ++RegAliases)
36 UsedRegs[Reg/32] |= 1 << (Reg&31);