//===- llvm/Analysis/DemandedBits.h - Determine demanded bits ---*- 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 // //===----------------------------------------------------------------------===// // // This pass implements a demanded bits analysis. A demanded bit is one that // contributes to a result; bits that are not demanded can be either zero or // one without affecting control or data flow. For example in this sequence: // // %1 = add i32 %x, %y // %2 = trunc i32 %1 to i16 // // Only the lowest 16 bits of %1 are demanded; the rest are removed by the // trunc. // //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_DEMANDEDBITS_H #define LLVM_ANALYSIS_DEMANDEDBITS_H #include "llvm/ADT/APInt.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/PassManager.h" namespace llvm { class AssumptionCache; class DominatorTree; class Function; class Instruction; struct KnownBits; class raw_ostream; class Use; class Value; class DemandedBits { … }; /// An analysis that produces \c DemandedBits for a function. class DemandedBitsAnalysis : public AnalysisInfoMixin<DemandedBitsAnalysis> { … }; /// Printer pass for DemandedBits class DemandedBitsPrinterPass : public PassInfoMixin<DemandedBitsPrinterPass> { … }; } // end namespace llvm #endif // LLVM_ANALYSIS_DEMANDEDBITS_H