tint/utils: Add TINT_LIKELY / TINT_UNLIKELY macros

Emits branch prediction hints.
Give unlikely hints about where we call TINT_ICE.

Change-Id: Ied5bc3d7c8b3a838e96e5a0a64156048f90411c6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116875
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2023-01-12 22:52:57 +00:00
committed by Dawn LUCI CQ
parent 2915fadce4
commit 884f95258d
36 changed files with 321 additions and 282 deletions

View File

@@ -1097,7 +1097,8 @@ struct DirectVariableAccess::State {
continue;
}
if (auto* member = std::get_if<Symbol>(&op)) {
auto* member = std::get_if<Symbol>(&op);
if (TINT_LIKELY(member)) {
ss << sym.NameFor(*member);
continue;
}
@@ -1145,7 +1146,8 @@ struct DirectVariableAccess::State {
return b.IndexAccessor(expr, idx);
}
if (auto* member = std::get_if<Symbol>(&access)) {
auto* member = std::get_if<Symbol>(&access);
if (TINT_LIKELY(member)) {
/// The access is a member access.
return b.MemberAccessor(expr, ctx.Clone(*member));
}