Index: lib/Target/Mips/MipsCallingConv.td =================================================================== --- lib/Target/Mips/MipsCallingConv.td +++ lib/Target/Mips/MipsCallingConv.td @@ -20,6 +20,29 @@ // The inverse of CCIfSubtarget class CCIfSubtargetNot : CCIfSubtarget; +/// Match if the original argument (before lowering) was a float. +/// For example, this is true for i32's that were lowered from soft-float. +class CCIfOrigArgWasNotFloat + : CCIf<"!static_cast(&State)->WasOriginalArgFloat(ValNo)", + A>; + +/// Match if the original argument (before lowering) was a 128-bit float (i.e. +/// long double). +class CCIfOrigArgWasF128 + : CCIf<"static_cast(&State)->WasOriginalArgF128(ValNo)", A>; + +/// Match if this specific argument is a vararg. +/// This is slightly different fro CCIfIsVarArg which matches if any argument is +/// a vararg. +class CCIfArgIsVarArg + : CCIf<"!static_cast(&State)->IsCallOperandFixed(ValNo)", A>; + + +/// Match if the special calling conv is the specified value. +class CCIfSpecialCallingConv + : CCIf<"static_cast(&State)->getSpecialCallingConv() == " + "MipsCCState::" # CC, A>; + // For soft-float, f128 values are returned in A0_64 rather than V1_64. def RetCC_F128SoftFloat : CallingConv<[ CCAssignToReg<[V0_64, A0_64]> @@ -92,9 +115,7 @@ CCIfInReg>>>, // All integers (except soft-float integers) are promoted to 64-bit. - CCIfType<[i8, i16, i32], - CCIf<"!static_cast(&State)->WasOriginalArgFloat(ValNo)", - CCPromoteToType>>, + CCIfType<[i8, i16, i32], CCIfOrigArgWasNotFloat>>, // The only i32's we have left are soft-float arguments. CCIfSubtarget<"abiUsesSoftFloat()", CCIfType<[i32], CCDelegateTo>>, @@ -149,9 +170,7 @@ // // f128 should only occur for the N64 ABI where long double is 128-bit. On // N32, long double is equivalent to double. - CCIfType<[i64], - CCIf<"static_cast(&State)->WasOriginalArgF128(ValNo)", - CCDelegateTo>>, + CCIfType<[i64], CCIfOrigArgWasF128>>, // Aggregate returns are positioned at the lowest address in the slot for // both little and big-endian targets. When passing in registers, this @@ -317,8 +336,7 @@ def CC_Mips_FixedArg : CallingConv<[ // Mips16 needs special handling on some functions. CCIf<"State.getCallingConv() != CallingConv::Fast", - CCIf<"static_cast(&State)->getSpecialCallingConv() == " - "MipsCCState::Mips16RetHelperConv", + CCIfSpecialCallingConv<"Mips16RetHelperConv", CCDelegateTo>>, CCIfByVal>, @@ -335,8 +353,7 @@ // N32, long double is equivalent to double. CCIfType<[i64], CCIfSubtargetNot<"abiUsesSoftFloat()", - CCIf<"static_cast(&State)->WasOriginalArgF128(ValNo)", - CCBitConvertToType>>>, + CCIfOrigArgWasF128>>>, CCIfCC<"CallingConv::Fast", CCDelegateTo>, @@ -356,9 +373,7 @@ ]>; def CC_Mips : CallingConv<[ - CCIfVarArg< - CCIf<"!static_cast(&State)->IsCallOperandFixed(ValNo)", - CCDelegateTo>>, + CCIfVarArg>>, CCDelegateTo ]>;