| //===---- MipsCCState.cpp - CCState with Mips specific extensions ---------===// |
| // |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| // |
| //===----------------------------------------------------------------------===// |
| |
| #include "MipsCCState.h" |
| #include "MipsSubtarget.h" |
| #include "llvm/IR/Module.h" |
| |
| using namespace llvm; |
| |
| MipsCCState::SpecialCallingConvType |
| MipsCCState::getSpecialCallingConvForCallee(const SDNode *Callee, |
| const MipsSubtarget &Subtarget) { |
| MipsCCState::SpecialCallingConvType SpecialCallingConv = NoSpecialCallingConv; |
| if (Subtarget.inMips16HardFloat()) { |
| if (const GlobalAddressSDNode *G = |
| dyn_cast<const GlobalAddressSDNode>(Callee)) { |
| llvm::StringRef Sym = G->getGlobal()->getName(); |
| Function *F = G->getGlobal()->getParent()->getFunction(Sym); |
| if (F && F->hasFnAttribute("__Mips16RetHelper")) { |
| SpecialCallingConv = Mips16RetHelperConv; |
| } |
| } |
| } |
| return SpecialCallingConv; |
| } |