226 const Type** outLeftType,
227 const Type** outRightType,
228 const Type** outResultType)
const {
230 switch (this->
kind()) {
235 *outLeftType = &
left;
236 *outRightType = &
left;
237 *outResultType = &
left;
242 if (
left.isVoid() ||
left.isOpaque()) {
247 if (rightToLeft < leftToRight) {
249 *outLeftType = &
left;
250 *outRightType = &
left;
255 if (leftToRight.isPossible(allowNarrowing)) {
256 *outLeftType = &
right;
257 *outRightType = &
right;
264 case Kind::LOGICALOR:
265 case Kind::LOGICALAND:
266 case Kind::LOGICALXOR:
273 case Operator::Kind::COMMA:
274 if (
left.isOpaque() ||
right.isOpaque()) {
277 *outLeftType = &
left;
278 *outRightType = &
right;
279 *outResultType = &
right;
288 const Type& leftComponentType =
left.componentType();
289 const Type& rightComponentType =
right.componentType();
295 if (this->isMatrixMultiply(
left,
right)) {
298 outLeftType, outRightType, outResultType)) {
305 int rightColumns =
right.columns(), rightRows =
right.rows();
306 if (
right.isVector()) {
308 std::swap(rightColumns, rightRows);
311 if (rightColumns > 1) {
312 *outResultType = &(*outResultType)->
toCompound(context, rightColumns, leftRows);
315 *outResultType = &(*outResultType)->
toCompound(context, leftRows, rightColumns);
317 if (
isAssignment && ((*outResultType)->columns() != leftColumns ||
318 (*outResultType)->rows() != leftRows)) {
321 return leftColumns == rightRows;
327 if (leftIsVectorOrMatrix && validMatrixOrVectorOp &&
right.isScalar()) {
330 outLeftType, outRightType, outResultType)) {
343 if (!
isAssignment && rightIsVectorOrMatrix && validMatrixOrVectorOp &&
left.isScalar()) {
346 outLeftType, outRightType, outResultType)) {
361 if ((
left.isScalar() &&
right.isScalar()) || (leftIsVectorOrMatrix && validMatrixOrVectorOp)) {
367 if (rightToLeftCost.
isPossible(allowNarrowing) && rightToLeftCost < leftToRightCost) {
369 *outLeftType = &
left;
370 *outRightType = &
left;
371 *outResultType = &
left;
372 }
else if (leftToRightCost.
isPossible(allowNarrowing)) {
374 *outLeftType = &
right;
375 *outRightType = &
right;
376 *outResultType = &
right;
const BuiltinTypes & fTypes
bool determineBinaryType(const Context &context, const Type &left, const Type &right, const Type **outLeftType, const Type **outRightType, const Type **outResultType) const