1//===---- MipsCCState.cpp - CCState with Mips specific extensions ---------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "MipsCCState.h"
10#include "MipsSubtarget.h"
11#include "llvm/IR/Module.h"
12
13using namespace llvm;
14
15MipsCCState::SpecialCallingConvType
16MipsCCState::getSpecialCallingConvForCallee(const SDNode *Callee,
17 const MipsSubtarget &Subtarget) {
18 MipsCCState::SpecialCallingConvType SpecialCallingConv = NoSpecialCallingConv;
19 if (Subtarget.inMips16HardFloat()) {
20 if (const GlobalAddressSDNode *G =
21 dyn_cast<const GlobalAddressSDNode>(Val: Callee)) {
22 llvm::StringRef Sym = G->getGlobal()->getName();
23 Function *F = G->getGlobal()->getParent()->getFunction(Name: Sym);
24 if (F && F->hasFnAttribute(Kind: "__Mips16RetHelper")) {
25 SpecialCallingConv = Mips16RetHelperConv;
26 }
27 }
28 }
29 return SpecialCallingConv;
30}
31