//===- InstructionCost.h ----------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// \file /// This file defines an InstructionCost class that is used when calculating /// the cost of an instruction, or a group of instructions. In addition to a /// numeric value representing the cost the class also contains a state that /// can be used to encode particular properties, such as a cost being invalid. /// Operations on InstructionCost implement saturation arithmetic, so that /// accumulating costs on large cost-values don't overflow. /// //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_INSTRUCTIONCOST_H #define LLVM_SUPPORT_INSTRUCTIONCOST_H #include "llvm/Support/MathExtras.h" #include <limits> #include <optional> namespace llvm { class raw_ostream; class InstructionCost { … }; inline InstructionCost operator+(const InstructionCost &LHS, const InstructionCost &RHS) { … } inline InstructionCost operator-(const InstructionCost &LHS, const InstructionCost &RHS) { … } inline InstructionCost operator*(const InstructionCost &LHS, const InstructionCost &RHS) { … } inline InstructionCost operator/(const InstructionCost &LHS, const InstructionCost &RHS) { … } inline raw_ostream &operator<<(raw_ostream &OS, const InstructionCost &V) { … } } // namespace llvm #endif