1 //===---- MipsABIInfo.cpp - Information about MIPS ABI's ------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "MipsABIInfo.h"
11 #include "MipsRegisterInfo.h"
12
13 using namespace llvm;
14
15 namespace {
16 static const MCPhysReg O32IntRegs[4] = {Mips::A0, Mips::A1, Mips::A2, Mips::A3};
17
18 static const MCPhysReg Mips64IntRegs[8] = {
19 Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64,
20 Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64};
21 }
22
GetByValArgRegs() const23 const ArrayRef<MCPhysReg> MipsABIInfo::GetByValArgRegs() const {
24 if (IsO32())
25 return makeArrayRef(O32IntRegs);
26 if (IsN32() || IsN64())
27 return makeArrayRef(Mips64IntRegs);
28 llvm_unreachable("Unhandled ABI");
29 }
30
GetVarArgRegs() const31 const ArrayRef<MCPhysReg> MipsABIInfo::GetVarArgRegs() const {
32 if (IsO32())
33 return makeArrayRef(O32IntRegs);
34 if (IsN32() || IsN64())
35 return makeArrayRef(Mips64IntRegs);
36 llvm_unreachable("Unhandled ABI");
37 }
38
GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const39 unsigned MipsABIInfo::GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const {
40 if (IsO32())
41 return CC != CallingConv::Fast ? 16 : 0;
42 if (IsN32() || IsN64() || IsEABI())
43 return 0;
44 llvm_unreachable("Unhandled ABI");
45 }
46