clang  3.8.0
CodeGenOptions.h
Go to the documentation of this file.
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/Sanitizers.h"
18 #include "llvm/Support/Regex.h"
19 #include <map>
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 namespace clang {
25 
26 /// \brief Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure
27 /// that this large collection of bitfields is a trivial class type.
29 public:
30 #define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits;
31 #define ENUM_CODEGENOPT(Name, Type, Bits, Default)
32 #include "clang/Frontend/CodeGenOptions.def"
33 
34 protected:
35 #define CODEGENOPT(Name, Bits, Default)
36 #define ENUM_CODEGENOPT(Name, Type, Bits, Default) unsigned Name : Bits;
37 #include "clang/Frontend/CodeGenOptions.def"
38 };
39 
40 /// CodeGenOptions - Track various options which control how the code
41 /// is optimized and passed to the backend.
43 public:
45  NoInlining, // Perform no inlining whatsoever.
46  NormalInlining, // Use the standard function inlining pass.
47  OnlyAlwaysInlining // Only run the always inlining pass.
48  };
49 
51  NoLibrary, // Don't use any vector library.
52  Accelerate // Use the Accelerate framework.
53  };
54 
56  Legacy = 0,
57  NonLegacy = 1,
58  Mixed = 2
59  };
60 
62  NoDebugInfo, /// Don't generate debug info.
63 
64  LocTrackingOnly, /// Emit location information but do not generate
65  /// debug info in the output. This is useful in
66  /// cases where the backend wants to track source
67  /// locations for instructions without actually
68  /// emitting debug info for them (e.g., when -Rpass
69  /// is used).
70 
71  DebugLineTablesOnly, /// Emit only debug info necessary for generating
72  /// line number tables (-gline-tables-only).
73 
74  LimitedDebugInfo, /// Limit generated debug info to reduce size
75  /// (-fno-standalone-debug). This emits
76  /// forward decls for types that could be
77  /// replaced with forward decls in the source
78  /// code. For dynamic C++ classes type info
79  /// is only emitted int the module that
80  /// contains the classe's vtable.
81 
82  FullDebugInfo /// Generate complete debug info.
83  };
84 
85  enum DebuggerKind {
90  };
91 
92  enum TLSModel {
97  };
98 
100  FPC_Off, // Form fused FP ops only where result will not be affected.
101  FPC_On, // Form fused FP ops according to FP_CONTRACT rules.
102  FPC_Fast // Aggressively fuse FP ops (E.g. FMA).
103  };
104 
106  SRCK_Default, // No special option was passed.
107  SRCK_OnStack, // Small structs on the stack (-fpcc-struct-return).
108  SRCK_InRegs // Small structs in registers (-freg-struct-return).
109  };
110 
111  /// The code model to use (-mcmodel).
112  std::string CodeModel;
113 
114  /// The filename with path we use for coverage files. The extension will be
115  /// replaced.
116  std::string CoverageFile;
117 
118  /// The version string to put into coverage files.
120 
121  /// Enable additional debugging information.
122  std::string DebugPass;
123 
124  /// The string to embed in debug information as the current working directory.
125  std::string DebugCompilationDir;
126 
127  /// The string to embed in the debug information for the compile unit, if
128  /// non-empty.
129  std::string DwarfDebugFlags;
130 
131  std::map<std::string, std::string> DebugPrefixMap;
132 
133  /// The ABI to use for passing floating point arguments.
134  std::string FloatABI;
135 
136  /// The float precision limit to use, if non-empty.
137  std::string LimitFloatPrecision;
138 
139  /// The name of the bitcode file to link before optzns.
140  std::vector<std::pair<unsigned, std::string>> LinkBitcodeFiles;
141 
142  /// The user provided name for the "main file", if non-empty. This is useful
143  /// in situations where the input file name does not match the original input
144  /// file, for example with -save-temps.
145  std::string MainFileName;
146 
147  /// The name for the split debug info file that we'll break out. This is used
148  /// in the backend for setting the name in the skeleton cu.
149  std::string SplitDwarfFile;
150 
151  /// The name of the relocation model to use.
152  std::string RelocationModel;
153 
154  /// The thread model to use
155  std::string ThreadModel;
156 
157  /// If not an empty string, trap intrinsics are lowered to calls to this
158  /// function instead of to trap instructions.
159  std::string TrapFuncName;
160 
161  /// A list of command-line options to forward to the LLVM backend.
162  std::vector<std::string> BackendOptions;
163 
164  /// A list of dependent libraries.
165  std::vector<std::string> DependentLibraries;
166 
167  /// Name of the profile file to use as output for -fprofile-instr-generate
168  /// and -fprofile-generate.
169  std::string InstrProfileOutput;
170 
171  /// Name of the profile file to use with -fprofile-sample-use.
172  std::string SampleProfileFile;
173 
174  /// Name of the profile file to use as input for -fprofile-instr-use
175  std::string InstrProfileInput;
176 
177  /// Name of the function summary index file to use for ThinLTO function
178  /// importing.
179  std::string ThinLTOIndexFile;
180 
181  /// The EABI version to use
182  std::string EABIVersion;
183 
184  /// A list of file names passed with -fcuda-include-gpubinary options to
185  /// forward to CUDA runtime back-end for incorporating them into host-side
186  /// object file.
187  std::vector<std::string> CudaGpuBinaryFileNames;
188 
189  /// Regular expression to select optimizations for which we should enable
190  /// optimization remarks. Transformation passes whose name matches this
191  /// expression (and support this feature), will emit a diagnostic
192  /// whenever they perform a transformation. This is enabled by the
193  /// -Rpass=regexp flag.
194  std::shared_ptr<llvm::Regex> OptimizationRemarkPattern;
195 
196  /// Regular expression to select optimizations for which we should enable
197  /// missed optimization remarks. Transformation passes whose name matches this
198  /// expression (and support this feature), will emit a diagnostic
199  /// whenever they tried but failed to perform a transformation. This is
200  /// enabled by the -Rpass-missed=regexp flag.
201  std::shared_ptr<llvm::Regex> OptimizationRemarkMissedPattern;
202 
203  /// Regular expression to select optimizations for which we should enable
204  /// optimization analyses. Transformation passes whose name matches this
205  /// expression (and support this feature), will emit a diagnostic
206  /// whenever they want to explain why they decided to apply or not apply
207  /// a given transformation. This is enabled by the -Rpass-analysis=regexp
208  /// flag.
209  std::shared_ptr<llvm::Regex> OptimizationRemarkAnalysisPattern;
210 
211  /// Set of files definining the rules for the symbol rewriting.
212  std::vector<std::string> RewriteMapFiles;
213 
214  /// Set of sanitizer checks that are non-fatal (i.e. execution should be
215  /// continued when possible).
217 
218  /// Set of sanitizer checks that trap rather than diagnose.
220 
221  /// \brief A list of all -fno-builtin-* function names (e.g., memset).
222  std::vector<std::string> NoBuiltinFuncs;
223 
224 public:
225  // Define accessors/mutators for code generation options of enumeration type.
226 #define CODEGENOPT(Name, Bits, Default)
227 #define ENUM_CODEGENOPT(Name, Type, Bits, Default) \
228  Type get##Name() const { return static_cast<Type>(Name); } \
229  void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
230 #include "clang/Frontend/CodeGenOptions.def"
231 
232  CodeGenOptions();
233 
234  /// \brief Is this a libc/libm function that is no longer recognized as a
235  /// builtin because a -fno-builtin-* option has been specified?
236  bool isNoBuiltinFunc(const char *Name) const;
237 
238  const std::vector<std::string> &getNoBuiltinFuncs() const {
239  return NoBuiltinFuncs;
240  }
241 };
242 
243 } // end namespace clang
244 
245 #endif
std::string DwarfDebugFlags
The string to embed in the debug information for the compile unit, if non-empty.
std::shared_ptr< llvm::Regex > OptimizationRemarkMissedPattern
Regular expression to select optimizations for which we should enable missed optimization remarks...
std::string EABIVersion
The EABI version to use.
std::string SampleProfileFile
Name of the profile file to use with -fprofile-sample-use.
Emit only debug info necessary for generating line number tables (-gline-tables-only).
std::vector< std::string > RewriteMapFiles
Set of files definining the rules for the symbol rewriting.
Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure that this large collection of bi...
std::string CoverageFile
The filename with path we use for coverage files.
std::string SplitDwarfFile
The name for the split debug info file that we'll break out.
std::string DebugPass
Enable additional debugging information.
SanitizerSet SanitizeRecover
Set of sanitizer checks that are non-fatal (i.e.
std::vector< std::string > CudaGpuBinaryFileNames
A list of file names passed with -fcuda-include-gpubinary options to forward to CUDA runtime back-end...
Defines the clang::SanitizerKind enum.
std::map< std::string, std::string > DebugPrefixMap
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4381
Don't generate debug info.
Emit location information but do not generate debug info in the output.
std::string CodeModel
The code model to use (-mcmodel).
std::string FloatABI
The ABI to use for passing floating point arguments.
std::string ThreadModel
The thread model to use.
std::vector< std::string > DependentLibraries
A list of dependent libraries.
char CoverageVersion[4]
The version string to put into coverage files.
std::vector< std::string > NoBuiltinFuncs
A list of all -fno-builtin-* function names (e.g., memset).
std::string LimitFloatPrecision
The float precision limit to use, if non-empty.
std::string RelocationModel
The name of the relocation model to use.
std::shared_ptr< llvm::Regex > OptimizationRemarkPattern
Regular expression to select optimizations for which we should enable optimization remarks...
const std::vector< std::string > & getNoBuiltinFuncs() const
std::string InstrProfileInput
Name of the profile file to use as input for -fprofile-instr-use.
SanitizerSet SanitizeTrap
Set of sanitizer checks that trap rather than diagnose.
std::shared_ptr< llvm::Regex > OptimizationRemarkAnalysisPattern
Regular expression to select optimizations for which we should enable optimization analyses...
std::string ThinLTOIndexFile
Name of the function summary index file to use for ThinLTO function importing.
std::string DebugCompilationDir
The string to embed in debug information as the current working directory.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
bool isNoBuiltinFunc(const char *Name) const
Is this a libc/libm function that is no longer recognized as a builtin because a -fno-builtin-* optio...
std::string MainFileName
The user provided name for the "main file", if non-empty.
std::vector< std::pair< unsigned, std::string > > LinkBitcodeFiles
The name of the bitcode file to link before optzns.
std::string InstrProfileOutput
Name of the profile file to use as output for -fprofile-instr-generate and -fprofile-generate.
std::string TrapFuncName
If not an empty string, trap intrinsics are lowered to calls to this function instead of to trap inst...
Limit generated debug info to reduce size (-fno-standalone-debug).
std::vector< std::string > BackendOptions
A list of command-line options to forward to the LLVM backend.