[mips] Move SpecialCallingConv to MipsCCState and use it from tablegen-erated code...
[oota-llvm.git] / lib / Target / Mips / MipsCallingConv.td
index 7e5c2a902f13f2462c3a375ddec7e8dfb6209fb7..cfa1a4ccf86f6b635b40616b7094dbbbc56f8b94 100644 (file)
@@ -295,7 +295,20 @@ def CC_Mips_ByVal : CallingConv<[
   CCIfByVal<CCPassByVal<8, 8>>
 ]>;
 
+def CC_Mips16RetHelper : CallingConv<[
+  CCIfByVal<CCDelegateTo<CC_Mips_ByVal>>,
+
+  // Integer arguments are passed in integer registers.
+  CCIfType<[i32], CCAssignToReg<[V0, V1, A0, A1]>>
+]>;
+
 def CC_Mips_FixedArg : CallingConv<[
+  // Mips16 needs special handling on some functions.
+  CCIf<"State.getCallingConv() != CallingConv::Fast",
+      CCIf<"static_cast<MipsCCState *>(&State)->getSpecialCallingConv() == "
+               "MipsCCState::Mips16RetHelperConv",
+           CCDelegateTo<CC_Mips16RetHelper>>>,
+
   CCIfByVal<CCDelegateTo<CC_Mips_ByVal>>,
 
   // f128 needs to be handled similarly to f32 and f64 on hard-float. However,
@@ -330,15 +343,6 @@ def CC_Mips_VarArg : CallingConv<[
   CCDelegateTo<CC_MipsN_VarArg>
 ]>;
 
-//==
-
-def CC_Mips16RetHelper : CallingConv<[
-  CCIfByVal<CCDelegateTo<CC_Mips_ByVal>>,
-
-  // Integer arguments are passed in integer registers.
-  CCIfType<[i32], CCAssignToReg<[V0, V1, A0, A1]>>
-]>;
-
 //===----------------------------------------------------------------------===//
 // Callee-saved register lists.
 //===----------------------------------------------------------------------===//