Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: src/IceClFlags.h

Issue 1024203002: Move some flag-like props from GlobalContext and TargetLowering to ClFlags. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review / clean up formatting Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceELFObjectWriter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file declares command line flags controlling translation. 10 // This file declares command line flags controlling translation.
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 #ifndef SUBZERO_SRC_ICECLFLAGS_H 14 #ifndef SUBZERO_SRC_ICECLFLAGS_H
15 #define SUBZERO_SRC_ICECLFLAGS_H 15 #define SUBZERO_SRC_ICECLFLAGS_H
16 16
17 #include "IceTypes.def" 17 #include "IceTypes.h"
18 18
19 namespace Ice { 19 namespace Ice {
20 20
21 class ClFlags { 21 class ClFlags {
22 ClFlags(const ClFlags &) = delete; 22 ClFlags(const ClFlags &) = delete;
23 ClFlags &operator=(const ClFlags &) = delete; 23 ClFlags &operator=(const ClFlags &) = delete;
24 24
25 public: 25 public:
26 ClFlags() 26 ClFlags()
27 : // bool fields. 27 : // bool fields.
28 AllowErrorRecovery(false), 28 AllowErrorRecovery(false),
29 AllowUninitializedGlobals(false), DataSections(false), 29 AllowUninitializedGlobals(false), DataSections(false),
30 DecorateAsm(false), DisableInternal(false), DisableIRGeneration(false), 30 DecorateAsm(false), DisableInternal(false), DisableIRGeneration(false),
31 DisableTranslation(false), DumpStats(false), FunctionSections(false), 31 DisableTranslation(false), DumpStats(false), FunctionSections(false),
32 GenerateUnitTestMessages(false), PhiEdgeSplit(false), 32 GenerateUnitTestMessages(false), PhiEdgeSplit(false),
33 RandomNopInsertion(false), RandomRegAlloc(false),
33 SubzeroTimingEnabled(false), TimeEachFunction(false), 34 SubzeroTimingEnabled(false), TimeEachFunction(false),
34 UseSandboxing(false), 35 UseSandboxing(false),
35 // FileType field 36 // Enum and integer fields
36 OutFileType(FT_Iasm), 37 Opt(Opt_m1), OutFileType(FT_Iasm), RandomMaxNopsPerInstruction(0),
38 RandomNopProbabilityAsPercentage(0), TArch(TargetArch_NUM),
39 VMask(IceV_None),
37 // IceString fields. 40 // IceString fields.
38 DefaultFunctionPrefix(""), DefaultGlobalPrefix(""), TimingFocusOn(""), 41 DefaultFunctionPrefix(""), DefaultGlobalPrefix(""), TestPrefix(""),
39 TranslateOnly(""), VerboseFocusOn(""), 42 TimingFocusOn(""), TranslateOnly(""), VerboseFocusOn(""),
40 // size_t fields. 43 // size_t and 64-bit fields.
41 NumTranslationThreads(0) {} 44 NumTranslationThreads(0), RandomSeed(0) {}
42 45
43 // bool accessors. 46 // bool accessors.
44 47
45 bool getAllowErrorRecovery() const { return AllowErrorRecovery; } 48 bool getAllowErrorRecovery() const { return AllowErrorRecovery; }
46 void setAllowErrorRecovery(bool NewValue) { AllowErrorRecovery = NewValue; } 49 void setAllowErrorRecovery(bool NewValue) { AllowErrorRecovery = NewValue; }
47 50
48 bool getAllowUninitializedGlobals() const { 51 bool getAllowUninitializedGlobals() const {
49 return AllowUninitializedGlobals; 52 return AllowUninitializedGlobals;
50 } 53 }
51 void setAllowUninitializedGlobals(bool NewValue) { 54 void setAllowUninitializedGlobals(bool NewValue) {
(...skipping 28 matching lines...) Expand all
80 // will not be readable. Hence, turn off. 83 // will not be readable. Hence, turn off.
81 return !ALLOW_DUMP || GenerateUnitTestMessages; 84 return !ALLOW_DUMP || GenerateUnitTestMessages;
82 } 85 }
83 void setGenerateUnitTestMessages(bool NewValue) { 86 void setGenerateUnitTestMessages(bool NewValue) {
84 GenerateUnitTestMessages = NewValue; 87 GenerateUnitTestMessages = NewValue;
85 } 88 }
86 89
87 bool getPhiEdgeSplit() const { return PhiEdgeSplit; } 90 bool getPhiEdgeSplit() const { return PhiEdgeSplit; }
88 void setPhiEdgeSplit(bool NewValue) { PhiEdgeSplit = NewValue; } 91 void setPhiEdgeSplit(bool NewValue) { PhiEdgeSplit = NewValue; }
89 92
93 bool shouldDoNopInsertion() const { return RandomNopInsertion; }
94 void setShouldDoNopInsertion(bool NewValue) { RandomNopInsertion = NewValue; }
95
96 bool shouldRandomizeRegAlloc() const { return RandomRegAlloc; }
97 void setShouldRandomizeRegAlloc(bool NewValue) { RandomRegAlloc = NewValue; }
98
90 bool getSubzeroTimingEnabled() const { return SubzeroTimingEnabled; } 99 bool getSubzeroTimingEnabled() const { return SubzeroTimingEnabled; }
91 void setSubzeroTimingEnabled(bool NewValue) { 100 void setSubzeroTimingEnabled(bool NewValue) {
92 SubzeroTimingEnabled = NewValue; 101 SubzeroTimingEnabled = NewValue;
93 } 102 }
94 103
95 bool getTimeEachFunction() const { return ALLOW_DUMP && TimeEachFunction; } 104 bool getTimeEachFunction() const { return ALLOW_DUMP && TimeEachFunction; }
96 void setTimeEachFunction(bool NewValue) { TimeEachFunction = NewValue; } 105 void setTimeEachFunction(bool NewValue) { TimeEachFunction = NewValue; }
97 106
98 bool getUseSandboxing() const { return UseSandboxing; } 107 bool getUseSandboxing() const { return UseSandboxing; }
99 void setUseSandboxing(bool NewValue) { UseSandboxing = NewValue; } 108 void setUseSandboxing(bool NewValue) { UseSandboxing = NewValue; }
100 109
101 // FileType accessor. 110 // Enum and integer accessors.
111 OptLevel getOptLevel() const { return Opt; }
112 void setOptLevel(OptLevel NewValue) { Opt = NewValue; }
113
102 FileType getOutFileType() const { return OutFileType; } 114 FileType getOutFileType() const { return OutFileType; }
103 void setOutFileType(FileType NewValue) { OutFileType = NewValue; } 115 void setOutFileType(FileType NewValue) { OutFileType = NewValue; }
104 116
117 int getMaxNopsPerInstruction() const { return RandomMaxNopsPerInstruction; }
118 void setMaxNopsPerInstruction(int NewValue) {
119 RandomMaxNopsPerInstruction = NewValue;
120 }
121
122 int getNopProbabilityAsPercentage() const {
123 return RandomNopProbabilityAsPercentage;
124 }
125 void setNopProbabilityAsPercentage(int NewValue) {
126 RandomNopProbabilityAsPercentage = NewValue;
127 }
128
129 TargetArch getTargetArch() const { return TArch; }
130 void setTargetArch(TargetArch NewValue) { TArch = NewValue; }
131
132 TargetInstructionSet getTargetInstructionSet() const { return TInstrSet; }
133 void setTargetInstructionSet(TargetInstructionSet NewValue) {
134 TInstrSet = NewValue;
135 }
136
137 VerboseMask getVerbose() const { return ALLOW_DUMP ? VMask : IceV_None; }
138 void setVerbose(VerboseMask NewValue) { VMask = NewValue; }
139
105 // IceString accessors. 140 // IceString accessors.
106 141
107 const IceString &getDefaultFunctionPrefix() const { 142 const IceString &getDefaultFunctionPrefix() const {
108 return DefaultFunctionPrefix; 143 return DefaultFunctionPrefix;
109 } 144 }
110 void setDefaultFunctionPrefix(const IceString &NewValue) { 145 void setDefaultFunctionPrefix(const IceString &NewValue) {
111 DefaultFunctionPrefix = NewValue; 146 DefaultFunctionPrefix = NewValue;
112 } 147 }
113 148
114 const IceString &getDefaultGlobalPrefix() const { 149 const IceString &getDefaultGlobalPrefix() const {
115 return DefaultGlobalPrefix; 150 return DefaultGlobalPrefix;
116 } 151 }
117 void setDefaultGlobalPrefix(const IceString &NewValue) { 152 void setDefaultGlobalPrefix(const IceString &NewValue) {
118 DefaultGlobalPrefix = NewValue; 153 DefaultGlobalPrefix = NewValue;
119 } 154 }
120 155
156 const IceString &getTestPrefix() const { return TestPrefix; }
157 void setTestPrefix(const IceString &NewValue) { TestPrefix = NewValue; }
158
121 const IceString &getTimingFocusOn() const { return TimingFocusOn; } 159 const IceString &getTimingFocusOn() const { return TimingFocusOn; }
122 void setTimingFocusOn(const IceString &NewValue) { TimingFocusOn = NewValue; } 160 void setTimingFocusOn(const IceString &NewValue) { TimingFocusOn = NewValue; }
123 161
124 const IceString &getTranslateOnly() const { return TranslateOnly; } 162 const IceString &getTranslateOnly() const { return TranslateOnly; }
125 void setTranslateOnly(const IceString &NewValue) { TranslateOnly = NewValue; } 163 void setTranslateOnly(const IceString &NewValue) { TranslateOnly = NewValue; }
126 164
127 const IceString &getVerboseFocusOn() const { return VerboseFocusOn; } 165 const IceString &getVerboseFocusOn() const { return VerboseFocusOn; }
128 void setVerboseFocusOn(const IceString &NewValue) { 166 void setVerboseFocusOn(const IceString &NewValue) {
129 VerboseFocusOn = NewValue; 167 VerboseFocusOn = NewValue;
130 } 168 }
131 169
132 // size_t accessors. 170 // size_t and 64-bit accessors.
133 171
134 size_t getNumTranslationThreads() const { return NumTranslationThreads; } 172 size_t getNumTranslationThreads() const { return NumTranslationThreads; }
135 bool isSequential() const { return NumTranslationThreads == 0; } 173 bool isSequential() const { return NumTranslationThreads == 0; }
136 void setNumTranslationThreads(size_t NewValue) { 174 void setNumTranslationThreads(size_t NewValue) {
137 NumTranslationThreads = NewValue; 175 NumTranslationThreads = NewValue;
138 } 176 }
139 177
178 uint64_t getRandomSeed() const { return RandomSeed; }
179 void setRandomSeed(size_t NewValue) { RandomSeed = NewValue; }
180
140 private: 181 private:
141 bool AllowErrorRecovery; 182 bool AllowErrorRecovery;
142 bool AllowUninitializedGlobals; 183 bool AllowUninitializedGlobals;
143 bool DataSections; 184 bool DataSections;
144 bool DecorateAsm; 185 bool DecorateAsm;
145 bool DisableInternal; 186 bool DisableInternal;
146 bool DisableIRGeneration; 187 bool DisableIRGeneration;
147 bool DisableTranslation; 188 bool DisableTranslation;
148 bool DumpStats; 189 bool DumpStats;
149 bool FunctionSections; 190 bool FunctionSections;
150 bool GenerateUnitTestMessages; 191 bool GenerateUnitTestMessages;
151 bool PhiEdgeSplit; 192 bool PhiEdgeSplit;
193 bool RandomNopInsertion;
194 bool RandomRegAlloc;
152 bool SubzeroTimingEnabled; 195 bool SubzeroTimingEnabled;
153 bool TimeEachFunction; 196 bool TimeEachFunction;
154 bool UseSandboxing; 197 bool UseSandboxing;
155 198
199 OptLevel Opt;
156 FileType OutFileType; 200 FileType OutFileType;
201 int RandomMaxNopsPerInstruction;
202 int RandomNopProbabilityAsPercentage;
203 TargetArch TArch;
204 TargetInstructionSet TInstrSet;
205 VerboseMask VMask;
157 206
158 IceString DefaultFunctionPrefix; 207 IceString DefaultFunctionPrefix;
159 IceString DefaultGlobalPrefix; 208 IceString DefaultGlobalPrefix;
209 IceString TestPrefix;
160 IceString TimingFocusOn; 210 IceString TimingFocusOn;
161 IceString TranslateOnly; 211 IceString TranslateOnly;
162 IceString VerboseFocusOn; 212 IceString VerboseFocusOn;
163 213
164 size_t NumTranslationThreads; // 0 means completely sequential 214 size_t NumTranslationThreads; // 0 means completely sequential
215 uint64_t RandomSeed;
165 }; 216 };
166 217
167 } // end of namespace Ice 218 } // end of namespace Ice
168 219
169 #endif // SUBZERO_SRC_ICECLFLAGS_H 220 #endif // SUBZERO_SRC_ICECLFLAGS_H
OLDNEW
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceELFObjectWriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698