brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 86bb3e6 Raw
31 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "MipsCCState.h"10#include "MipsSubtarget.h"11#include "llvm/IR/Module.h"12 13using namespace llvm;14 15MipsCCState::SpecialCallingConvType16MipsCCState::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>(Callee)) {22      llvm::StringRef Sym = G->getGlobal()->getName();23      Function *F = G->getGlobal()->getParent()->getFunction(Sym);24      if (F && F->hasFnAttribute("__Mips16RetHelper")) {25        SpecialCallingConv = Mips16RetHelperConv;26      }27    }28  }29  return SpecialCallingConv;30}31