| 2090 | } |
| 2091 | |
| 2092 | bool BfTypeInstance::GetLoweredType(BfTypeUsage typeUsage, BfTypeCode* outTypeCode, BfTypeCode* outTypeCode2) |
| 2093 | { |
| 2094 | if ((mTypeDef->mTypeCode != BfTypeCode_Struct) || (IsBoxed()) || (mIsSplattable)) |
| 2095 | return false; |
| 2096 | if (mHasUnderlyingArray) |
| 2097 | return false; |
| 2098 | |
| 2099 | bool deepCheck = false; |
| 2100 | |
| 2101 | if (mModule->mCompiler->mOptions.mMachineType == BfMachineType_Wasm32) |
| 2102 | { |
| 2103 | if (IsComposite()) |
| 2104 | { |
| 2105 | if (GetSplatCount(true) == 1) |
| 2106 | { |
| 2107 | BfType* componentType = NULL; |
| 2108 | BfTypeUtils::SplatIterate([&](BfType* checkType) { componentType = checkType; }, this); |
| 2109 | if (componentType != NULL) |
| 2110 | { |
| 2111 | if (componentType->IsPrimitiveType()) |
| 2112 | { |
| 2113 | auto primType = (BfPrimitiveType*)componentType; |
| 2114 | if (outTypeCode != NULL) |
| 2115 | *outTypeCode = primType->mTypeDef->mTypeCode; |
| 2116 | return true; |
| 2117 | } |
| 2118 | } |
| 2119 | } |
| 2120 | else |
| 2121 | return false; |
| 2122 | } |
| 2123 | } |
| 2124 | |
| 2125 | if (mModule->mCompiler->mOptions.mPlatformType == BfPlatformType_Windows) |
| 2126 | { |
| 2127 | // Odd Windows rule: composite returns for non-static methods are always sret |
| 2128 | if (typeUsage == BfTypeUsage_Return_NonStatic) |
| 2129 | return false; |
| 2130 | } |
| 2131 | else |
| 2132 | { |
| 2133 | // Non-Win64 systems allow lowered splitting of composites over multiple params |
| 2134 | if (mModule->mSystem->mPtrSize == 8) |
| 2135 | deepCheck = true; |
| 2136 | else |
| 2137 | { |
| 2138 | // We know this is correct for Linux x86 and Android armv7 |
| 2139 | if (mModule->mCompiler->mOptions.mPlatformType == BfPlatformType_Linux) |
| 2140 | { |
| 2141 | if ((typeUsage == BfTypeUsage_Return_NonStatic) || (typeUsage == BfTypeUsage_Return_Static)) |
| 2142 | return false; |
| 2143 | } |
| 2144 | } |
| 2145 | } |
| 2146 | |
| 2147 | int maxInstSize = 16; |
| 2148 | if (mModule->mCompiler->mOptions.mMachineType == BfMachineType_AArch64) |
| 2149 | maxInstSize = 32; |
no test coverage detected