luau/CodeGen/include/Luau/ConditionX64.h
vegorov-rbx d98256bb80
Sync to upstream/release/590 (#1008)
* Better indentation in multi-line type mismatch error messages
* Error message clone can no longer cause a stack overflow (when
typechecking with retainFullTypeGraphs set to false); fixes
https://github.com/Roblox/luau/issues/975
* `string.format` with %s is now ~2x faster on strings smaller than 100
characters

Native code generation:
* All VM side exits will block return to the native execution of the
current function to preserve correctness
* Fixed executable page allocation on Apple platforms when using
hardened runtime
* Added statistics for code generation (no. of functions compiler,
memory used for different areas)
* Fixed issue with function entry type checks performed more that once
in some functions
2023-08-11 07:42:37 -07:00

112 lines
2.7 KiB
C++

// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
#pragma once
#include "Luau/Common.h"
namespace Luau
{
namespace CodeGen
{
enum class ConditionX64 : uint8_t
{
Overflow,
NoOverflow,
Carry,
NoCarry,
Below,
BelowEqual,
Above,
AboveEqual,
Equal,
Less,
LessEqual,
Greater,
GreaterEqual,
NotBelow,
NotBelowEqual,
NotAbove,
NotAboveEqual,
NotEqual,
NotLess,
NotLessEqual,
NotGreater,
NotGreaterEqual,
Zero,
NotZero,
Parity,
NotParity,
Count
};
inline ConditionX64 getReverseCondition(ConditionX64 cond)
{
switch (cond)
{
case ConditionX64::Overflow:
return ConditionX64::NoOverflow;
case ConditionX64::NoOverflow:
return ConditionX64::Overflow;
case ConditionX64::Carry:
return ConditionX64::NoCarry;
case ConditionX64::NoCarry:
return ConditionX64::Carry;
case ConditionX64::Below:
return ConditionX64::NotBelow;
case ConditionX64::BelowEqual:
return ConditionX64::NotBelowEqual;
case ConditionX64::Above:
return ConditionX64::NotAbove;
case ConditionX64::AboveEqual:
return ConditionX64::NotAboveEqual;
case ConditionX64::Equal:
return ConditionX64::NotEqual;
case ConditionX64::Less:
return ConditionX64::NotLess;
case ConditionX64::LessEqual:
return ConditionX64::NotLessEqual;
case ConditionX64::Greater:
return ConditionX64::NotGreater;
case ConditionX64::GreaterEqual:
return ConditionX64::NotGreaterEqual;
case ConditionX64::NotBelow:
return ConditionX64::Below;
case ConditionX64::NotBelowEqual:
return ConditionX64::BelowEqual;
case ConditionX64::NotAbove:
return ConditionX64::Above;
case ConditionX64::NotAboveEqual:
return ConditionX64::AboveEqual;
case ConditionX64::NotEqual:
return ConditionX64::Equal;
case ConditionX64::NotLess:
return ConditionX64::Less;
case ConditionX64::NotLessEqual:
return ConditionX64::LessEqual;
case ConditionX64::NotGreater:
return ConditionX64::Greater;
case ConditionX64::NotGreaterEqual:
return ConditionX64::GreaterEqual;
case ConditionX64::Zero:
return ConditionX64::NotZero;
case ConditionX64::NotZero:
return ConditionX64::Zero;
case ConditionX64::Parity:
return ConditionX64::NotParity;
case ConditionX64::NotParity:
return ConditionX64::Parity;
case ConditionX64::Count:
LUAU_ASSERT(!"invalid ConditionX64 value");
}
return ConditionX64::Count;
}
} // namespace CodeGen
} // namespace Luau