| OLD | NEW |
| 1 //===- subzero/src/IceClFlags.h - Cl Flags for translation ------*- C++ -*-===// | 1 //===- subzero/src/IceClFlags.h - Cl Flags for translation ------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| 11 /// \brief Declares Ice::ClFlags which implements command line processing. | 11 /// \brief Declares Ice::ClFlags which implements command line processing. |
| 12 /// | 12 /// |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICECLFLAGS_H | 15 #ifndef SUBZERO_SRC_ICECLFLAGS_H |
| 16 #define SUBZERO_SRC_ICECLFLAGS_H | 16 #define SUBZERO_SRC_ICECLFLAGS_H |
| 17 | 17 |
| 18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
| 19 #include "IceBuildDefs.h" |
| 20 #include "IceClFlags.def" |
| 19 #include "IceTypes.h" | 21 #include "IceTypes.h" |
| 20 | 22 |
| 23 #ifdef __clang__ |
| 24 #pragma clang diagnostic push |
| 25 #pragma clang diagnostic ignored "-Wunused-parameter" |
| 26 #endif // __clang__ |
| 27 |
| 28 #include "llvm/IRReader/IRReader.h" |
| 29 |
| 30 #ifdef __clang__ |
| 31 #pragma clang diagnostic pop |
| 32 #endif // __clang__ |
| 33 |
| 34 #include <string> |
| 35 #include <utility> |
| 36 #include <vector> |
| 37 |
| 21 namespace Ice { | 38 namespace Ice { |
| 39 // detail defines the type cl_type_traits, which is used to define the |
| 40 // getters/setters for the ClFlags class. It converts the cl_detail::*_flag |
| 41 // types to appropriate types for the several getters and setters created. |
| 42 namespace detail { |
| 43 // Base cl_type_traits. |
| 44 template <typename B, typename CL> struct cl_type_traits {}; |
| 22 | 45 |
| 23 // TODO(stichnot): Fix the separation between ClFlags and ClFlagsExtra. | 46 // cl_type_traits specialized cl::list<std::string>, non-MINIMAL build. |
| 24 // | 47 template <> struct cl_type_traits<std::string, cl_detail::dev_list_flag> { |
| 25 // The original intention was that ClFlags would be the core set of flags for a | 48 using storage_type = std::vector<std::string>; |
| 26 // release build, while ClFlagsExtra had optional flags that would be locked to | 49 }; |
| 27 // default values in a release build. However, the division has evolved to be | |
| 28 // fairly arbitrary. | |
| 29 // | |
| 30 // The variable flags in a release (browser) build should be limited to opt | |
| 31 // level, number of threads, output file, and perhaps input file. | |
| 32 // | |
| 33 // The core flags should remain part of the GlobalContext object, but the | |
| 34 // optional flags might as well be global, i.e. static members of GlobalContext, | |
| 35 // so that they are easily accessed from anywhere without needing to plumb in | |
| 36 // the GlobalContext object. | |
| 37 | 50 |
| 38 class ClFlagsExtra; | 51 // cl_type_traits specialized cl::list<Ice::VerboseItem>, non-MINIMAL build. |
| 52 template <> struct cl_type_traits<Ice::VerboseItem, cl_detail::dev_list_flag> { |
| 53 using storage_type = Ice::VerboseMask; |
| 54 }; |
| 55 |
| 56 // cl_type_traits specialized cl::opt<T>, non-MINIMAL build. |
| 57 template <typename T> struct cl_type_traits<T, cl_detail::dev_opt_flag> { |
| 58 using storage_type = T; |
| 59 }; |
| 60 |
| 61 // cl_type_traits specialized cl::opt<T>, MINIMAL build. |
| 62 template <typename T> struct cl_type_traits<T, cl_detail::release_opt_flag> { |
| 63 using storage_type = T; |
| 64 }; |
| 65 |
| 66 } // end of namespace detail |
| 39 | 67 |
| 40 /// Define variables which configure translation and related support functions. | 68 /// Define variables which configure translation and related support functions. |
| 41 class ClFlags { | 69 class ClFlags { |
| 42 ClFlags(const ClFlags &) = delete; | 70 ClFlags(const ClFlags &) = delete; |
| 43 ClFlags &operator=(const ClFlags &) = delete; | 71 ClFlags &operator=(const ClFlags &) = delete; |
| 44 | 72 |
| 45 public: | 73 public: |
| 46 using StringVector = std::vector<IceString>; | |
| 47 | |
| 48 /// User defined constructor. | 74 /// User defined constructor. |
| 49 ClFlags() { resetClFlags(*this); } | 75 ClFlags() { resetClFlags(); } |
| 50 | 76 |
| 51 /// \brief Parse commmand line options for Subzero. | 77 /// \brief Parse commmand line options for Subzero. |
| 52 /// | 78 /// |
| 53 /// This is done use cl::ParseCommandLineOptions() and the static variables of | 79 /// This is done use cl::ParseCommandLineOptions() and the static variables of |
| 54 /// type cl::opt defined in IceClFlags.cpp | 80 /// type cl::opt defined in IceClFlags.cpp |
| 55 static void parseFlags(int argc, char *argv[]); | 81 static void parseFlags(int argc, char *argv[]); |
| 82 |
| 56 /// Reset all configuration options to their nominal values. | 83 /// Reset all configuration options to their nominal values. |
| 57 static void resetClFlags(ClFlags &OutFlags); | 84 void resetClFlags(); |
| 85 |
| 58 /// \brief Retrieve the configuration option state | 86 /// \brief Retrieve the configuration option state |
| 59 /// | 87 /// |
| 60 /// This is defined by static variables | 88 /// This is defined by static variables |
| 61 /// anonymous_namespace{IceClFlags.cpp}::AllowErrorRecovery, | 89 /// anonymous_namespace{IceClFlags.cpp}::AllowErrorRecoveryObj, |
| 62 /// anonymous_namespace{IceClFlags.cpp}::AllowIacaMarks, | 90 /// anonymous_namespace{IceClFlags.cpp}::AllowIacaMarksObj, |
| 63 /// ... | 91 /// ... |
| 64 static void getParsedClFlags(ClFlags &OutFlags); | 92 static void getParsedClFlags(ClFlags &OutFlags); |
| 65 /// Retrieve the extra configuration options state. | |
| 66 static void getParsedClFlagsExtra(ClFlagsExtra &OutFlagsExtra); | |
| 67 | 93 |
| 68 // bool accessors. | 94 #define X(Name, Type, ClType, ...) \ |
| 95 private: \ |
| 96 typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type Name; \ |
| 97 \ |
| 98 template <bool E> \ |
| 99 typename std::enable_if<E, void>::type set##Name##Impl( \ |
| 100 typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type \ |
| 101 Value) { \ |
| 102 Name = std::move(Value); \ |
| 103 } \ |
| 104 \ |
| 105 template <bool E> \ |
| 106 typename std::enable_if<!E, void>::type set##Name##Impl( \ |
| 107 typename detail::cl_type_traits<Type, \ |
| 108 cl_detail::ClType>::storage_type) {} \ |
| 109 \ |
| 110 public: \ |
| 111 typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type \ |
| 112 get##Name() const { \ |
| 113 return Name; \ |
| 114 } \ |
| 115 \ |
| 116 void set##Name( \ |
| 117 typename detail::cl_type_traits<Type, cl_detail::ClType>::storage_type \ |
| 118 Value) { \ |
| 119 /* TODO(jpp): figure out which optional flags are used in minimal, and \ |
| 120 what are the defaults for them. */ \ |
| 121 static constexpr bool Enable = \ |
| 122 std::is_same<cl_detail::ClType, cl_detail::release_opt_flag>::value || \ |
| 123 !BuildDefs::minimal() || true; \ |
| 124 set##Name##Impl<Enable>(std::move(Value)); \ |
| 125 } \ |
| 126 \ |
| 127 private: |
| 128 COMMAND_LINE_FLAGS |
| 129 #undef X |
| 69 | 130 |
| 70 /// Get the value of ClFlags::AllowErrorRecovery | 131 public: |
| 71 bool getAllowErrorRecovery() const { return AllowErrorRecovery; } | 132 bool isSequential() const { return NumTranslationThreads == 0; } |
| 72 /// Set ClFlags::AllowErrorRecovery to a new value | 133 std::string getAppName() const { return AppName; } |
| 73 void setAllowErrorRecovery(bool NewValue) { AllowErrorRecovery = NewValue; } | 134 void setAppName(const std::string &Value) { AppName = Value; } |
| 74 | |
| 75 /// Get the value of ClFlags::AllowExternDefinedSymbols | |
| 76 bool getAllowExternDefinedSymbols() const { | |
| 77 return AllowExternDefinedSymbols; | |
| 78 } | |
| 79 /// Set ClFlags::AllowExternDefinedSymbols to a new value | |
| 80 void setAllowExternDefinedSymbols(bool NewValue) { | |
| 81 AllowExternDefinedSymbols = NewValue; | |
| 82 } | |
| 83 | |
| 84 /// Get the value of ClFlags::AllowIacaMarks | |
| 85 bool getAllowIacaMarks() const { return AllowIacaMarks; } | |
| 86 /// Set ClFlags::AllowIacaMarks to a new value | |
| 87 void setAllowIacaMarks(bool NewValue) { AllowIacaMarks = NewValue; } | |
| 88 | |
| 89 /// Get the value of ClFlags::AllowUninitializedGlobals | |
| 90 bool getAllowUninitializedGlobals() const { | |
| 91 return AllowUninitializedGlobals; | |
| 92 } | |
| 93 /// Set ClFlags::AllowUninitializedGlobals to a new value | |
| 94 void setAllowUninitializedGlobals(bool NewValue) { | |
| 95 AllowUninitializedGlobals = NewValue; | |
| 96 } | |
| 97 | |
| 98 /// Get the value of ClFlags::DataSections | |
| 99 bool getDataSections() const { return DataSections; } | |
| 100 /// Set ClFlags::DataSections to a new value | |
| 101 void setDataSections(bool NewValue) { DataSections = NewValue; } | |
| 102 | |
| 103 /// Get the value of ClFlags::DecorateAsm | |
| 104 bool getDecorateAsm() const { return DecorateAsm; } | |
| 105 /// Set ClFlags::DecorateAsm to a new value | |
| 106 void setDecorateAsm(bool NewValue) { DecorateAsm = NewValue; } | |
| 107 | |
| 108 /// Get the value of ClFlags::DisableHybridAssembly | |
| 109 bool getDisableHybridAssembly() const { return DisableHybridAssembly; } | |
| 110 /// Set ClFlags::DisableHybridAssembly to a new value | |
| 111 void setDisableHybridAssembly(bool NewValue) { | |
| 112 DisableHybridAssembly = NewValue; | |
| 113 } | |
| 114 | |
| 115 /// Get the value of ClFlags::DisableInternal | |
| 116 bool getDisableInternal() const { return DisableInternal; } | |
| 117 /// Set ClFlags::DisableInternal to a new value | |
| 118 void setDisableInternal(bool NewValue) { DisableInternal = NewValue; } | |
| 119 | |
| 120 /// Get the value of ClFlags::DisableTranslation | |
| 121 bool getDisableTranslation() const { return DisableTranslation; } | |
| 122 /// Set ClFlags::DisableTranslation to a new value | |
| 123 void setDisableTranslation(bool NewValue) { DisableTranslation = NewValue; } | |
| 124 | |
| 125 /// Get the value of ClFlags::DumpStats | |
| 126 bool getDumpStats() const { return BuildDefs::dump() && DumpStats; } | |
| 127 /// Set ClFlags::DumpStats to a new value | |
| 128 void setDumpStats(bool NewValue) { DumpStats = NewValue; } | |
| 129 | |
| 130 /// Get the value of ClFlags::EnableBlockProfile | |
| 131 bool getEnableBlockProfile() const { return EnableBlockProfile; } | |
| 132 /// Set ClFlags::EnableBlockProfile to a new value | |
| 133 void setEnableBlockProfile(bool NewValue) { EnableBlockProfile = NewValue; } | |
| 134 | |
| 135 /// Get the restricted list of registers to use, for corresponding register | |
| 136 /// classes, in register allocation. | |
| 137 const StringVector &getUseRestrictedRegisters() const { | |
| 138 return UseRestrictedRegisters; | |
| 139 } | |
| 140 void clearUseRestrictedRegisters() { UseRestrictedRegisters.clear(); } | |
| 141 void setUseRestrictedRegisters(const StringVector &Registers) { | |
| 142 UseRestrictedRegisters = Registers; | |
| 143 } | |
| 144 | |
| 145 /// Get the value of ClFlags::ForceMemIntrinOpt | |
| 146 bool getForceMemIntrinOpt() const { return ForceMemIntrinOpt; } | |
| 147 /// Set ClFlags::ForceMemIntrinOpt to a new value | |
| 148 void setForceMemIntrinOpt(bool NewValue) { ForceMemIntrinOpt = NewValue; } | |
| 149 | |
| 150 /// Get the value of ClFlags::FunctionSections | |
| 151 bool getFunctionSections() const { return FunctionSections; } | |
| 152 /// Set ClFlags::FunctionSections to a new value | |
| 153 void setFunctionSections(bool NewValue) { FunctionSections = NewValue; } | |
| 154 | 135 |
| 155 /// \brief Get the value of ClFlags::GenerateUnitTestMessages | 136 /// \brief Get the value of ClFlags::GenerateUnitTestMessages |
| 156 /// | 137 /// |
| 157 /// Note: If dump routines have been turned off, the error messages | 138 /// Note: If dump routines have been turned off, the error messages |
| 158 /// will not be readable. Hence, turn off. | 139 /// will not be readable. Hence, turn off. |
| 159 bool getGenerateUnitTestMessages() const { | 140 bool getGenerateUnitTestMessages() const { |
| 160 return !BuildDefs::dump() || GenerateUnitTestMessages; | 141 return !BuildDefs::dump() || GenerateUnitTestMessages; |
| 161 } | 142 } |
| 162 /// Set ClFlags::GenerateUnitTestMessages to a new value | 143 /// Set ClFlags::GenerateUnitTestMessages to a new value |
| 163 void setGenerateUnitTestMessages(bool NewValue) { | 144 void setGenerateUnitTestMessages(bool NewValue) { |
| 164 GenerateUnitTestMessages = NewValue; | 145 GenerateUnitTestMessages = NewValue; |
| 165 } | 146 } |
| 166 | 147 |
| 167 /// Get the value of ClFlags::KeepDeletedInsts | 148 private: |
| 168 bool getKeepDeletedInsts() const { return KeepDeletedInsts; } | 149 std::string AppName; |
| 169 /// Set ClFlags::KeepDeletedInsts to a new value | |
| 170 void setKeepDeletedInsts(bool NewValue) { KeepDeletedInsts = NewValue; } | |
| 171 | 150 |
| 172 /// Get the value of ClFlags::MockBoundsCheck | |
| 173 bool getMockBoundsCheck() const { return MockBoundsCheck; } | |
| 174 /// Set ClFlags::MockBoundsCheck to a new value | |
| 175 void setMockBoundsCheck(bool NewValue) { MockBoundsCheck = NewValue; } | |
| 176 | |
| 177 /// Get the value of ClFlags::PhiEdgeSplit | |
| 178 bool getPhiEdgeSplit() const { return PhiEdgeSplit; } | |
| 179 /// Set ClFlags::PhiEdgeSplit to a new value | |
| 180 void setPhiEdgeSplit(bool NewValue) { PhiEdgeSplit = NewValue; } | |
| 181 | |
| 182 /// Get the value of ClFlags::RandomNopInsertion | |
| 183 bool shouldDoNopInsertion() const { return RandomNopInsertion; } | |
| 184 /// Set ClFlags::RandomNopInsertion to a new value | |
| 185 void setShouldDoNopInsertion(bool NewValue) { RandomNopInsertion = NewValue; } | |
| 186 | |
| 187 /// Get the value of ClFlags::RandomRegAlloc | |
| 188 bool shouldRandomizeRegAlloc() const { return RandomRegAlloc; } | |
| 189 /// Set ClFlags::RandomRegAlloc to a new value | |
| 190 void setShouldRandomizeRegAlloc(bool NewValue) { RandomRegAlloc = NewValue; } | |
| 191 | |
| 192 /// Get the value of ClFlags::RegAllocReserve | |
| 193 bool getRegAllocReserve() const { return RegAllocReserve; } | |
| 194 /// Set ClFlags::RegAllocReserve to a new value | |
| 195 void setRegAllocReserve(bool NewValue) { RegAllocReserve = NewValue; } | |
| 196 | |
| 197 /// Get the value of ClFlags::RepeatRegAlloc | |
| 198 bool shouldRepeatRegAlloc() const { return RepeatRegAlloc; } | |
| 199 /// Set ClFlags::RepeatRegAlloc to a new value | |
| 200 void setShouldRepeatRegAlloc(bool NewValue) { RepeatRegAlloc = NewValue; } | |
| 201 | |
| 202 /// Get the value of ClFlags::SkipUnimplemented | |
| 203 bool getSkipUnimplemented() const { return SkipUnimplemented; } | |
| 204 /// Set ClFlags::SkipUnimplemented to a new value | |
| 205 void setSkipUnimplemented(bool NewValue) { SkipUnimplemented = NewValue; } | |
| 206 | |
| 207 /// Get the value of ClFlags::SubzeroTimingEnabled | |
| 208 bool getSubzeroTimingEnabled() const { return SubzeroTimingEnabled; } | |
| 209 /// Set ClFlags::SubzeroTimingEnableds to a new value | |
| 210 void setSubzeroTimingEnabled(bool NewValue) { | |
| 211 SubzeroTimingEnabled = NewValue; | |
| 212 } | |
| 213 | |
| 214 /// Get the value of ClFlags::TimeEachFunction | |
| 215 bool getTimeEachFunction() const { | |
| 216 return BuildDefs::dump() && TimeEachFunction; | |
| 217 } | |
| 218 /// Set ClFlags::TimeEachFunction to a new value | |
| 219 void setTimeEachFunction(bool NewValue) { TimeEachFunction = NewValue; } | |
| 220 | |
| 221 /// Get the value of ClFlags::UseNonsfi | |
| 222 bool getUseNonsfi() const { return UseNonsfi; } | |
| 223 /// Set ClFlags::UseNonsfi to a new value | |
| 224 void setUseNonsfi(bool NewValue) { UseNonsfi = NewValue; } | |
| 225 | |
| 226 /// Get the list of registers exluded in register allocation. | |
| 227 const StringVector &getExcludedRegisters() const { return ExcludedRegisters; } | |
| 228 void clearExcludedRegisters() { ExcludedRegisters.clear(); } | |
| 229 void setExcludedRegisters(const StringVector &Registers) { | |
| 230 ExcludedRegisters = Registers; | |
| 231 } | |
| 232 | |
| 233 /// Get the value of ClFlags::UseSandboxing | |
| 234 bool getUseSandboxing() const { return UseSandboxing; } | |
| 235 /// Set ClFlags::UseSandboxing to a new value | |
| 236 void setUseSandboxing(bool NewValue) { UseSandboxing = NewValue; } | |
| 237 | |
| 238 // Enum and integer accessors. | |
| 239 /// Get the value of ClFlags::Opt | |
| 240 OptLevel getOptLevel() const { return Opt; } | |
| 241 /// Set ClFlags::Opt to a new value | |
| 242 void setOptLevel(OptLevel NewValue) { Opt = NewValue; } | |
| 243 | |
| 244 /// Get the value of ClFlags::OutFileType | |
| 245 FileType getOutFileType() const { return OutFileType; } | |
| 246 /// Set ClFlags::OutFileType to a new value | |
| 247 void setOutFileType(FileType NewValue) { OutFileType = NewValue; } | |
| 248 | |
| 249 /// Get the value of ClFlags::RandomMaxNopsPerInstruction | |
| 250 int getMaxNopsPerInstruction() const { return RandomMaxNopsPerInstruction; } | |
| 251 /// Set ClFlags::RandomMaxNopsPerInstruction to a new value | |
| 252 void setMaxNopsPerInstruction(int NewValue) { | |
| 253 RandomMaxNopsPerInstruction = NewValue; | |
| 254 } | |
| 255 | |
| 256 /// Get the value of ClFlags::RandomNopProbabilityAsPercentage | |
| 257 int getNopProbabilityAsPercentage() const { | |
| 258 return RandomNopProbabilityAsPercentage; | |
| 259 } | |
| 260 /// Set ClFlags::RandomNopProbabilityAsPercentage to a new value | |
| 261 void setNopProbabilityAsPercentage(int NewValue) { | |
| 262 RandomNopProbabilityAsPercentage = NewValue; | |
| 263 } | |
| 264 | |
| 265 /// Get the value of ClFlags::TArch | |
| 266 TargetArch getTargetArch() const { return TArch; } | |
| 267 /// Set ClFlags::TArch to a new value | |
| 268 void setTargetArch(TargetArch NewValue) { TArch = NewValue; } | |
| 269 | |
| 270 /// Get the value of ClFlags::TInstrSet | |
| 271 TargetInstructionSet getTargetInstructionSet() const { return TInstrSet; } | |
| 272 /// Set ClFlags::TInstrSet to a new value | |
| 273 void setTargetInstructionSet(TargetInstructionSet NewValue) { | |
| 274 TInstrSet = NewValue; | |
| 275 } | |
| 276 | |
| 277 /// \brief Get the value of ClFlags::TestStackExtra | |
| 278 /// | |
| 279 /// Always 0 if BuildDefs::minimal() | |
| 280 uint32_t getTestStackExtra() const { | |
| 281 return BuildDefs::minimal() ? 0 : TestStackExtra; | |
| 282 } | |
| 283 /// \brief Set ClFlags::TestStackExtra to a new value | |
| 284 /// | |
| 285 /// Always 0 if BuildDefs::minimal() | |
| 286 void setTestStackExtra(uint32_t NewValue) { | |
| 287 if (BuildDefs::minimal()) | |
| 288 return; | |
| 289 TestStackExtra = NewValue; | |
| 290 } | |
| 291 | |
| 292 /// \brief Get the value of ClFlags::VMask | |
| 293 /// | |
| 294 /// None if BuildDefs::dump() | |
| 295 VerboseMask getVerbose() const { | |
| 296 return BuildDefs::dump() ? VMask : (VerboseMask)IceV_None; | |
| 297 } | |
| 298 /// \brief Set ClFlags::VMask to a new value | |
| 299 /// | |
| 300 /// None if BuildDefs::dump() | |
| 301 void setVerbose(VerboseMask NewValue) { VMask = NewValue; } | |
| 302 | |
| 303 /// Set ClFlags::RandomizeAndPoolImmediatesOption to a new value | |
| 304 void | |
| 305 setRandomizeAndPoolImmediatesOption(RandomizeAndPoolImmediatesEnum Option) { | |
| 306 RandomizeAndPoolImmediatesOption = Option; | |
| 307 } | |
| 308 /// Get the value of ClFlags::RandomizeAndPoolImmediatesOption | |
| 309 RandomizeAndPoolImmediatesEnum getRandomizeAndPoolImmediatesOption() const { | |
| 310 return RandomizeAndPoolImmediatesOption; | |
| 311 } | |
| 312 | |
| 313 /// Set ClFlags::RandomizeAndPoolImmediatesThreshold to a new value | |
| 314 void setRandomizeAndPoolImmediatesThreshold(uint32_t Threshold) { | |
| 315 RandomizeAndPoolImmediatesThreshold = Threshold; | |
| 316 } | |
| 317 /// Get the value of ClFlags::RandomizeAndPoolImmediatesThreshold | |
| 318 uint32_t getRandomizeAndPoolImmediatesThreshold() const { | |
| 319 return RandomizeAndPoolImmediatesThreshold; | |
| 320 } | |
| 321 | |
| 322 /// Get the value of ClFlags::ReorderBasicBlocks | |
| 323 bool shouldReorderBasicBlocks() const { return ReorderBasicBlocks; } | |
| 324 /// Set ClFlags::ReorderBasicBlocks to a new value | |
| 325 void setShouldReorderBasicBlocks(bool NewValue) { | |
| 326 ReorderBasicBlocks = NewValue; | |
| 327 } | |
| 328 | |
| 329 /// Set ClFlags::ReorderFunctions to a new value | |
| 330 void setShouldReorderFunctions(bool Option) { ReorderFunctions = Option; } | |
| 331 /// Get the value of ClFlags::ReorderFunctions | |
| 332 bool shouldReorderFunctions() const { return ReorderFunctions; } | |
| 333 | |
| 334 /// Set ClFlags::ReorderFunctionsWindowSize to a new value | |
| 335 void setReorderFunctionsWindowSize(uint32_t Size) { | |
| 336 ReorderFunctionsWindowSize = Size; | |
| 337 } | |
| 338 /// Get the value of ClFlags::ReorderFunctionsWindowSize | |
| 339 uint32_t getReorderFunctionsWindowSize() const { | |
| 340 return ReorderFunctionsWindowSize; | |
| 341 } | |
| 342 | |
| 343 /// Set ClFlags::ReorderGlobalVariables to a new value | |
| 344 void setShouldReorderGlobalVariables(bool Option) { | |
| 345 ReorderGlobalVariables = Option; | |
| 346 } | |
| 347 /// Get the value of ClFlags::ReorderGlobalVariables | |
| 348 bool shouldReorderGlobalVariables() const { return ReorderGlobalVariables; } | |
| 349 | |
| 350 /// Set ClFlags::ReorderPooledConstants to a new value | |
| 351 void setShouldReorderPooledConstants(bool Option) { | |
| 352 ReorderPooledConstants = Option; | |
| 353 } | |
| 354 /// Get the value of ClFlags::ReorderPooledConstants | |
| 355 bool shouldReorderPooledConstants() const { return ReorderPooledConstants; } | |
| 356 | |
| 357 // IceString accessors. | |
| 358 | |
| 359 /// Get the value of ClFlags::DefaultFunctionPrefix | |
| 360 const IceString &getDefaultFunctionPrefix() const { | |
| 361 return DefaultFunctionPrefix; | |
| 362 } | |
| 363 /// Set ClFlags::DefaultFunctionPrefix to a new value | |
| 364 void setDefaultFunctionPrefix(const IceString &NewValue) { | |
| 365 DefaultFunctionPrefix = NewValue; | |
| 366 } | |
| 367 | |
| 368 /// Get the value of ClFlags::DefaultGlobalPrefix | |
| 369 const IceString &getDefaultGlobalPrefix() const { | |
| 370 return DefaultGlobalPrefix; | |
| 371 } | |
| 372 /// Set ClFlags::DefaultGlobalPrefix to a new value | |
| 373 void setDefaultGlobalPrefix(const IceString &NewValue) { | |
| 374 DefaultGlobalPrefix = NewValue; | |
| 375 } | |
| 376 | |
| 377 /// Get the value of ClFlags::TestPrefix | |
| 378 const IceString &getTestPrefix() const { return TestPrefix; } | |
| 379 /// Set ClFlags::TestPrefix to a new value | |
| 380 void setTestPrefix(const IceString &NewValue) { TestPrefix = NewValue; } | |
| 381 | |
| 382 /// Get the value of ClFlags::TimingFocusOn | |
| 383 const IceString &getTimingFocusOn() const { return TimingFocusOn; } | |
| 384 /// Set ClFlags::TimingFocusOn to a new value | |
| 385 void setTimingFocusOn(const IceString &NewValue) { TimingFocusOn = NewValue; } | |
| 386 | |
| 387 /// Get the value of ClFlags::TranslateOnly | |
| 388 const IceString &getTranslateOnly() const { return TranslateOnly; } | |
| 389 /// Set ClFlags::TranslateOnly to a new value | |
| 390 void setTranslateOnly(const IceString &NewValue) { TranslateOnly = NewValue; } | |
| 391 | |
| 392 /// Get the value of ClFlags::VerboseFocusOn | |
| 393 const IceString &getVerboseFocusOn() const { return VerboseFocusOn; } | |
| 394 /// Set ClFlags::VerboseFocusOns to a new value | |
| 395 void setVerboseFocusOn(const IceString &NewValue) { | |
| 396 VerboseFocusOn = NewValue; | |
| 397 } | |
| 398 | |
| 399 // size_t and 64-bit accessors. | |
| 400 | |
| 401 /// Get the value of ClFlags::NumTranslationThreads | |
| 402 size_t getNumTranslationThreads() const { return NumTranslationThreads; } | |
| 403 bool isSequential() const { return NumTranslationThreads == 0; } | |
| 404 /// Set ClFlags::NumTranslationThreads to a new value | |
| 405 void setNumTranslationThreads(size_t NewValue) { | |
| 406 NumTranslationThreads = NewValue; | |
| 407 } | |
| 408 | |
| 409 /// Get the value of ClFlags::RandomSeed | |
| 410 uint64_t getRandomSeed() const { return RandomSeed; } | |
| 411 /// Set ClFlags::RandomSeed to a new value | |
| 412 void setRandomSeed(size_t NewValue) { RandomSeed = NewValue; } | |
| 413 | |
| 414 private: | |
| 415 /// see anonymous_namespace{IceClFlags.cpp}::AllowErrorRecovery | |
| 416 bool AllowErrorRecovery; | |
| 417 /// see anonymous_namespace{IceClFlags.cpp}::AllowExternDefinedSymbols | |
| 418 bool AllowExternDefinedSymbols; | |
| 419 /// see anonymous_namespace{IceClFlags.cpp}::AllowIacaMarks | |
| 420 bool AllowIacaMarks; | |
| 421 /// see anonymous_namespace{IceClFlags.cpp}::AllowUninitializedGlobals | |
| 422 bool AllowUninitializedGlobals; | |
| 423 /// see anonymous_namespace{IceClFlags.cpp}::DataSections | |
| 424 bool DataSections; | |
| 425 /// see anonymous_namespace{IceClFlags.cpp}::DecorateAsm | |
| 426 bool DecorateAsm; | |
| 427 /// see anonymous_namespace{IceClFlags.cpp}::DisableHybridAssembly | |
| 428 bool DisableHybridAssembly; | |
| 429 /// see anonymous_namespace{IceClFlags.cpp}::DisableInternal | |
| 430 bool DisableInternal; | |
| 431 /// see anonymous_namespace{IceClFlags.cpp}::DisableTranslation | |
| 432 bool DisableTranslation; | |
| 433 /// see anonymous_namespace{IceClFlags.cpp}::DumpStats | |
| 434 bool DumpStats; | |
| 435 /// see anonymous_namespace{IceClFlags.cpp}::EnableBlockProfile | |
| 436 bool EnableBlockProfile; | |
| 437 /// see anonymous_namespace{IceClFlags.cpp}::ExcludedRegisters; | |
| 438 StringVector ExcludedRegisters; | |
| 439 /// see anonymous_namespace{IceClFlags.cpp}::ForceMemIntrinOpt | |
| 440 bool ForceMemIntrinOpt; | |
| 441 /// see anonymous_namespace{IceClFlags.cpp}::FunctionSections | |
| 442 bool FunctionSections; | |
| 443 /// Initialized to false; not set by the command line. | 151 /// Initialized to false; not set by the command line. |
| 444 bool GenerateUnitTestMessages; | 152 bool GenerateUnitTestMessages; |
| 445 /// see anonymous_namespace{IceClFlags.cpp}::KeepDeletedInsts | |
| 446 bool KeepDeletedInsts; | |
| 447 /// see anonymous_namespace{IceClFlags.cpp}::MockBoundsCheck | |
| 448 bool MockBoundsCheck; | |
| 449 /// see anonymous_namespace{IceClFlags.cpp}::EnablePhiEdgeSplit | |
| 450 bool PhiEdgeSplit; | |
| 451 /// see anonymous_namespace{IceClFlags.cpp}::ShouldDoNopInsertion | |
| 452 bool RandomNopInsertion; | |
| 453 /// see anonymous_namespace{IceClFlags.cpp}::RandomizeRegisterAllocation | |
| 454 bool RandomRegAlloc; | |
| 455 /// see anonymous_namespace{IceClFlags.cpp}::RegAllocReserve | |
| 456 bool RegAllocReserve; | |
| 457 /// see anonymous_namespace{IceClFlags.cpp}::RepeatRegAlloc | |
| 458 bool RepeatRegAlloc; | |
| 459 /// see anonymous_namespace{IceClFlags.cpp}::ReorderBasicBlocks | |
| 460 bool ReorderBasicBlocks; | |
| 461 /// see anonymous_namespace{IceClFlags.cpp}::ReorderFunctions | |
| 462 bool ReorderFunctions; | |
| 463 /// see anonymous_namespace{IceClFlags.cpp}::ReorderGlobalVariables | |
| 464 bool ReorderGlobalVariables; | |
| 465 /// see anonymous_namespace{IceClFlags.cpp}::ReorderPooledConstants | |
| 466 bool ReorderPooledConstants; | |
| 467 /// see anonymous_namespace{IceClFlags.cpp}::SkipUnimplemented | |
| 468 bool SkipUnimplemented; | |
| 469 /// see anonymous_namespace{IceClFlags.cpp}::SubzeroTimingEnabled | |
| 470 bool SubzeroTimingEnabled; | |
| 471 /// see anonymous_namespace{IceClFlags.cpp}::TimeEachFunction | |
| 472 bool TimeEachFunction; | |
| 473 /// see anonymous_namespace{IceClFlags.cpp}::UseNonsfi | |
| 474 bool UseNonsfi; | |
| 475 /// see anonymous_namespace{IceClFlags.cpp}::UseRegistrictedRegisters; | |
| 476 StringVector UseRestrictedRegisters; | |
| 477 /// see anonymous_namespace{IceClFlags.cpp}::UseSandboxing | |
| 478 bool UseSandboxing; | |
| 479 /// see anonymous_namespace{IceClFlags.cpp}::OLevel | |
| 480 OptLevel Opt; | |
| 481 /// see anonymous_namespace{IceClFlags.cpp}::OutFileType | |
| 482 FileType OutFileType; | |
| 483 /// see anonymous_namespace{IceClFlags.cpp}::RandomizeAndPoolImmediatesOption | |
| 484 RandomizeAndPoolImmediatesEnum RandomizeAndPoolImmediatesOption; | |
| 485 /// see | |
| 486 /// anonymous_namespace{IceClFlags.cpp}::RandomizeAndPoolImmediatesThreshold | |
| 487 uint32_t RandomizeAndPoolImmediatesThreshold; | |
| 488 /// see anonymous_namespace{IceClFlags.cpp}::MaxNopsPerInstruction | |
| 489 int RandomMaxNopsPerInstruction; | |
| 490 /// see anonymous_namespace{IceClFlags.cpp}::NopProbabilityAsPercentage | |
| 491 int RandomNopProbabilityAsPercentage; | |
| 492 /// see anonymous_namespace{IceClFlags.cpp}::ReorderFunctionsWindowSize | |
| 493 uint32_t ReorderFunctionsWindowSize; | |
| 494 /// see anonymous_namespace{IceClFlags.cpp}::TargetArch | |
| 495 TargetArch TArch; | |
| 496 /// see anonymous_namespace{IceClFlags.cpp}::TestStackExtra | |
| 497 uint32_t TestStackExtra; | |
| 498 /// see anonymous_namespace{IceClFlags.cpp}::TargetInstructionSet | |
| 499 TargetInstructionSet TInstrSet; | |
| 500 /// see anonymous_namespace{IceClFlags.cpp}::VerboseList | |
| 501 VerboseMask VMask; | |
| 502 /// see anonymous_namespace{IceClFlags.cpp}::DefaultFunctionPrefix | |
| 503 IceString DefaultFunctionPrefix; | |
| 504 /// see anonymous_namespace{IceClFlags.cpp}::DefaultGlobalPrefix | |
| 505 IceString DefaultGlobalPrefix; | |
| 506 /// see anonymous_namespace{IceClFlags.cpp}::TestPrefix | |
| 507 IceString TestPrefix; | |
| 508 /// see anonymous_namespace{IceClFlags.cpp}::TimingFocusOn | |
| 509 IceString TimingFocusOn; | |
| 510 /// see anonymous_namespace{IceClFlags.cpp}::TranslateOnly | |
| 511 IceString TranslateOnly; | |
| 512 /// see anonymous_namespace{IceClFlags.cpp}::VerboseFocusOn | |
| 513 IceString VerboseFocusOn; | |
| 514 /// see anonymous_namespace{IceClFlags.cpp}::NumThreads | |
| 515 | |
| 516 size_t NumTranslationThreads; // 0 means completely sequential | |
| 517 /// see anonymous_namespace{IceClFlags.cpp}::RandomSeed | |
| 518 uint64_t RandomSeed; | |
| 519 }; | 153 }; |
| 520 | 154 |
| 521 } // end of namespace Ice | 155 } // end of namespace Ice |
| 522 | 156 |
| 523 #endif // SUBZERO_SRC_ICECLFLAGS_H | 157 #endif // SUBZERO_SRC_ICECLFLAGS_H |
| OLD | NEW |