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: 269 307 87.6 %
Date: 2017-09-14 15:23:50 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        5813 : static bool CC_Mips(unsigned ValNo, MVT ValVT,
      69             :                     MVT LocVT, CCValAssign::LocInfo LocInfo,
      70             :                     ISD::ArgFlagsTy ArgFlags, CCState &State) {
      71             : 
      72        5813 :   if (State.isVarArg()) {
      73         528 :     if (!static_cast<MipsCCState *>(&State)->IsCallOperandFixed(ValNo)) {
      74         392 :       if (!CC_Mips_VarArg(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
      75             :         return false;
      76             :     }
      77             :   }
      78             : 
      79        5421 :   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         112 :   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        8498 : static bool CC_MipsN(unsigned ValNo, MVT ValVT,
     110             :                      MVT LocVT, CCValAssign::LocInfo LocInfo,
     111             :                      ISD::ArgFlagsTy ArgFlags, CCState &State) {
     112             : 
     113       16996 :   if (LocVT == MVT::i8 ||
     114       16996 :       LocVT == MVT::i16 ||
     115       21903 :       LocVT == MVT::i32 ||
     116        4907 :       LocVT == MVT::i64) {
     117        6957 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     118        4575 :       if (ArgFlags.isInReg()) {
     119          10 :         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          10 :                 LocInfo = CCValAssign::AExtUpper;
     126             :       }
     127             :     }
     128             :   }
     129             : 
     130       16996 :   if (LocVT == MVT::i8 ||
     131       16996 :       LocVT == MVT::i16 ||
     132        8498 :       LocVT == MVT::i32) {
     133        3589 :     if (!static_cast<MipsCCState *>(&State)->WasOriginalArgFloat(ValNo)) {
     134        3530 :       LocVT = MVT::i64;
     135        3530 :       if (ArgFlags.isSExt())
     136             :             LocInfo = CCValAssign::SExt;
     137        1542 :       else if (ArgFlags.isZExt())
     138             :             LocInfo = CCValAssign::ZExt;
     139             :       else
     140        1418 :             LocInfo = CCValAssign::AExt;
     141             :     }
     142             :   }
     143             : 
     144        8498 :   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        8439 :   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        6898 :     if (unsigned Reg = State.AllocateReg(RegList1, RegList2)) {
     159       13614 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     160        6807 :       return false;
     161             :     }
     162             :   }
     163             : 
     164        1632 :   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         791 :     if (unsigned Reg = State.AllocateReg(RegList3, RegList4)) {
     172        1574 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     173         787 :       return false;
     174             :     }
     175             :   }
     176             : 
     177         845 :   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         750 :     if (unsigned Reg = State.AllocateReg(RegList5, RegList6)) {
     185        1476 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     186         738 :       return false;
     187             :     }
     188             :   }
     189             : 
     190         107 :   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         115 :   if (LocVT == MVT::i64 ||
     197          12 :       LocVT == MVT::f64) {
     198         103 :     unsigned Offset8 = State.AllocateStack(8, 8);
     199         206 :     State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset8, LocVT, LocInfo));
     200         103 :     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           0 :       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          38 : static bool CC_MipsN_VarArg(unsigned ValNo, MVT ValVT,
     266             :                             MVT LocVT, CCValAssign::LocInfo LocInfo,
     267             :                             ISD::ArgFlagsTy ArgFlags, CCState &State) {
     268             : 
     269          76 :   if (LocVT == MVT::i8 ||
     270          76 :       LocVT == MVT::i16 ||
     271          85 :       LocVT == MVT::i32 ||
     272           9 :       LocVT == MVT::i64) {
     273          38 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     274          26 :       if (ArgFlags.isInReg()) {
     275          24 :         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          24 :                 LocInfo = CCValAssign::AExtUpper;
     282             :       }
     283             :     }
     284             :   }
     285             : 
     286          76 :   if (LocVT == MVT::i8 ||
     287          76 :       LocVT == MVT::i16 ||
     288          38 :       LocVT == MVT::i32) {
     289          14 :     LocVT = MVT::i64;
     290          14 :     if (ArgFlags.isSExt())
     291             :         LocInfo = CCValAssign::SExt;
     292          14 :     else if (ArgFlags.isZExt())
     293             :         LocInfo = CCValAssign::ZExt;
     294             :     else
     295          14 :         LocInfo = CCValAssign::AExt;
     296             :   }
     297             : 
     298          38 :   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          38 :   if (LocVT == MVT::i64 ||
     309           0 :       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          38 :     if (unsigned Reg = State.AllocateReg(RegList2)) {
     314          72 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     315          36 :       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           0 :       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         312 :   if (LocVT == MVT::i1 ||
     341         290 :       LocVT == MVT::i8 ||
     342         134 :       LocVT == MVT::i16) {
     343          42 :     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          42 :         LocInfo = CCValAssign::AExt;
     350             :   }
     351             : 
     352         192 :   if (LocVT == MVT::i32 ||
     353          36 :       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       15273 : static bool CC_MipsO32_FP(unsigned ValNo, MVT ValVT,
     370             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
     371             :                           ISD::ArgFlagsTy ArgFlags, CCState &State) {
     372             : 
     373       15273 :   if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     374        9471 :     if (!CC_MipsO32_FP32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     375             :       return false;
     376             :   }
     377             : 
     378        5802 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     379        5802 :     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          84 : static bool CC_Mips_ByVal(unsigned ValNo, MVT ValVT,
     442             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
     443             :                           ISD::ArgFlagsTy ArgFlags, CCState &State) {
     444             : 
     445          84 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
     446          56 :     if (ArgFlags.isByVal()) {
     447          56 :       State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 4, 4, ArgFlags);
     448          56 :       return false;
     449             :     }
     450             :   }
     451             : 
     452          28 :   if (ArgFlags.isByVal()) {
     453          28 :     State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 8, 8, ArgFlags);
     454          28 :     return false;
     455             :   }
     456             : 
     457             :   return true;  // CC didn't match.
     458             : }
     459             : 
     460             : 
     461         783 : static bool CC_Mips_FastCC(unsigned ValNo, MVT ValVT,
     462             :                            MVT LocVT, CCValAssign::LocInfo LocInfo,
     463             :                            ISD::ArgFlagsTy ArgFlags, CCState &State) {
     464             : 
     465         783 :   if (ArgFlags.isByVal()) {
     466           0 :     State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 4, 4, ArgFlags);
     467           0 :     return false;
     468             :   }
     469             : 
     470        1566 :   if (LocVT == MVT::i8 ||
     471         783 :       LocVT == MVT::i16) {
     472           0 :     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           0 :         LocInfo = CCValAssign::AExt;
     479             :   }
     480             : 
     481         783 :   if (LocVT == MVT::i32) {
     482         878 :     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         405 :       if (unsigned Reg = State.AllocateReg(RegList1)) {
     487         774 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     488         387 :         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         310 :   if (LocVT == MVT::i32 ||
     530         140 :       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       24340 : static bool CC_Mips_FixedArg(unsigned ValNo, MVT ValVT,
     549             :                              MVT LocVT, CCValAssign::LocInfo LocInfo,
     550             :                              ISD::ArgFlagsTy ArgFlags, CCState &State) {
     551             : 
     552       24340 :   if (State.getCallingConv() != CallingConv::Fast) {
     553       23557 :     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       24284 :   if (ArgFlags.isByVal()) {
     560          84 :     if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     561             :       return false;
     562             :   }
     563             : 
     564       24200 :   if (LocVT == MVT::i64) {
     565        3426 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
     566        2613 :       if (static_cast<MipsCCState *>(&State)->WasOriginalArgF128(ValNo)) {
     567          60 :         LocVT = MVT::f64;
     568          60 :         LocInfo = CCValAssign::BCvt;
     569             :       }
     570             :     }
     571             :   }
     572             : 
     573       24200 :   if (State.getCallingConv() == CallingConv::Fast) {
     574         783 :     if (!CC_Mips_FastCC(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     575             :       return false;
     576             :   }
     577             : 
     578       23417 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
     579       14919 :     if (!CC_MipsO32_FP(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     580             :       return false;
     581             :   }
     582             : 
     583        8498 :   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         392 : static bool CC_Mips_VarArg(unsigned ValNo, MVT ValVT,
     591             :                            MVT LocVT, CCValAssign::LocInfo LocInfo,
     592             :                            ISD::ArgFlagsTy ArgFlags, CCState &State) {
     593             : 
     594         392 :   if (ArgFlags.isByVal()) {
     595           0 :     if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     596             :       return false;
     597             :   }
     598             : 
     599         392 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
     600         354 :     if (!CC_MipsO32_FP(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     601             :       return false;
     602             :   }
     603             : 
     604          38 :   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          48 :   LocVT = MVT::f64;
     638          48 :   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       23181 : static bool RetCC_Mips(unsigned ValNo, MVT ValVT,
     679             :                        MVT LocVT, CCValAssign::LocInfo LocInfo,
     680             :                        ISD::ArgFlagsTy ArgFlags, CCState &State) {
     681             : 
     682       23181 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_N32()) {
     683         373 :     if (!RetCC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     684             :       return false;
     685             :   }
     686             : 
     687       22939 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_N64()) {
     688        9252 :     if (!RetCC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
     689             :       return false;
     690             :   }
     691             : 
     692       17655 :   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        9625 : static bool RetCC_MipsN(unsigned ValNo, MVT ValVT,
     700             :                         MVT LocVT, CCValAssign::LocInfo LocInfo,
     701             :                         ISD::ArgFlagsTy ArgFlags, CCState &State) {
     702             : 
     703        9625 :   if (LocVT == MVT::i64) {
     704        4302 :     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        8465 :   if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     711        5246 :     if (LocVT == MVT::i8 ||
     712        5246 :         LocVT == MVT::i16 ||
     713        6779 :         LocVT == MVT::i32 ||
     714        1533 :         LocVT == MVT::i64) {
     715        2001 :       if (ArgFlags.isInReg()) {
     716          12 :         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          12 :                 LocInfo = CCValAssign::AExt;
     723             :       }
     724             :     }
     725             :   }
     726             : 
     727        8465 :   if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
     728       11684 :     if (LocVT == MVT::i8 ||
     729       11684 :         LocVT == MVT::i16 ||
     730       14501 :         LocVT == MVT::i32 ||
     731        2817 :         LocVT == MVT::i64) {
     732        5256 :       if (ArgFlags.isInReg()) {
     733          12 :         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          12 :                 LocInfo = CCValAssign::AExtUpper;
     740             :       }
     741             :     }
     742             :   }
     743             : 
     744        8465 :   if (LocVT == MVT::i64) {
     745             :     static const MCPhysReg RegList1[] = {
     746             :       Mips::V0_64, Mips::V1_64
     747             :     };
     748        3158 :     if (unsigned Reg = State.AllocateReg(RegList1)) {
     749        6316 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     750        3158 :       return false;
     751             :     }
     752             :   }
     753             : 
     754        5307 :   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        4601 :   if (LocVT == MVT::f64) {
     765             :     static const MCPhysReg RegList3[] = {
     766             :       Mips::D0_64, Mips::D2_64
     767             :     };
     768         502 :     if (unsigned Reg = State.AllocateReg(RegList3)) {
     769        1004 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     770         502 :       return false;
     771             :     }
     772             :   }
     773             : 
     774             :   return true;  // CC didn't match.
     775             : }
     776             : 
     777             : 
     778       17655 : static bool RetCC_MipsO32(unsigned ValNo, MVT ValVT,
     779             :                           MVT LocVT, CCValAssign::LocInfo LocInfo,
     780             :                           ISD::ArgFlagsTy ArgFlags, CCState &State) {
     781             : 
     782       35310 :   if (LocVT == MVT::i1 ||
     783       35310 :       LocVT == MVT::i8 ||
     784       17655 :       LocVT == MVT::i16) {
     785           0 :     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           0 :         LocInfo = CCValAssign::AExt;
     792             :   }
     793             : 
     794       17655 :   if (!static_cast<MipsCCState *>(&State)->WasOriginalRetVectorFloat(ValNo)) {
     795       17608 :     if (LocVT == MVT::i32) {
     796             :       static const MCPhysReg RegList1[] = {
     797             :         Mips::V0, Mips::V1, Mips::A0, Mips::A1
     798             :       };
     799       16223 :       if (unsigned Reg = State.AllocateReg(RegList1)) {
     800       32430 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     801       16215 :         return false;
     802             :       }
     803             :     }
     804             :   }
     805             : 
     806        1440 :   if (LocVT == MVT::f32) {
     807             :     static const MCPhysReg RegList2[] = {
     808             :       Mips::F0, Mips::F2
     809             :     };
     810         699 :     if (unsigned Reg = State.AllocateReg(RegList2)) {
     811        1398 :       State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     812         699 :       return false;
     813             :     }
     814             :   }
     815             : 
     816         741 :   if (LocVT == MVT::f64) {
     817         686 :     if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     818             :       static const MCPhysReg RegList3[] = {
     819             :         Mips::D0_64, Mips::D2_64
     820             :       };
     821         210 :       if (unsigned Reg = State.AllocateReg(RegList3)) {
     822         420 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     823         210 :         return false;
     824             :       }
     825             :     }
     826             :   }
     827             : 
     828         531 :   if (LocVT == MVT::f64) {
     829         476 :     if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
     830             :       static const MCPhysReg RegList4[] = {
     831             :         Mips::D0, Mips::D1
     832             :       };
     833         476 :       if (unsigned Reg = State.AllocateReg(RegList4)) {
     834         952 :         State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
     835         476 :         return false;
     836             :       }
     837             :     }
     838             :   }
     839             : 
     840             :   return true;  // CC didn't match.
     841             : }

Generated by: LCOV version 1.13