1 //===--- CodeGenOptions.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the CodeGenOptions interface.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H
15 #define LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H
22 /// \brief Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure
23 /// that this large collection of bitfields is a trivial class type.
24 class CodeGenOptionsBase {
26 #define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits;
27 #define ENUM_CODEGENOPT(Name, Type, Bits, Default)
28 #include "clang/Frontend/CodeGenOptions.def"
31 #define CODEGENOPT(Name, Bits, Default)
32 #define ENUM_CODEGENOPT(Name, Type, Bits, Default) unsigned Name : Bits;
33 #include "clang/Frontend/CodeGenOptions.def"
36 /// CodeGenOptions - Track various options which control how the code
37 /// is optimized and passed to the backend.
38 class CodeGenOptions : public CodeGenOptionsBase {
41 NoInlining, // Perform no inlining whatsoever.
42 NormalInlining, // Use the standard function inlining pass.
43 OnlyAlwaysInlining // Only run the always inlining pass.
46 enum ObjCDispatchMethodKind {
53 NoDebugInfo, // Don't generate debug info.
54 DebugLineTablesOnly, // Emit only debug info necessary for generating
55 // line number tables (-gline-tables-only).
56 LimitedDebugInfo, // Limit generated debug info to reduce size
57 // (-flimit-debug-info).
58 FullDebugInfo // Generate complete debug info.
62 GeneralDynamicTLSModel,
68 enum FPContractModeKind {
69 FPC_Off, // Form fused FP ops only where result will not be affected.
70 FPC_On, // Form fused FP ops according to FP_CONTRACT rules.
71 FPC_Fast // Aggressively fuse FP ops (E.g. FMA).
74 /// The code model to use (-mcmodel).
75 std::string CodeModel;
77 /// The filename with path we use for coverage files. The extension will be
79 std::string CoverageFile;
81 /// The version string to put into coverage files.
82 char CoverageVersion[4];
84 /// Enable additional debugging information.
85 std::string DebugPass;
87 /// The string to embed in debug information as the current working directory.
88 std::string DebugCompilationDir;
90 /// The string to embed in the debug information for the compile unit, if
92 std::string DwarfDebugFlags;
94 /// The ABI to use for passing floating point arguments.
97 /// The float precision limit to use, if non-empty.
98 std::string LimitFloatPrecision;
100 /// The name of the bitcode file to link before optzns.
101 std::string LinkBitcodeFile;
103 /// The user provided name for the "main file", if non-empty. This is useful
104 /// in situations where the input file name does not match the original input
105 /// file, for example with -save-temps.
106 std::string MainFileName;
108 /// The name for the split debug info file that we'll break out. This is used
109 /// in the backend for setting the name in the skeleton cu.
110 std::string SplitDwarfFile;
112 /// The name of the relocation model to use.
113 std::string RelocationModel;
115 /// Path to blacklist file for sanitizers.
116 std::string SanitizerBlacklistFile;
118 /// If not an empty string, trap intrinsics are lowered to calls to this
119 /// function instead of to trap instructions.
120 std::string TrapFuncName;
122 /// A list of command-line options to forward to the LLVM backend.
123 std::vector<std::string> BackendOptions;
126 // Define accessors/mutators for code generation options of enumeration type.
127 #define CODEGENOPT(Name, Bits, Default)
128 #define ENUM_CODEGENOPT(Name, Type, Bits, Default) \
129 Type get##Name() const { return static_cast<Type>(Name); } \
130 void set##Name(Type Value) { Name = static_cast<unsigned>(Value); }
131 #include "clang/Frontend/CodeGenOptions.def"
134 #define CODEGENOPT(Name, Bits, Default) Name = Default;
135 #define ENUM_CODEGENOPT(Name, Type, Bits, Default) \
137 #include "clang/Frontend/CodeGenOptions.def"
139 RelocationModel = "pic";
140 memcpy(CoverageVersion, "402*", 4);
144 } // end namespace clang