// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details1#pragma once23#include "Luau/Ast.h"4#include "Luau/DenseHash.h"56namespace Luau7{8namespace Compile9{1011struct Constant;1213// cost model: 8 bytes, where first byte is the baseline cost, and the next 7 bytes are discounts for when variable #i is constant14uint64_t modelCost(15AstNode* root,16AstLocal* const* vars,17size_t varCount,18const DenseHashMap<AstExprCall*, int>& builtins,19const DenseHashMap<AstExpr*, Constant>& constants20);21// when additional data is not available, used to test the cost model22uint64_t modelCost(AstNode* root, AstLocal* const* vars, size_t varCount);2324// cost is computed as B - sum(Di * Ci), where B is baseline cost, Di is the discount for each variable and Ci is 1 when variable #i is constant25int computeCost(uint64_t model, const bool* varsConst, size_t varCount);2627// get loop trip count or -1 if we can't compute it precisely28int getTripCount(double from, double to, double step);2930} // namespace Compile31} // namespace Luau323334