LCOV - code coverage report
Current view: top level - build-llvm/lib/Target/Mips - MipsGenCallingConv.inc (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 239 270 88.5 %
Date: 2018-05-20 00:06:23 Functions: 18 21 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
       2             : |*                                                                            *|
       3             : |* Calling Convention Implementation Fragment                                 *|
       4             : |*                                                                            *|
       5             : |* Automatically generated file, do not edit!                                 *|
       6             : |*                                                                            *|
       7             : \*===----------------------------------------------------------------------===*/
       8             : 
       9             : static bool CC_Mips(unsigned ValNo, MVT ValVT,
      10             :                     MVT LocVT, CCValAssign::LocInfo LocInfo,
      11             :                     ISD::ArgFlagsTy ArgFlags, CCState &State);
      12             : static bool CC_Mips16RetHelper(unsigned ValNo, MVT ValVT,
      13             :                                MVT LocVT, CCValAssign::LocInfo LocInfo,
      14             :                                ISD::ArgFlagsTy ArgFlags, CCState &State);
      15             : static bool CC_MipsN(unsigned ValNo, MVT ValVT,
      16             :                      MVT LocVT, CCValAssign::LocInfo LocInfo,
      17             :                      ISD::ArgFlagsTy ArgFlags, CCState &State);
      18             : static bool CC_MipsN_FastCC(unsigned ValNo, MVT ValVT,
      19             :                             MVT LocVT, CCValAssign::LocInfo LocInfo,
      20             :                             ISD::ArgFlagsTy ArgFlags, CCState &State);
      21             : static bool CC_MipsN_SoftFloat(unsigned ValNo, MVT ValVT,
      22             :                                MVT LocVT, CCValAssign::LocInfo LocInfo,
      23             :                                ISD::ArgFlagsTy ArgFlags, CCState &State);
      24             : static bool CC_MipsN_VarArg(unsigned ValNo, MVT ValVT,
      25             :                             MVT LocVT, CCValAssign::LocInfo LocInfo,
      26             :                             ISD::ArgFlagsTy ArgFlags, CCState &State);
      27             : static bool CC_MipsO32(unsigned ValNo, MVT ValVT,
      28             :                        MVT LocVT, CCValAssign::LocInfo LocInfo,
      29             :                        ISD::ArgFlagsTy ArgFlags, CCState &State);
      30             : static bool CC_MipsO32_FP(unsigned ValNo, MVT ValVT,
      31             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
      32             :                           ISD::ArgFlagsTy ArgFlags, CCState &State);
      33             : static bool CC_MipsO32_FastCC(unsigned ValNo, MVT ValVT,
      34             :                               MVT LocVT, CCValAssign::LocInfo LocInfo,
      35             :                               ISD::ArgFlagsTy ArgFlags, CCState &State);
      36             : static bool CC_Mips_ByVal(unsigned ValNo, MVT ValVT,
      37             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
      38             :                           ISD::ArgFlagsTy ArgFlags, CCState &State);
      39             : static bool CC_Mips_FastCC(unsigned ValNo, MVT ValVT,
      40             :                            MVT LocVT, CCValAssign::LocInfo LocInfo,
      41             :                            ISD::ArgFlagsTy ArgFlags, CCState &State);
      42             : static bool CC_Mips_FixedArg(unsigned ValNo, MVT ValVT,
      43             :                              MVT LocVT, CCValAssign::LocInfo LocInfo,
      44             :                              ISD::ArgFlagsTy ArgFlags, CCState &State);
      45             : static bool CC_Mips_VarArg(unsigned ValNo, MVT ValVT,
      46             :                            MVT LocVT, CCValAssign::LocInfo LocInfo,
      47             :                            ISD::ArgFlagsTy ArgFlags, CCState &State);
      48             : static bool RetCC_F128(unsigned ValNo, MVT ValVT,
      49             :                        MVT LocVT, CCValAssign::LocInfo LocInfo,
      50             :                        ISD::ArgFlagsTy ArgFlags, CCState &State);
      51             : static bool RetCC_F128HardFloat(unsigned ValNo, MVT ValVT,
      52             :                                 MVT LocVT, CCValAssign::LocInfo LocInfo,
      53             :                                 ISD::ArgFlagsTy ArgFlags, CCState &State);
      54             : static bool RetCC_F128SoftFloat(unsigned ValNo, MVT ValVT,
      55             :                                 MVT LocVT, CCValAssign::LocInfo LocInfo,
      56             :                                 ISD::ArgFlagsTy ArgFlags, CCState &State);
      57             : static bool RetCC_Mips(unsigned ValNo, MVT ValVT,
      58             :                        MVT LocVT, CCValAssign::LocInfo LocInfo,
      59             :                        ISD::ArgFlagsTy ArgFlags, CCState &State);
      60             : static bool RetCC_MipsN(unsigned ValNo, MVT ValVT,
      61             :                         MVT LocVT, CCValAssign::LocInfo LocInfo,
      62             :                         ISD::ArgFlagsTy ArgFlags, CCState &State);
      63             : static bool RetCC_MipsO32(unsigned ValNo, MVT ValVT,
      64             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
      65             :                           ISD::ArgFlagsTy ArgFlags, CCState &State);
      66             : 
      67             : 
      68        5779 : static bool CC_Mips(unsigned ValNo, MVT ValVT,
      69             :                     MVT LocVT, CCValAssign::LocInfo LocInfo,
      70             :                     ISD::ArgFlagsTy ArgFlags, CCState &State) {
      71             : 
      72        5779 :   if (State.isVarArg()) {
      73         516 :     if (!static_cast<MipsCCState *>(&State)->IsCallOperandFixed(ValNo)) {
      74         381 :       if (!CC_Mips_VarArg(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
      75             :         return false;
      76             :     }
      77             :   }
      78             : 
      79        5398 :   if (!CC_Mips_FixedArg(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
      80             :     return false;
      81             : 
      82           0 :   return true;  // CC didn't match.
      83             : }
      84             : 
      85             : 
      86          56 : static bool CC_Mips16RetHelper(unsigned ValNo, MVT ValVT,
      87             :                                MVT LocVT, CCValAssign::LocInfo LocInfo,
      88             :                                ISD::ArgFlagsTy ArgFlags, CCState &State) {
      89             : 
      90          56 :   if (ArgFlags.isByVal()) {
      91           0 :     if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
      92             :       return false;
      93             :   }
      94             : 
      95          56 :   if (LocVT == MVT::i32) {
      96             :     static const MCPhysReg RegList1[] = {
      97             :       Mips::V0, Mips::V1, Mips::A0, Mips::A1
      98             :     };
      99          56 :     if (unsigned Reg = State.AllocateReg(RegList1)) {
     100         112 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     101          56 :       return false;
     102             :     }
     103             :   }
     104             : 
     105             :   return true;  // CC didn't match.
     106             : }
     107             : 
     108             : 
     109        8061 : static bool CC_MipsN(unsigned ValNo, MVT ValVT,
     110             :                      MVT LocVT, CCValAssign::LocInfo LocInfo,
     111             :                      ISD::ArgFlagsTy ArgFlags, CCState &State) {
     112             : 
     113        8061 :   if (LocVT == MVT::i8 ||
     114        8061 :       LocVT == MVT::i16 ||
     115       12778 :       LocVT == MVT::i32 ||
     116             :       LocVT == MVT::i64) {
     117        6581 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     118        4342 :       if (ArgFlags.isInReg()) {
     119             :         LocVT = MVT::i64;
     120          10 :         if (ArgFlags.isSExt())
     121             :                 LocInfo = CCValAssign::SExtUpper;
     122          10 :         else if (ArgFlags.isZExt())
     123             :                 LocInfo = CCValAssign::ZExtUpper;
     124             :         else
     125             :                 LocInfo = CCValAssign::AExtUpper;
     126             :       }
     127             :     }
     128             :   }
     129             : 
     130        8061 :   if (LocVT == MVT::i8 ||
     131       16122 :       LocVT == MVT::i16 ||
     132             :       LocVT == MVT::i32) {
     133        3342 :     if (!static_cast<MipsCCState *>(&State)->WasOriginalArgFloat(ValNo)) {
     134             :       LocVT = MVT::i64;
     135        3283 :       if (ArgFlags.isSExt())
     136             :             LocInfo = CCValAssign::SExt;
     137        1427 :       else if (ArgFlags.isZExt())
     138             :             LocInfo = CCValAssign::ZExt;
     139             :       else
     140             :             LocInfo = CCValAssign::AExt;
     141             :     }
     142             :   }
     143             : 
     144        8061 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
     145         959 :     if (LocVT == MVT::i32) {
     146          59 :       if (!CC_MipsN_SoftFloat(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     147             :         return false;
     148             :     }
     149             :   }
     150             : 
     151        8002 :   if (LocVT == MVT::i64) {
     152             :     static const MCPhysReg RegList1[] = {
     153             :       Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
     154             :     };
     155             :     static const MCPhysReg RegList2[] = {
     156             :       Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
     157             :     };
     158        6522 :     if (unsigned Reg = State.AllocateReg(RegList1, RegList2)) {
     159       12874 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     160        6437 :       return false;
     161             :     }
     162             :   }
     163             : 
     164        1565 :   if (LocVT == MVT::f32) {
     165             :     static const MCPhysReg RegList3[] = {
     166             :       Mips::F12, Mips::F13, Mips::F14, Mips::F15, Mips::F16, Mips::F17, Mips::F18, Mips::F19
     167             :     };
     168             :     static const MCPhysReg RegList4[] = {
     169             :       Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
     170             :     };
     171         760 :     if (unsigned Reg = State.AllocateReg(RegList3, RegList4)) {
     172        1512 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     173         756 :       return false;
     174             :     }
     175             :   }
     176             : 
     177         809 :   if (LocVT == MVT::f64) {
     178             :     static const MCPhysReg RegList5[] = {
     179             :       Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
     180             :     };
     181             :     static const MCPhysReg RegList6[] = {
     182             :       Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
     183             :     };
     184         720 :     if (unsigned Reg = State.AllocateReg(RegList5, RegList6)) {
     185        1416 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     186         708 :       return false;
     187             :     }
     188             :   }
     189             : 
     190         101 :   if (LocVT == MVT::f32) {
     191           4 :     unsigned Offset7 = State.AllocateStack(4, 8);
     192           8 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset7, LocVT, LocInfo));
     193           4 :     return false;
     194             :   }
     195             : 
     196          97 :   if (LocVT == MVT::i64 ||
     197             :       LocVT == MVT::f64) {
     198          97 :     unsigned Offset8 = State.AllocateStack(8, 8);
     199         194 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset8, LocVT, LocInfo));
     200          97 :     return false;
     201             :   }
     202             : 
     203             :   return true;  // CC didn't match.
     204             : }
     205             : 
     206             : 
     207           0 : static bool CC_MipsN_FastCC(unsigned ValNo, MVT ValVT,
     208             :                             MVT LocVT, CCValAssign::LocInfo LocInfo,
     209             :                             ISD::ArgFlagsTy ArgFlags, CCState &State) {
     210             : 
     211           0 :   if (LocVT == MVT::i64) {
     212             :     static const MCPhysReg RegList1[] = {
     213             :       Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64, Mips::T4_64, Mips::T5_64, Mips::T6_64, Mips::T7_64, Mips::T8_64, Mips::V1_64
     214             :     };
     215           0 :     if (unsigned Reg = State.AllocateReg(RegList1)) {
     216           0 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     217             :       return false;
     218             :     }
     219             :   }
     220             : 
     221           0 :   if (LocVT == MVT::f64) {
     222             :     static const MCPhysReg RegList2[] = {
     223             :       Mips::D0_64, Mips::D1_64, Mips::D2_64, Mips::D3_64, Mips::D4_64, Mips::D5_64, Mips::D6_64, Mips::D7_64, Mips::D8_64, Mips::D9_64, Mips::D10_64, Mips::D11_64, Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
     224             :     };
     225           0 :     if (unsigned Reg = State.AllocateReg(RegList2)) {
     226           0 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     227             :       return false;
     228             :     }
     229             :   }
     230             : 
     231           0 :   if (LocVT == MVT::i64 ||
     232             :       LocVT == MVT::f64) {
     233           0 :     unsigned Offset3 = State.AllocateStack(8, 8);
     234           0 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset3, LocVT, LocInfo));
     235             :     return false;
     236             :   }
     237             : 
     238             :   return true;  // CC didn't match.
     239             : }
     240             : 
     241             : 
     242          59 : static bool CC_MipsN_SoftFloat(unsigned ValNo, MVT ValVT,
     243             :                                MVT LocVT, CCValAssign::LocInfo LocInfo,
     244             :                                ISD::ArgFlagsTy ArgFlags, CCState &State) {
     245             : 
     246             :   static const MCPhysReg RegList1[] = {
     247             :     Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3
     248             :   };
     249             :   static const MCPhysReg RegList2[] = {
     250             :     Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
     251             :   };
     252          59 :   if (unsigned Reg = State.AllocateReg(RegList1, RegList2)) {
     253         102 :     State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     254             :     return false;
     255             :   }
     256             : 
     257           8 :   unsigned Offset3 = State.AllocateStack(4, 8);
     258          16 :   State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset3, LocVT, LocInfo));
     259             :   return false;
     260             : 
     261             :   return true;  // CC didn't match.
     262             : }
     263             : 
     264             : 
     265          32 : static bool CC_MipsN_VarArg(unsigned ValNo, MVT ValVT,
     266             :                             MVT LocVT, CCValAssign::LocInfo LocInfo,
     267             :                             ISD::ArgFlagsTy ArgFlags, CCState &State) {
     268             : 
     269          32 :   if (LocVT == MVT::i8 ||
     270          32 :       LocVT == MVT::i16 ||
     271          41 :       LocVT == MVT::i32 ||
     272             :       LocVT == MVT::i64) {
     273          32 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     274          24 :       if (ArgFlags.isInReg()) {
     275             :         LocVT = MVT::i64;
     276          24 :         if (ArgFlags.isSExt())
     277             :                 LocInfo = CCValAssign::SExtUpper;
     278          24 :         else if (ArgFlags.isZExt())
     279             :                 LocInfo = CCValAssign::ZExtUpper;
     280             :         else
     281             :                 LocInfo = CCValAssign::AExtUpper;
     282             :       }
     283             :     }
     284             :   }
     285             : 
     286          32 :   if (LocVT == MVT::i8 ||
     287          64 :       LocVT == MVT::i16 ||
     288             :       LocVT == MVT::i32) {
     289             :     LocVT = MVT::i64;
     290           8 :     if (ArgFlags.isSExt())
     291             :         LocInfo = CCValAssign::SExt;
     292           8 :     else if (ArgFlags.isZExt())
     293             :         LocInfo = CCValAssign::ZExt;
     294             :     else
     295             :         LocInfo = CCValAssign::AExt;
     296             :   }
     297             : 
     298          32 :   if (LocVT == MVT::f32) {
     299             :     static const MCPhysReg RegList1[] = {
     300             :       Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3
     301             :     };
     302           0 :     if (unsigned Reg = State.AllocateReg(RegList1)) {
     303           0 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     304           0 :       return false;
     305             :     }
     306             :   }
     307             : 
     308          32 :   if (LocVT == MVT::i64 ||
     309             :       LocVT == MVT::f64) {
     310             :     static const MCPhysReg RegList2[] = {
     311             :       Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
     312             :     };
     313          32 :     if (unsigned Reg = State.AllocateReg(RegList2)) {
     314          60 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     315          30 :       return false;
     316             :     }
     317             :   }
     318             : 
     319           2 :   if (LocVT == MVT::f32) {
     320           0 :     unsigned Offset3 = State.AllocateStack(4, 8);
     321           0 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset3, LocVT, LocInfo));
     322           0 :     return false;
     323             :   }
     324             : 
     325           2 :   if (LocVT == MVT::i64 ||
     326             :       LocVT == MVT::f64) {
     327           2 :     unsigned Offset4 = State.AllocateStack(8, 8);
     328           4 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset4, LocVT, LocInfo));
     329           2 :     return false;
     330             :   }
     331             : 
     332             :   return true;  // CC didn't match.
     333             : }
     334             : 
     335             : 
     336         156 : static bool CC_MipsO32(unsigned ValNo, MVT ValVT,
     337             :                        MVT LocVT, CCValAssign::LocInfo LocInfo,
     338             :                        ISD::ArgFlagsTy ArgFlags, CCState &State) {
     339             : 
     340         156 :   if (LocVT == MVT::i1 ||
     341         290 :       LocVT == MVT::i8 ||
     342             :       LocVT == MVT::i16) {
     343             :     LocVT = MVT::i32;
     344          42 :     if (ArgFlags.isSExt())
     345             :         LocInfo = CCValAssign::SExt;
     346          42 :     else if (ArgFlags.isZExt())
     347             :         LocInfo = CCValAssign::ZExt;
     348             :     else
     349             :         LocInfo = CCValAssign::AExt;
     350             :   }
     351             : 
     352         156 :   if (LocVT == MVT::i32 ||
     353             :       LocVT == MVT::f32) {
     354         150 :     unsigned Offset1 = State.AllocateStack(4, 4);
     355         300 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset1, LocVT, LocInfo));
     356         150 :     return false;
     357             :   }
     358             : 
     359           6 :   if (LocVT == MVT::f64) {
     360           6 :     unsigned Offset2 = State.AllocateStack(8, 8);
     361          12 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset2, LocVT, LocInfo));
     362           6 :     return false;
     363             :   }
     364             : 
     365             :   return true;  // CC didn't match.
     366             : }
     367             : 
     368             : 
     369       15597 : static bool CC_MipsO32_FP(unsigned ValNo, MVT ValVT,
     370             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
     371             :                           ISD::ArgFlagsTy ArgFlags, CCState &State) {
     372             : 
     373       15597 :   if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     374        9638 :     if (!CC_MipsO32_FP32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     375             :       return false;
     376             :   }
     377             : 
     378        5959 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     379        5959 :     if (!CC_MipsO32_FP64(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     380             :       return false;
     381             :   }
     382             : 
     383             :   return true;  // CC didn't match.
     384             : }
     385             : 
     386             : 
     387          88 : static bool CC_MipsO32_FastCC(unsigned ValNo, MVT ValVT,
     388             :                               MVT LocVT, CCValAssign::LocInfo LocInfo,
     389             :                               ISD::ArgFlagsTy ArgFlags, CCState &State) {
     390             : 
     391          88 :   if (LocVT == MVT::f64) {
     392          88 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     393             :       static const MCPhysReg RegList1[] = {
     394             :         Mips::D0, Mips::D1, Mips::D2, Mips::D3, Mips::D4, Mips::D5, Mips::D6, Mips::D7, Mips::D8, Mips::D9
     395             :       };
     396          66 :       if (unsigned Reg = State.AllocateReg(RegList1)) {
     397         120 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     398             :         return false;
     399             :       }
     400             :     }
     401             :   }
     402             : 
     403          28 :   if (LocVT == MVT::f64) {
     404          28 :     if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     405          22 :       if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useOddSPReg()) {
     406             :         static const MCPhysReg RegList2[] = {
     407             :           Mips::D0_64, Mips::D1_64, Mips::D2_64, Mips::D3_64, Mips::D4_64, Mips::D5_64, Mips::D6_64, Mips::D7_64, Mips::D8_64, Mips::D9_64, Mips::D10_64, Mips::D11_64, Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
     408             :         };
     409           0 :         if (unsigned Reg = State.AllocateReg(RegList2)) {
     410           0 :           State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     411             :           return false;
     412             :         }
     413             :       }
     414             :     }
     415             :   }
     416             : 
     417          28 :   if (LocVT == MVT::f64) {
     418          28 :     if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     419          22 :       if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).noOddSPReg()) {
     420             :         static const MCPhysReg RegList3[] = {
     421             :           Mips::D0_64, Mips::D2_64, Mips::D4_64, Mips::D6_64, Mips::D8_64, Mips::D10_64, Mips::D12_64, Mips::D14_64, Mips::D16_64, Mips::D18_64
     422             :         };
     423          22 :         if (unsigned Reg = State.AllocateReg(RegList3)) {
     424          40 :           State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     425             :           return false;
     426             :         }
     427             :       }
     428             :     }
     429             :   }
     430             : 
     431           8 :   if (LocVT == MVT::f64) {
     432           8 :     unsigned Offset4 = State.AllocateStack(8, 8);
     433          16 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset4, LocVT, LocInfo));
     434             :     return false;
     435             :   }
     436             : 
     437             :   return true;  // CC didn't match.
     438             : }
     439             : 
     440             : 
     441          80 : static bool CC_Mips_ByVal(unsigned ValNo, MVT ValVT,
     442             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
     443             :                           ISD::ArgFlagsTy ArgFlags, CCState &State) {
     444             : 
     445          80 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
     446          58 :     if (ArgFlags.isByVal()) {
     447          58 :       State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 4, 4, ArgFlags);
     448          58 :       return false;
     449             :     }
     450             :   }
     451             : 
     452          22 :   if (ArgFlags.isByVal()) {
     453          22 :     State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 8, 8, ArgFlags);
     454          22 :     return false;
     455             :   }
     456             : 
     457             :   return true;  // CC didn't match.
     458             : }
     459             : 
     460             : 
     461         744 : static bool CC_Mips_FastCC(unsigned ValNo, MVT ValVT,
     462             :                            MVT LocVT, CCValAssign::LocInfo LocInfo,
     463             :                            ISD::ArgFlagsTy ArgFlags, CCState &State) {
     464             : 
     465         744 :   if (ArgFlags.isByVal()) {
     466           0 :     State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 4, 4, ArgFlags);
     467           0 :     return false;
     468             :   }
     469             : 
     470         744 :   if (LocVT == MVT::i8 ||
     471             :       LocVT == MVT::i16) {
     472             :     LocVT = MVT::i32;
     473           0 :     if (ArgFlags.isSExt())
     474             :         LocInfo = CCValAssign::SExt;
     475           0 :     else if (ArgFlags.isZExt())
     476             :         LocInfo = CCValAssign::ZExt;
     477             :     else
     478             :         LocInfo = CCValAssign::AExt;
     479             :   }
     480             : 
     481         744 :   if (LocVT == MVT::i32) {
     482         800 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isTargetNaCl()) {
     483             :       static const MCPhysReg RegList1[] = {
     484             :         Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3, Mips::T4, Mips::T5, Mips::T6, Mips::T7, Mips::T8, Mips::V1
     485             :       };
     486         366 :       if (unsigned Reg = State.AllocateReg(RegList1)) {
     487         696 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     488         348 :         return false;
     489             :       }
     490             :     }
     491             :   }
     492             : 
     493         396 :   if (LocVT == MVT::i32) {
     494         104 :     if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isTargetNaCl()) {
     495             :       static const MCPhysReg RegList2[] = {
     496             :         Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3, Mips::T4, Mips::T5, Mips::V1
     497             :       };
     498          34 :       if (unsigned Reg = State.AllocateReg(RegList2)) {
     499          44 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     500          22 :         return false;
     501             :       }
     502             :     }
     503             :   }
     504             : 
     505         374 :   if (LocVT == MVT::f32) {
     506         256 :     if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useOddSPReg()) {
     507             :       static const MCPhysReg RegList3[] = {
     508             :         Mips::F0, Mips::F1, Mips::F2, Mips::F3, Mips::F4, Mips::F5, Mips::F6, Mips::F7, Mips::F8, Mips::F9, Mips::F10, Mips::F11, Mips::F12, Mips::F13, Mips::F14, Mips::F15, Mips::F16, Mips::F17, Mips::F18, Mips::F19
     509             :       };
     510         128 :       if (unsigned Reg = State.AllocateReg(RegList3)) {
     511         248 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     512         124 :         return false;
     513             :       }
     514             :     }
     515             :   }
     516             : 
     517         250 :   if (LocVT == MVT::f32) {
     518         132 :     if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).noOddSPReg()) {
     519             :       static const MCPhysReg RegList4[] = {
     520             :         Mips::F0, Mips::F2, Mips::F4, Mips::F6, Mips::F8, Mips::F10, Mips::F12, Mips::F14, Mips::F16, Mips::F18
     521             :       };
     522         128 :       if (unsigned Reg = State.AllocateReg(RegList4)) {
     523         160 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     524          80 :         return false;
     525             :       }
     526             :     }
     527             :   }
     528             : 
     529         170 :   if (LocVT == MVT::i32 ||
     530             :       LocVT == MVT::f32) {
     531          82 :     unsigned Offset5 = State.AllocateStack(4, 4);
     532         164 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset5, LocVT, LocInfo));
     533          82 :     return false;
     534             :   }
     535             : 
     536          88 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
     537          88 :     if (!CC_MipsO32_FastCC(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     538             :       return false;
     539             :   }
     540             : 
     541           0 :   if (!CC_MipsN_FastCC(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     542             :     return false;
     543             : 
     544           0 :   return true;  // CC didn't match.
     545             : }
     546             : 
     547             : 
     548       24189 : static bool CC_Mips_FixedArg(unsigned ValNo, MVT ValVT,
     549             :                              MVT LocVT, CCValAssign::LocInfo LocInfo,
     550             :                              ISD::ArgFlagsTy ArgFlags, CCState &State) {
     551             : 
     552       24189 :   if (State.getCallingConv() != CallingConv::Fast) {
     553       23444 :     if (static_cast<MipsCCState *>(&State)->getSpecialCallingConv() == MipsCCState::Mips16RetHelperConv) {
     554          56 :       if (!CC_Mips16RetHelper(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     555             :         return false;
     556             :     }
     557             :   }
     558             : 
     559       24133 :   if (ArgFlags.isByVal()) {
     560          80 :     if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     561             :       return false;
     562             :   }
     563             : 
     564       24053 :   if (LocVT == MVT::i64) {
     565        3297 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
     566        2484 :       if (static_cast<MipsCCState *>(&State)->WasOriginalArgF128(ValNo)) {
     567             :         LocVT = MVT::f64;
     568             :         LocInfo = CCValAssign::BCvt;
     569             :       }
     570             :     }
     571             :   }
     572             : 
     573       24053 :   if (State.getCallingConv() == CallingConv::Fast) {
     574         744 :     if (!CC_Mips_FastCC(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     575             :       return false;
     576             :   }
     577             : 
     578       23309 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
     579       15248 :     if (!CC_MipsO32_FP(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     580             :       return false;
     581             :   }
     582             : 
     583        8061 :   if (!CC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     584             :     return false;
     585             : 
     586           0 :   return true;  // CC didn't match.
     587             : }
     588             : 
     589             : 
     590         381 : static bool CC_Mips_VarArg(unsigned ValNo, MVT ValVT,
     591             :                            MVT LocVT, CCValAssign::LocInfo LocInfo,
     592             :                            ISD::ArgFlagsTy ArgFlags, CCState &State) {
     593             : 
     594         381 :   if (ArgFlags.isByVal()) {
     595           0 :     if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     596             :       return false;
     597             :   }
     598             : 
     599         381 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
     600         349 :     if (!CC_MipsO32_FP(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     601             :       return false;
     602             :   }
     603             : 
     604          32 :   if (!CC_MipsN_VarArg(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     605             :     return false;
     606             : 
     607           0 :   return true;  // CC didn't match.
     608             : }
     609             : 
     610             : 
     611        1160 : static bool RetCC_F128(unsigned ValNo, MVT ValVT,
     612             :                        MVT LocVT, CCValAssign::LocInfo LocInfo,
     613             :                        ISD::ArgFlagsTy ArgFlags, CCState &State) {
     614             : 
     615        1160 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
     616        1112 :     if (LocVT == MVT::i64) {
     617        1112 :       if (!RetCC_F128SoftFloat(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     618             :         return false;
     619             :     }
     620             :   }
     621             : 
     622          48 :   if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
     623          48 :     if (LocVT == MVT::i64) {
     624          48 :       if (!RetCC_F128HardFloat(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     625             :         return false;
     626             :     }
     627             :   }
     628             : 
     629             :   return true;  // CC didn't match.
     630             : }
     631             : 
     632             : 
     633          48 : static bool RetCC_F128HardFloat(unsigned ValNo, MVT ValVT,
     634             :                                 MVT LocVT, CCValAssign::LocInfo LocInfo,
     635             :                                 ISD::ArgFlagsTy ArgFlags, CCState &State) {
     636             : 
     637             :   LocVT = MVT::f64;
     638             :   LocInfo = CCValAssign::BCvt;
     639             : 
     640          48 :   if (ArgFlags.isInReg()) {
     641             :     static const MCPhysReg RegList1[] = {
     642             :       Mips::D0_64, Mips::D1_64
     643             :     };
     644          16 :     if (unsigned Reg = State.AllocateReg(RegList1)) {
     645          32 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     646             :       return false;
     647             :     }
     648             :   }
     649             : 
     650             :   static const MCPhysReg RegList2[] = {
     651             :     Mips::D0_64, Mips::D2_64
     652             :   };
     653          32 :   if (unsigned Reg = State.AllocateReg(RegList2)) {
     654          64 :     State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     655             :     return false;
     656             :   }
     657             : 
     658             :   return true;  // CC didn't match.
     659             : }
     660             : 
     661             : 
     662        1112 : static bool RetCC_F128SoftFloat(unsigned ValNo, MVT ValVT,
     663             :                                 MVT LocVT, CCValAssign::LocInfo LocInfo,
     664             :                                 ISD::ArgFlagsTy ArgFlags, CCState &State) {
     665             : 
     666             :   static const MCPhysReg RegList1[] = {
     667             :     Mips::V0_64, Mips::A0_64
     668             :   };
     669        1112 :   if (unsigned Reg = State.AllocateReg(RegList1)) {
     670        2224 :     State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     671             :     return false;
     672             :   }
     673             : 
     674             :   return true;  // CC didn't match.
     675             : }
     676             : 
     677             : 
     678       23220 : static bool RetCC_Mips(unsigned ValNo, MVT ValVT,
     679             :                        MVT LocVT, CCValAssign::LocInfo LocInfo,
     680             :                        ISD::ArgFlagsTy ArgFlags, CCState &State) {
     681             : 
     682       23220 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_N32()) {
     683         379 :     if (!RetCC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     684             :       return false;
     685             :   }
     686             : 
     687       22974 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_N64()) {
     688        8760 :     if (!RetCC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     689             :       return false;
     690             :   }
     691             : 
     692       17842 :   if (!RetCC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     693             :     return false;
     694             : 
     695          55 :   return true;  // CC didn't match.
     696             : }
     697             : 
     698             : 
     699        9139 : static bool RetCC_MipsN(unsigned ValNo, MVT ValVT,
     700             :                         MVT LocVT, CCValAssign::LocInfo LocInfo,
     701             :                         ISD::ArgFlagsTy ArgFlags, CCState &State) {
     702             : 
     703        9139 :   if (LocVT == MVT::i64) {
     704        4152 :     if (static_cast<MipsCCState *>(&State)->WasOriginalArgF128(ValNo)) {
     705        1160 :       if (!RetCC_F128(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     706             :         return false;
     707             :     }
     708             :   }
     709             : 
     710        7979 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     711        2541 :     if (LocVT == MVT::i8 ||
     712        2541 :         LocVT == MVT::i16 ||
     713        4082 :         LocVT == MVT::i32 ||
     714             :         LocVT == MVT::i64) {
     715        1911 :       if (ArgFlags.isInReg()) {
     716             :         LocVT = MVT::i64;
     717          12 :         if (ArgFlags.isSExt())
     718             :                 LocInfo = CCValAssign::SExt;
     719          12 :         else if (ArgFlags.isZExt())
     720             :                 LocInfo = CCValAssign::ZExt;
     721             :         else
     722             :                 LocInfo = CCValAssign::AExt;
     723             :       }
     724             :     }
     725             :   }
     726             : 
     727        7979 :   if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     728        5438 :     if (LocVT == MVT::i8 ||
     729        5438 :         LocVT == MVT::i16 ||
     730        8099 :         LocVT == MVT::i32 ||
     731             :         LocVT == MVT::i64) {
     732        4858 :       if (ArgFlags.isInReg()) {
     733             :         LocVT = MVT::i64;
     734          12 :         if (ArgFlags.isSExt())
     735             :                 LocInfo = CCValAssign::SExtUpper;
     736          12 :         else if (ArgFlags.isZExt())
     737             :                 LocInfo = CCValAssign::ZExtUpper;
     738             :         else
     739             :                 LocInfo = CCValAssign::AExtUpper;
     740             :       }
     741             :     }
     742             :   }
     743             : 
     744        7979 :   if (LocVT == MVT::i64) {
     745             :     static const MCPhysReg RegList1[] = {
     746             :       Mips::V0_64, Mips::V1_64
     747             :     };
     748        3008 :     if (unsigned Reg = State.AllocateReg(RegList1)) {
     749        6016 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     750        3008 :       return false;
     751             :     }
     752             :   }
     753             : 
     754        4971 :   if (LocVT == MVT::f32) {
     755             :     static const MCPhysReg RegList2[] = {
     756             :       Mips::F0, Mips::F2
     757             :     };
     758         706 :     if (unsigned Reg = State.AllocateReg(RegList2)) {
     759        1412 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     760         706 :       return false;
     761             :     }
     762             :   }
     763             : 
     764        4265 :   if (LocVT == MVT::f64) {
     765             :     static const MCPhysReg RegList3[] = {
     766             :       Mips::D0_64, Mips::D2_64
     767             :     };
     768         504 :     if (unsigned Reg = State.AllocateReg(RegList3)) {
     769        1008 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     770         504 :       return false;
     771             :     }
     772             :   }
     773             : 
     774             :   return true;  // CC didn't match.
     775             : }
     776             : 
     777             : 
     778       17842 : static bool RetCC_MipsO32(unsigned ValNo, MVT ValVT,
     779             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
     780             :                           ISD::ArgFlagsTy ArgFlags, CCState &State) {
     781             : 
     782       17842 :   if (LocVT == MVT::i1 ||
     783       35684 :       LocVT == MVT::i8 ||
     784             :       LocVT == MVT::i16) {
     785             :     LocVT = MVT::i32;
     786           0 :     if (ArgFlags.isSExt())
     787             :         LocInfo = CCValAssign::SExt;
     788           0 :     else if (ArgFlags.isZExt())
     789             :         LocInfo = CCValAssign::ZExt;
     790             :     else
     791             :         LocInfo = CCValAssign::AExt;
     792             :   }
     793             : 
     794       17842 :   if (!static_cast<MipsCCState *>(&State)->WasOriginalRetVectorFloat(ValNo)) {
     795       17795 :     if (LocVT == MVT::i32) {
     796             :       static const MCPhysReg RegList1[] = {
     797             :         Mips::V0, Mips::V1, Mips::A0, Mips::A1
     798             :       };
     799       16230 :       if (unsigned Reg = State.AllocateReg(RegList1)) {
     800       32444 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     801       16222 :         return false;
     802             :       }
     803             :     }
     804             :   }
     805             : 
     806        1620 :   if (LocVT == MVT::f32) {
     807             :     static const MCPhysReg RegList2[] = {
     808             :       Mips::F0, Mips::F2
     809             :     };
     810         765 :     if (unsigned Reg = State.AllocateReg(RegList2)) {
     811        1530 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     812         765 :       return false;
     813             :     }
     814             :   }
     815             : 
     816         855 :   if (LocVT == MVT::f64) {
     817         800 :     if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     818             :       static const MCPhysReg RegList3[] = {
     819             :         Mips::D0_64, Mips::D2_64
     820             :       };
     821         276 :       if (unsigned Reg = State.AllocateReg(RegList3)) {
     822         552 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     823         276 :         return false;
     824             :       }
     825             :     }
     826             :   }
     827             : 
     828         579 :   if (LocVT == MVT::f64) {
     829         524 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     830             :       static const MCPhysReg RegList4[] = {
     831             :         Mips::D0, Mips::D1
     832             :       };
     833         524 :       if (unsigned Reg = State.AllocateReg(RegList4)) {
     834        1048 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     835         524 :         return false;
     836             :       }
     837             :     }
     838             :   }
     839             : 
     840             :   return true;  // CC didn't match.
     841             : }

Generated by: LCOV version 1.13