]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h
Update packet filter (pf) code to OpenBSD 4.5.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Frontend / CodeGenOptions.h
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 <string>
18 #include <vector>
19
20 namespace clang {
21
22 /// CodeGenOptions - Track various options which control how the code
23 /// is optimized and passed to the backend.
24 class CodeGenOptions {
25 public:
26   enum InliningMethod {
27     NoInlining,         // Perform no inlining whatsoever.
28     NormalInlining,     // Use the standard function inlining pass.
29     OnlyAlwaysInlining  // Only run the always inlining pass.
30   };
31
32   enum ObjCDispatchMethodKind {
33     Legacy = 0,
34     NonLegacy = 1,
35     Mixed = 2
36   };
37
38   unsigned AsmVerbose        : 1; /// -dA, -fverbose-asm.
39   unsigned CXAAtExit         : 1; /// Use __cxa_atexit for calling destructors.
40   unsigned CXXCtorDtorAliases: 1; /// Emit complete ctors/dtors as linker
41                                   /// aliases to base ctors when possible.
42   unsigned DataSections      : 1; /// Set when -fdata-sections is enabled
43   unsigned DebugInfo         : 1; /// Should generate debug info (-g).
44   unsigned LimitDebugInfo    : 1; /// Limit generated debug info to reduce size.
45   unsigned DisableFPElim     : 1; /// Set when -fomit-frame-pointer is enabled.
46   unsigned DisableLLVMOpts   : 1; /// Don't run any optimizations, for use in
47                                   /// getting .bc files that correspond to the
48                                   /// internal state before optimizations are
49                                   /// done.
50   unsigned DisableRedZone    : 1; /// Set when -mno-red-zone is enabled.
51   unsigned EmitDeclMetadata  : 1; /// Emit special metadata indicating what
52                                   /// Decl* various IR entities came from.  Only
53                                   /// useful when running CodeGen as a
54                                   /// subroutine.
55   unsigned EmitGcovArcs      : 1; /// Emit coverage data files, aka. GCDA.
56   unsigned EmitGcovNotes     : 1; /// Emit coverage "notes" files, aka GCNO.
57   unsigned ForbidGuardVariables : 1; /// Issue errors if C++ guard variables
58                                   /// are required
59   unsigned FunctionSections  : 1; /// Set when -ffunction-sections is enabled
60   unsigned HiddenWeakTemplateVTables : 1; /// Emit weak vtables and RTTI for
61                                   /// template classes with hidden visibility
62   unsigned HiddenWeakVTables : 1; /// Emit weak vtables, RTTI, and thunks with
63                                   /// hidden visibility.
64   unsigned InstrumentFunctions : 1; /// Set when -finstrument-functions is
65                                     /// enabled.
66   unsigned InstrumentForProfiling : 1; /// Set when -pg is enabled
67   unsigned LessPreciseFPMAD  : 1; /// Enable less precise MAD instructions to be
68                                   /// generated.
69   unsigned MergeAllConstants : 1; /// Merge identical constants.
70   unsigned NoCommon          : 1; /// Set when -fno-common or C++ is enabled.
71   unsigned NoDwarf2CFIAsm    : 1; /// Set when -fno-dwarf2-cfi-asm is enabled.
72   unsigned NoImplicitFloat   : 1; /// Set when -mno-implicit-float is enabled.
73   unsigned NoInfsFPMath      : 1; /// Assume FP arguments, results not +-Inf.
74   unsigned NoNaNsFPMath      : 1; /// Assume FP arguments, results not NaN.
75   unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss
76   unsigned ObjCDispatchMethod : 2; /// Method of Objective-C dispatch to use.
77   unsigned OmitLeafFramePointer : 1; /// Set when -momit-leaf-frame-pointer is
78                                      /// enabled.
79   unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
80   unsigned OptimizeSize      : 2; /// If -Os (==1) or -Oz (==2) is specified.
81   unsigned RelaxAll          : 1; /// Relax all machine code instructions.
82   unsigned RelaxedAliasing   : 1; /// Set when -fno-strict-aliasing is enabled.
83   unsigned SaveTempLabels    : 1; /// Save temporary labels.
84   unsigned SimplifyLibCalls  : 1; /// Set when -fbuiltin is enabled.
85   unsigned SoftFloat         : 1; /// -soft-float.
86   unsigned TimePasses        : 1; /// Set when -ftime-report is enabled.
87   unsigned UnitAtATime       : 1; /// Unused. For mirroring GCC optimization
88                                   /// selection.
89   unsigned UnrollLoops       : 1; /// Control whether loops are unrolled.
90   unsigned UnsafeFPMath      : 1; /// Allow unsafe floating point optzns.
91   unsigned UnwindTables      : 1; /// Emit unwind tables.
92   unsigned VerifyModule      : 1; /// Control whether the module should be run
93                                   /// through the LLVM Verifier.
94
95   /// The code model to use (-mcmodel).
96   std::string CodeModel;
97
98   /// The filename with path we use for coverage files. The extension will be
99   /// replaced.
100   std::string CoverageFile;
101
102   /// Enable additional debugging information.
103   std::string DebugPass;
104
105   /// The string to embed in the debug information for the compile unit, if
106   /// non-empty.
107   std::string DwarfDebugFlags;
108
109   /// The ABI to use for passing floating point arguments.
110   std::string FloatABI;
111
112   /// The float precision limit to use, if non-empty.
113   std::string LimitFloatPrecision;
114
115   /// The kind of inlining to perform.
116   InliningMethod Inlining;
117
118   /// The user provided name for the "main file", if non-empty. This is useful
119   /// in situations where the input file name does not match the original input
120   /// file, for example with -save-temps.
121   std::string MainFileName;
122
123   /// The name of the relocation model to use.
124   std::string RelocationModel;
125
126   /// A list of command-line options to forward to the LLVM backend.
127   std::vector<std::string> BackendOptions;
128
129   /// The user specified number of registers to be used for integral arguments,
130   /// or 0 if unspecified.
131   unsigned NumRegisterParameters;
132
133 public:
134   CodeGenOptions() {
135     AsmVerbose = 0;
136     CXAAtExit = 1;
137     CXXCtorDtorAliases = 0;
138     DataSections = 0;
139     DebugInfo = 0;
140     LimitDebugInfo = 0;
141     DisableFPElim = 0;
142     DisableLLVMOpts = 0;
143     DisableRedZone = 0;
144     EmitDeclMetadata = 0;
145     EmitGcovArcs = 0;
146     EmitGcovNotes = 0;
147     ForbidGuardVariables = 0;
148     FunctionSections = 0;
149     HiddenWeakTemplateVTables = 0;
150     HiddenWeakVTables = 0;
151     InstrumentFunctions = 0;
152     InstrumentForProfiling = 0;
153     LessPreciseFPMAD = 0;
154     MergeAllConstants = 1;
155     NoCommon = 0;
156     NoDwarf2CFIAsm = 0;
157     NoImplicitFloat = 0;
158     NoInfsFPMath = 0;
159     NoNaNsFPMath = 0;
160     NoZeroInitializedInBSS = 0;
161     NumRegisterParameters = 0;
162     ObjCDispatchMethod = Legacy;
163     OmitLeafFramePointer = 0;
164     OptimizationLevel = 0;
165     OptimizeSize = 0;
166     RelaxAll = 0;
167     RelaxedAliasing = 0;
168     SaveTempLabels = 0;
169     SimplifyLibCalls = 1;
170     SoftFloat = 0;
171     TimePasses = 0;
172     UnitAtATime = 1;
173     UnrollLoops = 0;
174     UnsafeFPMath = 0;
175     UnwindTables = 0;
176     VerifyModule = 1;
177
178     Inlining = NoInlining;
179     RelocationModel = "pic";
180   }
181
182   ObjCDispatchMethodKind getObjCDispatchMethod() const {
183     return ObjCDispatchMethodKind(ObjCDispatchMethod);
184   }
185 };
186
187 }  // end namespace clang
188
189 #endif