/
redgpu
/
ispc
Обзор
Документация
Войти
/
redgpu
/
ispc
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk-artifacts
src/opt/IsCompileTimeConstant.h
37 строк
1 KB
Aleksei Nurmukhametov
Clean up ISPC pass defintions
02 май 2024, 21:16
02 май 2024, 21:16
2187a74
Код
Авторство
О чём код?
/* Copyright (c) 2022-2024, Intel Corporation SPDX-License-Identifier: BSD-3-Clause */ #pragma once #include "ISPCPass.h" namespace ispc { /** LLVM IR implementations of target-specific functions may include calls to the functions "bool __is_compile_time_constant_*(...)"; these allow them to have specialied code paths for where the corresponding value is known at compile time. For masks, for example, this allows them to not incur the cost of a MOVMSK call at runtime to compute its value in cases where the mask value isn't known until runtime. This pass resolves these calls into either 'true' or 'false' values so that later optimization passes can operate with these as constants. See stdlib.m4 for a number of uses of this idiom. */ struct IsCompileTimeConstantPass : public llvm::PassInfoMixin<IsCompileTimeConstantPass> { IsCompileTimeConstantPass(bool last = false) : isLastTry(last) {} llvm::PreservedAnalyses run(llvm::Function &F, llvm::FunctionAnalysisManager &FAM); private: bool isLastTry; bool lowerCompileTimeConstant(llvm::BasicBlock &BB); }; } // namespace ispc