1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_ANALYSIS_ANALYSISOPTIONS_H
10#define LLVM_LIB_ANALYSIS_ANALYSISOPTIONS_H
11
12#include "llvm/IR/Function.h"
13#include "llvm/IR/LLVMContext.h"
14#include <cstdint>
15#include <optional>
16
17namespace llvm {
18
19namespace dxbc::SourceInfo::Contents {
20enum class CompressionType : uint16_t;
21} // namespace dxbc::SourceInfo::Contents
22
23// Forward-declared so that Analysis headers can include this one. Fields of
24// these types default to the zero enumerator.
25enum class GVDAGType;
26enum class IR2VecKind;
27enum class InlinerFunctionImportStatsOpts;
28enum class PGOViewCountsType;
29
30enum class OutputCostKind {
31 RecipThroughput,
32 Latency,
33 CodeSize,
34 SizeAndLatency,
35 All,
36};
37
38enum class IntrinsicCostStrategy {
39 InstructionCost,
40 IntrinsicCost,
41 TypeBasedIntrinsicCost,
42};
43
44enum class CtxProfPrintMode { Everything, YAML };
45
46// Types of dependence test routines.
47enum class DependenceTestType {
48 Default, // All tests except BanerjeeMIV
49 All,
50 StrongSIV,
51 WeakCrossingSIV,
52 ExactSIV,
53 WeakZeroSIV,
54 ExactRDIV,
55 GCDMIV,
56 BanerjeeMIV,
57};
58
59enum class ForceSummaryHotness { None, AllNonCritical, All };
60
61enum class InlinePriorityMode : int { Size, Cost, CostBenefit, ML };
62
63enum class StencilMergePolicy { Off, Auto, Force };
64
65enum class SkipMLPolicyCriteria { Never, IfCallerIsNotCold };
66
67} // namespace llvm
68
69#define OPTIONS_STRUCT_DECL
70#include "AnalysisOptions.inc"
71
72namespace llvm {
73
74class Loop;
75class Module;
76
77inline const AnalysisOptions &getAnalysisOptions(const LLVMContext &C) {
78 return C.getLibraryOptions().get<AnalysisOptions>();
79}
80
81inline const AnalysisOptions &getAnalysisOptions(const Function &F) {
82 return getAnalysisOptions(C: F.getContext());
83}
84
85const AnalysisOptions &getAnalysisOptions(const Module &M);
86const AnalysisOptions &getAnalysisOptions(const Loop &L);
87
88} // namespace llvm
89
90#endif // LLVM_LIB_ANALYSIS_ANALYSISOPTIONS_H
91