Path: blob/main/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYCallingConv.h
35269 views
//=== CSKYCallingConv.h - CSKY Custom Calling Convention Routines -*-C++-*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file contains the custom routines for the CSKY Calling Convention that9// aren't done by tablegen.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_CSKY_CSKYCALLINGCONV_H14#define LLVM_LIB_TARGET_CSKY_CSKYCALLINGCONV_H1516#include "CSKY.h"17#include "CSKYSubtarget.h"18#include "llvm/CodeGen/CallingConvLower.h"19#include "llvm/CodeGen/TargetInstrInfo.h"20#include "llvm/IR/CallingConv.h"2122namespace llvm {2324static bool CC_CSKY_ABIV2_SOFT_64(unsigned &ValNo, MVT &ValVT, MVT &LocVT,25CCValAssign::LocInfo &LocInfo,26ISD::ArgFlagsTy &ArgFlags, CCState &State) {2728static const MCPhysReg ArgGPRs[] = {CSKY::R0, CSKY::R1, CSKY::R2, CSKY::R3};29Register Reg = State.AllocateReg(ArgGPRs);30LocVT = MVT::i32;31if (!Reg) {32unsigned StackOffset = State.AllocateStack(8, Align(4));33State.addLoc(34CCValAssign::getMem(ValNo, ValVT, StackOffset, LocVT, LocInfo));35return true;36}37if (!State.AllocateReg(ArgGPRs))38State.AllocateStack(4, Align(4));39State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));40return true;41}4243static bool Ret_CSKY_ABIV2_SOFT_64(unsigned &ValNo, MVT &ValVT, MVT &LocVT,44CCValAssign::LocInfo &LocInfo,45ISD::ArgFlagsTy &ArgFlags, CCState &State) {4647static const MCPhysReg ArgGPRs[] = {CSKY::R0, CSKY::R1};48Register Reg = State.AllocateReg(ArgGPRs);49LocVT = MVT::i32;50if (!Reg)51return false;5253if (!State.AllocateReg(ArgGPRs))54return false;5556State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));57return true;58}5960} // namespace llvm6162#endif636465