ReplayInlineAdvisor.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- ReplayInlineAdvisor.h - Replay Inline Advisor interface -*- C++ --*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. #ifndef LLVM_ANALYSIS_REPLAYINLINEADVISOR_H
  15. #define LLVM_ANALYSIS_REPLAYINLINEADVISOR_H
  16. #include "llvm/ADT/StringSet.h"
  17. #include "llvm/Analysis/InlineAdvisor.h"
  18. #include "llvm/IR/LLVMContext.h"
  19. namespace llvm {
  20. class BasicBlock;
  21. class CallBase;
  22. class Function;
  23. class Module;
  24. class OptimizationRemarkEmitter;
  25. /// Replay inline advisor that uses optimization remarks from inlining of
  26. /// previous build to guide current inlining. This is useful for inliner tuning.
  27. class ReplayInlineAdvisor : public InlineAdvisor {
  28. public:
  29. ReplayInlineAdvisor(Module &M, FunctionAnalysisManager &FAM,
  30. LLVMContext &Context,
  31. std::unique_ptr<InlineAdvisor> OriginalAdvisor,
  32. StringRef RemarksFile, bool EmitRemarks);
  33. std::unique_ptr<InlineAdvice> getAdviceImpl(CallBase &CB) override;
  34. bool areReplayRemarksLoaded() const { return HasReplayRemarks; }
  35. private:
  36. StringSet<> InlineSitesFromRemarks;
  37. std::unique_ptr<InlineAdvisor> OriginalAdvisor;
  38. bool HasReplayRemarks = false;
  39. bool EmitRemarks = false;
  40. };
  41. } // namespace llvm
  42. #endif // LLVM_ANALYSIS_REPLAYINLINEADVISOR_H
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif