//===-- BasicBlockSectionsProfileReader.h - BB sections profile reader pass ==// // // 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 creates the basic block cluster info by reading the basic block // sections profile. The cluster info will be used by the basic-block-sections // pass to arrange basic blocks in their sections. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_BASICBLOCKSECTIONSPROFILEREADER_H #define LLVM_CODEGEN_BASICBLOCKSECTIONSPROFILEREADER_H #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/IR/Module.h" #include "llvm/IR/PassManager.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/Error.h" #include "llvm/Support/LineIterator.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Target/TargetMachine.h" namespace llvm { // This struct represents the cluster information for a machine basic block, // which is specifed by a unique ID (`MachineBasicBlock::BBID`). struct BBClusterInfo { … }; // This represents the raw input profile for one function. struct FunctionPathAndClusterInfo { … }; // Provides DenseMapInfo for UniqueBBID. template <> struct DenseMapInfo<UniqueBBID> { … }; class BasicBlockSectionsProfileReader { … }; // Creates a BasicBlockSectionsProfileReader pass to parse the basic block // sections profile. \p Buf is a memory buffer that contains the list of // functions and basic block ids to selectively enable basic block sections. ImmutablePass * createBasicBlockSectionsProfileReaderWrapperPass(const MemoryBuffer *Buf); /// Analysis pass providing the \c BasicBlockSectionsProfileReader. /// /// Note that this pass's result cannot be invalidated, it is immutable for the /// life of the module. class BasicBlockSectionsProfileReaderAnalysis : public AnalysisInfoMixin<BasicBlockSectionsProfileReaderAnalysis> { … }; class BasicBlockSectionsProfileReaderWrapperPass : public ImmutablePass { … }; } // namespace llvm #endif // LLVM_CODEGEN_BASICBLOCKSECTIONSPROFILEREADER_H