xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/Mips16HardFloatInfo.cpp (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===---- Mips16HardFloatInfo.cpp for Mips16 Hard Float              -----===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric //
9*0b57cec5SDimitry Andric // This file contains the Mips16 implementation of Mips16HardFloatInfo
10*0b57cec5SDimitry Andric // namespace.
11*0b57cec5SDimitry Andric //
12*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric #include "Mips16HardFloatInfo.h"
15*0b57cec5SDimitry Andric #include <string.h>
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric namespace llvm {
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric namespace Mips16HardFloatInfo {
20*0b57cec5SDimitry Andric 
21*0b57cec5SDimitry Andric const FuncNameSignature PredefinedFuncs[] = {
22*0b57cec5SDimitry Andric   { "__floatdidf", { NoSig, DRet } },
23*0b57cec5SDimitry Andric   { "__floatdisf", { NoSig, FRet } },
24*0b57cec5SDimitry Andric   { "__floatundidf", { NoSig, DRet } },
25*0b57cec5SDimitry Andric   { "__fixsfdi", { FSig, NoFPRet } },
26*0b57cec5SDimitry Andric   { "__fixunsdfsi", { DSig, NoFPRet } },
27*0b57cec5SDimitry Andric   { "__fixunsdfdi", { DSig, NoFPRet } },
28*0b57cec5SDimitry Andric   { "__fixdfdi", { DSig, NoFPRet } },
29*0b57cec5SDimitry Andric   { "__fixunssfsi", { FSig, NoFPRet } },
30*0b57cec5SDimitry Andric   { "__fixunssfdi", { FSig, NoFPRet } },
31*0b57cec5SDimitry Andric   { "__floatundisf", { NoSig, FRet } },
32*0b57cec5SDimitry Andric   { nullptr, { NoSig, NoFPRet } }
33*0b57cec5SDimitry Andric };
34*0b57cec5SDimitry Andric 
35*0b57cec5SDimitry Andric // just do a search for now. there are very few of these special cases.
36*0b57cec5SDimitry Andric //
findFuncSignature(const char * name)37*0b57cec5SDimitry Andric extern FuncSignature const *findFuncSignature(const char *name) {
38*0b57cec5SDimitry Andric   const char *name_;
39*0b57cec5SDimitry Andric   int i = 0;
40*0b57cec5SDimitry Andric   while (PredefinedFuncs[i].Name) {
41*0b57cec5SDimitry Andric     name_ = PredefinedFuncs[i].Name;
42*0b57cec5SDimitry Andric     if (strcmp(name, name_) == 0)
43*0b57cec5SDimitry Andric       return &PredefinedFuncs[i].Signature;
44*0b57cec5SDimitry Andric     i++;
45*0b57cec5SDimitry Andric   }
46*0b57cec5SDimitry Andric   return nullptr;
47*0b57cec5SDimitry Andric }
48*0b57cec5SDimitry Andric }
49*0b57cec5SDimitry Andric }
50