Coverage Report

Created: 2018-12-11 00:00

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h
Line
Count
Source
1
//===--- CodeGenOptions.h ---------------------------------------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
//  This file defines the CodeGenOptions interface.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H
15
#define LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H
16
17
#include "clang/Basic/DebugInfoOptions.h"
18
#include "clang/Basic/Sanitizers.h"
19
#include "clang/Basic/XRayInstr.h"
20
#include "llvm/Support/CodeGen.h"
21
#include "llvm/Support/Regex.h"
22
#include "llvm/Target/TargetOptions.h"
23
#include <map>
24
#include <memory>
25
#include <string>
26
#include <vector>
27
28
namespace clang {
29
30
/// Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure
31
/// that this large collection of bitfields is a trivial class type.
32
class CodeGenOptionsBase {
33
public:
34
#define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits;
35
#define ENUM_CODEGENOPT(Name, Type, Bits, Default)
36
#include "clang/Frontend/CodeGenOptions.def"
37
38
protected:
39
#define CODEGENOPT(Name, Bits, Default)
40
#define ENUM_CODEGENOPT(Name, Type, Bits, Default) unsigned Name : Bits;
41
#include "clang/Frontend/CodeGenOptions.def"
42
};
43
44
/// CodeGenOptions - Track various options which control how the code
45
/// is optimized and passed to the backend.
46
class CodeGenOptions : public CodeGenOptionsBase {
47
public:
48
  enum InliningMethod {
49
    NormalInlining,     // Use the standard function inlining pass.
50
    OnlyHintInlining,   // Inline only (implicitly) hinted functions.
51
    OnlyAlwaysInlining  // Only run the always inlining pass.
52
  };
53
54
  enum VectorLibrary {
55
    NoLibrary,  // Don't use any vector library.
56
    Accelerate, // Use the Accelerate framework.
57
    SVML        // Intel short vector math library.
58
  };
59
60
61
  enum ObjCDispatchMethodKind {
62
    Legacy = 0,
63
    NonLegacy = 1,
64
    Mixed = 2
65
  };
66
67
  enum TLSModel {
68
    GeneralDynamicTLSModel,
69
    LocalDynamicTLSModel,
70
    InitialExecTLSModel,
71
    LocalExecTLSModel
72
  };
73
74
  enum DwarfFissionKind { NoFission, SplitFileFission, SingleFileFission };
75
76
  /// Clang versions with different platform ABI conformance.
77
  enum class ClangABI {
78
    /// Attempt to be ABI-compatible with code generated by Clang 3.8.x
79
    /// (SVN r257626). This causes <1 x long long> to be passed in an
80
    /// integer register instead of an SSE register on x64_64.
81
    Ver3_8,
82
83
    /// Attempt to be ABI-compatible with code generated by Clang 4.0.x
84
    /// (SVN r291814). This causes move operations to be ignored when
85
    /// determining whether a class type can be passed or returned directly.
86
    Ver4,
87
88
    /// Conform to the underlying platform's C and C++ ABIs as closely
89
    /// as we can.
90
    Latest
91
  };
92
93
  enum StructReturnConventionKind {
94
    SRCK_Default,  // No special option was passed.
95
    SRCK_OnStack,  // Small structs on the stack (-fpcc-struct-return).
96
    SRCK_InRegs    // Small structs in registers (-freg-struct-return).
97
  };
98
99
  enum ProfileInstrKind {
100
    ProfileNone,       // Profile instrumentation is turned off.
101
    ProfileClangInstr, // Clang instrumentation to generate execution counts
102
                       // to use with PGO.
103
    ProfileIRInstr,    // IR level PGO instrumentation in LLVM.
104
  };
105
106
  enum EmbedBitcodeKind {
107
    Embed_Off,      // No embedded bitcode.
108
    Embed_All,      // Embed both bitcode and commandline in the output.
109
    Embed_Bitcode,  // Embed just the bitcode in the output.
110
    Embed_Marker    // Embed a marker as a placeholder for bitcode.
111
  };
112
113
  enum SignReturnAddressScope {
114
    None,    // No signing for any function
115
    NonLeaf, // Sign the return address of functions that spill LR
116
    All      // Sign the return address of all functions
117
  };
118
119
  enum SignReturnAddressKeyValue { AKey, BKey };
120
121
  /// The code model to use (-mcmodel).
122
  std::string CodeModel;
123
124
  /// The filename with path we use for coverage data files. The runtime
125
  /// allows further manipulation with the GCOV_PREFIX and GCOV_PREFIX_STRIP
126
  /// environment variables.
127
  std::string CoverageDataFile;
128
129
  /// The filename with path we use for coverage notes files.
130
  std::string CoverageNotesFile;
131
132
  /// Regexes separated by a semi-colon to filter the files to instrument.
133
  std::string ProfileFilterFiles;
134
135
  /// Regexes separated by a semi-colon to filter the files to not instrument.
136
  std::string ProfileExcludeFiles;
137
138
  /// The version string to put into coverage files.
139
  char CoverageVersion[4];
140
141
  /// Enable additional debugging information.
142
  std::string DebugPass;
143
144
  /// The string to embed in debug information as the current working directory.
145
  std::string DebugCompilationDir;
146
147
  /// The string to embed in the debug information for the compile unit, if
148
  /// non-empty.
149
  std::string DwarfDebugFlags;
150
151
  std::map<std::string, std::string> DebugPrefixMap;
152
153
  /// The ABI to use for passing floating point arguments.
154
  std::string FloatABI;
155
156
  /// The floating-point denormal mode to use.
157
  std::string FPDenormalMode;
158
159
  /// The float precision limit to use, if non-empty.
160
  std::string LimitFloatPrecision;
161
162
  struct BitcodeFileToLink {
163
    /// The filename of the bitcode file to link in.
164
    std::string Filename;
165
    /// If true, we set attributes functions in the bitcode library according to
166
    /// our CodeGenOptions, much as we set attrs on functions that we generate
167
    /// ourselves.
168
    bool PropagateAttrs = false;
169
    /// If true, we use LLVM module internalizer.
170
    bool Internalize = false;
171
    /// Bitwise combination of llvm::Linker::Flags, passed to the LLVM linker.
172
    unsigned LinkFlags = 0;
173
  };
174
175
  /// The files specified here are linked in to the module before optimizations.
176
  std::vector<BitcodeFileToLink> LinkBitcodeFiles;
177
178
  /// The user provided name for the "main file", if non-empty. This is useful
179
  /// in situations where the input file name does not match the original input
180
  /// file, for example with -save-temps.
181
  std::string MainFileName;
182
183
  /// The name for the split debug info file that we'll break out. This is used
184
  /// in the backend for setting the name in the skeleton cu.
185
  std::string SplitDwarfFile;
186
187
  /// The name of the relocation model to use.
188
  llvm::Reloc::Model RelocationModel;
189
190
  /// The thread model to use
191
  std::string ThreadModel;
192
193
  /// If not an empty string, trap intrinsics are lowered to calls to this
194
  /// function instead of to trap instructions.
195
  std::string TrapFuncName;
196
197
  /// A list of dependent libraries.
198
  std::vector<std::string> DependentLibraries;
199
200
  /// A list of linker options to embed in the object file.
201
  std::vector<std::string> LinkerOptions;
202
203
  /// Name of the profile file to use as output for -fprofile-instr-generate
204
  /// and -fprofile-generate.
205
  std::string InstrProfileOutput;
206
207
  /// Name of the profile file to use with -fprofile-sample-use.
208
  std::string SampleProfileFile;
209
210
  /// Name of the profile file to use as input for -fprofile-instr-use
211
  std::string ProfileInstrumentUsePath;
212
213
  /// Name of the profile remapping file to apply to the profile data supplied
214
  /// by -fprofile-sample-use or -fprofile-instr-use.
215
  std::string ProfileRemappingFile;
216
217
  /// Name of the function summary index file to use for ThinLTO function
218
  /// importing.
219
  std::string ThinLTOIndexFile;
220
221
  /// Name of a file that can optionally be written with minimized bitcode
222
  /// to be used as input for the ThinLTO thin link step, which only needs
223
  /// the summary and module symbol table (and not, e.g. any debug metadata).
224
  std::string ThinLinkBitcodeFile;
225
226
  /// Prefix to use for -save-temps output.
227
  std::string SaveTempsFilePrefix;
228
229
  /// Name of file passed with -fcuda-include-gpubinary option to forward to
230
  /// CUDA runtime back-end for incorporating them into host-side object file.
231
  std::string CudaGpuBinaryFileName;
232
233
  /// The name of the file to which the backend should save YAML optimization
234
  /// records.
235
  std::string OptRecordFile;
236
237
  /// Regular expression to select optimizations for which we should enable
238
  /// optimization remarks. Transformation passes whose name matches this
239
  /// expression (and support this feature), will emit a diagnostic
240
  /// whenever they perform a transformation. This is enabled by the
241
  /// -Rpass=regexp flag.
242
  std::shared_ptr<llvm::Regex> OptimizationRemarkPattern;
243
244
  /// Regular expression to select optimizations for which we should enable
245
  /// missed optimization remarks. Transformation passes whose name matches this
246
  /// expression (and support this feature), will emit a diagnostic
247
  /// whenever they tried but failed to perform a transformation. This is
248
  /// enabled by the -Rpass-missed=regexp flag.
249
  std::shared_ptr<llvm::Regex> OptimizationRemarkMissedPattern;
250
251
  /// Regular expression to select optimizations for which we should enable
252
  /// optimization analyses. Transformation passes whose name matches this
253
  /// expression (and support this feature), will emit a diagnostic
254
  /// whenever they want to explain why they decided to apply or not apply
255
  /// a given transformation. This is enabled by the -Rpass-analysis=regexp
256
  /// flag.
257
  std::shared_ptr<llvm::Regex> OptimizationRemarkAnalysisPattern;
258
259
  /// Set of files defining the rules for the symbol rewriting.
260
  std::vector<std::string> RewriteMapFiles;
261
262
  /// Set of sanitizer checks that are non-fatal (i.e. execution should be
263
  /// continued when possible).
264
  SanitizerSet SanitizeRecover;
265
266
  /// Set of sanitizer checks that trap rather than diagnose.
267
  SanitizerSet SanitizeTrap;
268
269
  /// List of backend command-line options for -fembed-bitcode.
270
  std::vector<uint8_t> CmdArgs;
271
272
  /// A list of all -fno-builtin-* function names (e.g., memset).
273
  std::vector<std::string> NoBuiltinFuncs;
274
275
  std::vector<std::string> Reciprocals;
276
277
  /// The preferred width for auto-vectorization transforms. This is intended to
278
  /// override default transforms based on the width of the architected vector
279
  /// registers.
280
  std::string PreferVectorWidth;
281
282
  /// Set of XRay instrumentation kinds to emit.
283
  XRayInstrSet XRayInstrumentationBundle;
284
285
public:
286
  // Define accessors/mutators for code generation options of enumeration type.
287
#define CODEGENOPT(Name, Bits, Default)
288
#define ENUM_CODEGENOPT(Name, Type, Bits, Default) \
289
2.84M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getCompressDebugSections() const
Line
Count
Source
289
20.6k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getDebuggerTuning() const
Line
Count
Source
289
20.8k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getSplitDwarfMode() const
Line
Count
Source
289
23.5k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getProfileInstr() const
Line
Count
Source
289
1.16M
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getProfileUse() const
Line
Count
Source
289
78.8k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getVecLib() const
Line
Count
Source
289
32.5k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getDebugInfo() const
Line
Count
Source
289
628k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getEmbedBitcode() const
Line
Count
Source
289
62.2k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getSignReturnAddress() const
Line
Count
Source
289
361k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getSignReturnAddressKey() const
Line
Count
Source
289
78
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getObjCDispatchMethod() const
Line
Count
Source
289
1.24k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getDefaultTLSModel() const
Line
Count
Source
289
310
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getInlining() const
Line
Count
Source
289
446k
  Type get##Name() const { return static_cast<Type>(Name); } \
clang::CodeGenOptions::getStructReturnConvention() const
Line
Count
Source
289
2.67k
  Type get##Name() const { return static_cast<Type>(Name); } \
290
770k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setCompressDebugSections(llvm::DebugCompressionType)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setEmbedBitcode(clang::CodeGenOptions::EmbedBitcodeKind)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setObjCDispatchMethod(clang::CodeGenOptions::ObjCDispatchMethodKind)
Line
Count
Source
290
50.9k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setProfileInstr(clang::CodeGenOptions::ProfileInstrKind)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setProfileUse(clang::CodeGenOptions::ProfileInstrKind)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setStructReturnConvention(clang::CodeGenOptions::StructReturnConventionKind)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setSplitDwarfMode(clang::CodeGenOptions::DwarfFissionKind)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setDebugInfo(clang::codegenoptions::DebugInfoKind)
Line
Count
Source
290
53.2k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setDebuggerTuning(llvm::DebuggerKind)
Line
Count
Source
290
70.1k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setInlining(clang::CodeGenOptions::InliningMethod)
Line
Count
Source
290
91.9k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setVecLib(clang::CodeGenOptions::VectorLibrary)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setDefaultTLSModel(clang::CodeGenOptions::TLSModel)
Line
Count
Source
290
50.6k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setSignReturnAddress(clang::CodeGenOptions::SignReturnAddressScope)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
clang::CodeGenOptions::setSignReturnAddressKey(clang::CodeGenOptions::SignReturnAddressKeyValue)
Line
Count
Source
290
50.4k
  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
291
#include "clang/Frontend/CodeGenOptions.def"
292
293
  CodeGenOptions();
294
295
  /// Is this a libc/libm function that is no longer recognized as a
296
  /// builtin because a -fno-builtin-* option has been specified?
297
  bool isNoBuiltinFunc(const char *Name) const;
298
299
24.0k
  const std::vector<std::string> &getNoBuiltinFuncs() const {
300
24.0k
    return NoBuiltinFuncs;
301
24.0k
  }
302
303
  /// Check if Clang profile instrumenation is on.
304
1.14M
  bool hasProfileClangInstr() const {
305
1.14M
    return getProfileInstr() == ProfileClangInstr;
306
1.14M
  }
307
308
  /// Check if IR level profile instrumentation is on.
309
20.5k
  bool hasProfileIRInstr() const {
310
20.5k
    return getProfileInstr() == ProfileIRInstr;
311
20.5k
  }
312
313
  /// Check if Clang profile use is on.
314
16.8k
  bool hasProfileClangUse() const {
315
16.8k
    return getProfileUse() == ProfileClangInstr;
316
16.8k
  }
317
318
  /// Check if IR level profile use is on.
319
20.5k
  bool hasProfileIRUse() const {
320
20.5k
    return getProfileUse() == ProfileIRInstr;
321
20.5k
  }
322
323
};
324
325
}  // end namespace clang
326
327
#endif