Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceClFlags.h - Cl Flags for translation ------*- C++ -*-===// |
| 2 | // |
| 3 | // The Subzero Code Generator |
| 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 declares command line flags controlling translation. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef SUBZERO_SRC_ICECLFLAGS_H |
| 15 | #define SUBZERO_SRC_ICECLFLAGS_H |
| 16 | |
Karl Schimpf | 5ee234a | 2014-09-12 10:41:40 -0700 | [diff] [blame] | 17 | #include "IceTypes.def" |
| 18 | |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 19 | namespace Ice { |
| 20 | |
| 21 | class ClFlags { |
Karl Schimpf | df80eb8 | 2015-02-09 14:20:22 -0800 | [diff] [blame^] | 22 | ClFlags(const ClFlags &) = delete; |
| 23 | ClFlags &operator=(const ClFlags &) = delete; |
| 24 | |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 25 | public: |
| 26 | ClFlags() |
Karl Schimpf | df80eb8 | 2015-02-09 14:20:22 -0800 | [diff] [blame^] | 27 | : // bool fields. |
| 28 | AllowErrorRecovery(false), |
| 29 | AllowUninitializedGlobals(false), DataSections(false), |
| 30 | DecorateAsm(false), DisableInternal(false), DisableIRGeneration(false), |
| 31 | DisableTranslation(false), DumpStats(false), FunctionSections(false), |
| 32 | GenerateUnitTestMessages(false), PhiEdgeSplit(false), |
| 33 | StubConstantCalls(false), SubzeroTimingEnabled(false), |
| 34 | TimeEachFunction(false), UseELFWriter(false), |
| 35 | UseIntegratedAssembler(false), UseSandboxing(false), |
| 36 | // IceString fields. |
| 37 | DefaultFunctionPrefix(""), DefaultGlobalPrefix(""), TimingFocusOn(""), |
| 38 | TranslateOnly(""), VerboseFocusOn(""), |
| 39 | // size_t fields. |
| 40 | NumTranslationThreads(0) {} |
| 41 | |
| 42 | // bool accessors. |
| 43 | |
| 44 | bool getAllowErrorRecovery() const { return AllowErrorRecovery; } |
| 45 | void setAllowErrorRecovery(bool NewValue) { AllowErrorRecovery = NewValue; } |
| 46 | |
| 47 | bool getAllowUninitializedGlobals() const { |
| 48 | return AllowUninitializedGlobals; |
| 49 | } |
| 50 | void setAllowUninitializedGlobals(bool NewValue) { |
| 51 | AllowUninitializedGlobals = NewValue; |
| 52 | } |
| 53 | |
| 54 | bool getDataSections() const { return DataSections; } |
| 55 | void setDataSections(bool NewValue) { DataSections = NewValue; } |
| 56 | |
| 57 | bool getDecorateAsm() const { return DecorateAsm; } |
| 58 | void setDecorateAsm(bool NewValue) { DecorateAsm = NewValue; } |
| 59 | |
| 60 | bool getDisableInternal() const { return DisableInternal; } |
| 61 | void setDisableInternal(bool NewValue) { DisableInternal = NewValue; } |
| 62 | |
| 63 | bool getDisableIRGeneration() const { |
| 64 | return ALLOW_DISABLE_IR_GEN && DisableIRGeneration; |
| 65 | } |
| 66 | void setDisableIRGeneration(bool NewValue) { DisableIRGeneration = NewValue; } |
| 67 | |
| 68 | bool getDisableTranslation() const { return DisableTranslation; } |
| 69 | void setDisableTranslation(bool NewValue) { DisableTranslation = NewValue; } |
| 70 | |
| 71 | bool getDumpStats() const { return ALLOW_DUMP && DumpStats; } |
| 72 | void setDumpStats(bool NewValue) { DumpStats = NewValue; } |
| 73 | |
| 74 | bool getFunctionSections() const { return FunctionSections; } |
| 75 | void setFunctionSections(bool NewValue) { FunctionSections = NewValue; } |
| 76 | |
| 77 | bool getGenerateUnitTestMessages() const { |
| 78 | // Note: If dump routines have been turned off, the error messages |
| 79 | // will not be readable. Hence, turn off. |
| 80 | return !ALLOW_DUMP || GenerateUnitTestMessages; |
| 81 | } |
| 82 | void setGenerateUnitTestMessages(bool NewValue) { |
| 83 | GenerateUnitTestMessages = NewValue; |
| 84 | } |
| 85 | |
| 86 | bool getPhiEdgeSplit() const { return PhiEdgeSplit; } |
| 87 | void setPhiEdgeSplit(bool NewValue) { PhiEdgeSplit = NewValue; } |
| 88 | |
| 89 | bool getStubConstantCalls() const { |
| 90 | return !ALLOW_MINIMAL_BUILD && StubConstantCalls; |
| 91 | } |
| 92 | void setStubConstantCalls(bool NewValue) { StubConstantCalls = NewValue; } |
| 93 | |
| 94 | bool getSubzeroTimingEnabled() const { return SubzeroTimingEnabled; } |
| 95 | void setSubzeroTimingEnabled(bool NewValue) { |
| 96 | SubzeroTimingEnabled = NewValue; |
| 97 | } |
| 98 | |
| 99 | bool getTimeEachFunction() const { return ALLOW_DUMP && TimeEachFunction; } |
| 100 | void setTimeEachFunction(bool NewValue) { TimeEachFunction = NewValue; } |
| 101 | |
| 102 | bool getUseELFWriter() const { return UseELFWriter; } |
| 103 | void setUseELFWriter(bool NewValue) { UseELFWriter = NewValue; } |
| 104 | |
| 105 | bool getUseIntegratedAssembler() const { return UseIntegratedAssembler; } |
| 106 | void setUseIntegratedAssembler(bool NewValue) { |
| 107 | UseIntegratedAssembler = NewValue; |
| 108 | } |
| 109 | |
| 110 | bool getUseSandboxing() const { return UseSandboxing; } |
| 111 | void setUseSandboxing(bool NewValue) { UseSandboxing = NewValue; } |
| 112 | |
| 113 | // IceString accessors. |
| 114 | |
| 115 | const IceString &getDefaultFunctionPrefix() const { |
| 116 | return DefaultFunctionPrefix; |
| 117 | } |
| 118 | void setDefaultFunctionPrefix(const IceString &NewValue) { |
| 119 | DefaultFunctionPrefix = NewValue; |
| 120 | } |
| 121 | |
| 122 | const IceString &getDefaultGlobalPrefix() const { |
| 123 | return DefaultGlobalPrefix; |
| 124 | } |
| 125 | void setDefaultGlobalPrefix(const IceString &NewValue) { |
| 126 | DefaultGlobalPrefix = NewValue; |
| 127 | } |
| 128 | |
| 129 | const IceString &getTimingFocusOn() const { return TimingFocusOn; } |
| 130 | void setTimingFocusOn(const IceString &NewValue) { TimingFocusOn = NewValue; } |
| 131 | |
| 132 | const IceString &getTranslateOnly() const { return TranslateOnly; } |
| 133 | void setTranslateOnly(const IceString &NewValue) { TranslateOnly = NewValue; } |
| 134 | |
| 135 | const IceString &getVerboseFocusOn() const { return VerboseFocusOn; } |
| 136 | void setVerboseFocusOn(const IceString &NewValue) { |
| 137 | VerboseFocusOn = NewValue; |
| 138 | } |
| 139 | |
| 140 | // size_t accessors. |
| 141 | |
| 142 | size_t getNumTranslationThreads() const { return NumTranslationThreads; } |
| 143 | void setNumTranslationThreads(size_t NewValue) { |
| 144 | NumTranslationThreads = NewValue; |
| 145 | } |
| 146 | |
| 147 | private: |
| 148 | bool AllowErrorRecovery; |
| 149 | bool AllowUninitializedGlobals; |
Karl Schimpf | e3f64d0 | 2014-10-07 10:38:22 -0700 | [diff] [blame] | 150 | bool DataSections; |
Karl Schimpf | df80eb8 | 2015-02-09 14:20:22 -0800 | [diff] [blame^] | 151 | bool DecorateAsm; |
| 152 | bool DisableInternal; |
| 153 | bool DisableIRGeneration; |
| 154 | bool DisableTranslation; |
| 155 | bool DumpStats; |
| 156 | bool FunctionSections; |
| 157 | bool GenerateUnitTestMessages; |
| 158 | bool PhiEdgeSplit; |
| 159 | bool StubConstantCalls; |
| 160 | bool SubzeroTimingEnabled; |
| 161 | bool TimeEachFunction; |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 162 | bool UseELFWriter; |
Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 163 | bool UseIntegratedAssembler; |
Jim Stichnoth | bfb03e5 | 2014-08-26 10:29:05 -0700 | [diff] [blame] | 164 | bool UseSandboxing; |
Karl Schimpf | df80eb8 | 2015-02-09 14:20:22 -0800 | [diff] [blame^] | 165 | |
Karl Schimpf | 5ee234a | 2014-09-12 10:41:40 -0700 | [diff] [blame] | 166 | IceString DefaultFunctionPrefix; |
Karl Schimpf | df80eb8 | 2015-02-09 14:20:22 -0800 | [diff] [blame^] | 167 | IceString DefaultGlobalPrefix; |
Jim Stichnoth | 8363a06 | 2014-10-07 10:02:38 -0700 | [diff] [blame] | 168 | IceString TimingFocusOn; |
Jim Stichnoth | 088b2be | 2014-10-23 12:02:08 -0700 | [diff] [blame] | 169 | IceString TranslateOnly; |
Karl Schimpf | df80eb8 | 2015-02-09 14:20:22 -0800 | [diff] [blame^] | 170 | IceString VerboseFocusOn; |
| 171 | |
| 172 | size_t NumTranslationThreads; // 0 means completely sequential |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 173 | }; |
Jim Stichnoth | 989a703 | 2014-08-08 10:13:44 -0700 | [diff] [blame] | 174 | |
| 175 | } // end of namespace Ice |
Karl Schimpf | 8d7abae | 2014-07-07 14:50:30 -0700 | [diff] [blame] | 176 | |
| 177 | #endif // SUBZERO_SRC_ICECLFLAGS_H |