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
21 /// CodeGenOptions - Track various options which control how the code
22 /// is optimized and passed to the backend.
23 class CodeGenOptions {
26 NoInlining, // Perform no inlining whatsoever.
27 NormalInlining, // Use the standard function inlining pass.
28 OnlyAlwaysInlining // Only run the always inlining pass.
31 enum ObjCDispatchMethodKind {
37 unsigned AsmVerbose : 1; /// -dA, -fverbose-asm.
38 unsigned CXAAtExit : 1; /// Use __cxa_atexit for calling destructors.
39 unsigned CXXCtorDtorAliases: 1; /// Emit complete ctors/dtors as linker
40 /// aliases to base ctors when possible.
41 unsigned DataSections : 1; /// Set when -fdata-sections is enabled
42 unsigned DebugInfo : 1; /// Should generate debug info (-g).
43 unsigned LimitDebugInfo : 1; /// Limit generated debug info to reduce size.
44 unsigned DisableFPElim : 1; /// Set when -fomit-frame-pointer is enabled.
45 unsigned DisableLLVMOpts : 1; /// Don't run any optimizations, for use in
46 /// getting .bc files that correspond to the
47 /// internal state before optimizations are
49 unsigned DisableRedZone : 1; /// Set when -mno-red-zone is enabled.
50 unsigned EmitDeclMetadata : 1; /// Emit special metadata indicating what
51 /// Decl* various IR entities came from. Only
52 /// useful when running CodeGen as a
54 unsigned FunctionSections : 1; /// Set when -ffunction-sections is enabled
55 unsigned HiddenWeakTemplateVTables : 1; /// Emit weak vtables and RTTI for
56 /// template classes with hidden visibility
57 unsigned HiddenWeakVTables : 1; /// Emit weak vtables, RTTI, and thunks with
58 /// hidden visibility.
59 unsigned InstrumentFunctions : 1; /// Set when -finstrument-functions is
61 unsigned InstrumentForProfiling : 1; /// Set when -pg is enabled
62 unsigned LessPreciseFPMAD : 1; /// Enable less precise MAD instructions to be
64 unsigned MergeAllConstants : 1; /// Merge identical constants.
65 unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled.
66 unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled.
67 unsigned NoInfsFPMath : 1; /// Assume FP arguments, results not +-Inf.
68 unsigned NoNaNsFPMath : 1; /// Assume FP arguments, results not NaN.
69 unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss
70 unsigned ObjCDispatchMethod : 2; /// Method of Objective-C dispatch to use.
71 unsigned OmitLeafFramePointer : 1; /// Set when -momit-leaf-frame-pointer is
73 unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
74 unsigned OptimizeSize : 1; /// If -Os is specified.
75 unsigned RelaxAll : 1; /// Relax all machine code instructions.
76 unsigned RelaxedAliasing : 1; /// Set when -fno-strict-aliasing is enabled.
77 unsigned SimplifyLibCalls : 1; /// Set when -fbuiltin is enabled.
78 unsigned SoftFloat : 1; /// -soft-float.
79 unsigned TimePasses : 1; /// Set when -ftime-report is enabled.
80 unsigned UnitAtATime : 1; /// Unused. For mirroring GCC optimization
82 unsigned UnrollLoops : 1; /// Control whether loops are unrolled.
83 unsigned UnsafeFPMath : 1; /// Allow unsafe floating point optzns.
84 unsigned UnwindTables : 1; /// Emit unwind tables.
85 unsigned VerifyModule : 1; /// Control whether the module should be run
86 /// through the LLVM Verifier.
88 /// The code model to use (-mcmodel).
89 std::string CodeModel;
91 /// Enable additional debugging information.
92 std::string DebugPass;
94 /// The string to embed in the debug information for the compile unit, if
96 std::string DwarfDebugFlags;
98 /// The ABI to use for passing floating point arguments.
101 /// The float precision limit to use, if non-empty.
102 std::string LimitFloatPrecision;
104 /// The kind of inlining to perform.
105 InliningMethod Inlining;
107 /// The user provided name for the "main file", if non-empty. This is useful
108 /// in situations where the input file name does not match the original input
109 /// file, for example with -save-temps.
110 std::string MainFileName;
112 /// The name of the relocation model to use.
113 std::string RelocationModel;
115 /// The user specified number of registers to be used for integral arguments,
116 /// or 0 if unspecified.
117 unsigned NumRegisterParameters;
123 CXXCtorDtorAliases = 0;
130 EmitDeclMetadata = 0;
131 FunctionSections = 0;
132 HiddenWeakTemplateVTables = 0;
133 HiddenWeakVTables = 0;
134 InstrumentFunctions = 0;
135 InstrumentForProfiling = 0;
136 LessPreciseFPMAD = 0;
137 MergeAllConstants = 1;
142 NoZeroInitializedInBSS = 0;
143 NumRegisterParameters = 0;
144 ObjCDispatchMethod = Legacy;
145 OmitLeafFramePointer = 0;
146 OptimizationLevel = 0;
150 SimplifyLibCalls = 1;
159 Inlining = NoInlining;
160 RelocationModel = "pic";
163 ObjCDispatchMethodKind getObjCDispatchMethod() const {
164 return ObjCDispatchMethodKind(ObjCDispatchMethod);
168 } // end namespace clang