blob: 774a40f9d74af6a8867e617ba495bd67dfd8f988 [file] [log] [blame]
Karl Schimpf8d7abae2014-07-07 14:50:30 -07001//===- 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 Schimpf5ee234a2014-09-12 10:41:40 -070017#include "IceTypes.def"
18
Karl Schimpf8d7abae2014-07-07 14:50:30 -070019namespace Ice {
20
21class ClFlags {
Karl Schimpfdf80eb82015-02-09 14:20:22 -080022 ClFlags(const ClFlags &) = delete;
23 ClFlags &operator=(const ClFlags &) = delete;
24
Karl Schimpf8d7abae2014-07-07 14:50:30 -070025public:
26 ClFlags()
Karl Schimpfdf80eb82015-02-09 14:20:22 -080027 : // 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
147private:
148 bool AllowErrorRecovery;
149 bool AllowUninitializedGlobals;
Karl Schimpfe3f64d02014-10-07 10:38:22 -0700150 bool DataSections;
Karl Schimpfdf80eb82015-02-09 14:20:22 -0800151 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 Voung08c3bcd2014-12-01 17:55:16 -0800162 bool UseELFWriter;
Jan Voung8acded02014-09-22 18:02:25 -0700163 bool UseIntegratedAssembler;
Jim Stichnothbfb03e52014-08-26 10:29:05 -0700164 bool UseSandboxing;
Karl Schimpfdf80eb82015-02-09 14:20:22 -0800165
Karl Schimpf5ee234a2014-09-12 10:41:40 -0700166 IceString DefaultFunctionPrefix;
Karl Schimpfdf80eb82015-02-09 14:20:22 -0800167 IceString DefaultGlobalPrefix;
Jim Stichnoth8363a062014-10-07 10:02:38 -0700168 IceString TimingFocusOn;
Jim Stichnoth088b2be2014-10-23 12:02:08 -0700169 IceString TranslateOnly;
Karl Schimpfdf80eb82015-02-09 14:20:22 -0800170 IceString VerboseFocusOn;
171
172 size_t NumTranslationThreads; // 0 means completely sequential
Karl Schimpf8d7abae2014-07-07 14:50:30 -0700173};
Jim Stichnoth989a7032014-08-08 10:13:44 -0700174
175} // end of namespace Ice
Karl Schimpf8d7abae2014-07-07 14:50:30 -0700176
177#endif // SUBZERO_SRC_ICECLFLAGS_H