@@ -124,97 +124,6 @@ class PreservedCFGCheckerInstrumentation {
124
124
void registerCallbacks (PassInstrumentationCallbacks &PIC);
125
125
};
126
126
127
- // Base class for classes that report changes to the IR.
128
- // It presents an interface for such classes and provides calls
129
- // on various events as the new pass manager transforms the IR.
130
- // It also provides filtering of information based on hidden options
131
- // specifying which functions are interesting.
132
- // Calls are made for the following events/queries:
133
- // 1. The initial IR processed.
134
- // 2. To get the representation of the IR (of type \p T).
135
- // 3. When a pass does not change the IR.
136
- // 4. When a pass changes the IR (given both before and after representations
137
- // of type \p T).
138
- // 5. When an IR is invalidated.
139
- // 6. When a pass is run on an IR that is not interesting (based on options).
140
- // 7. When a pass is ignored (pass manager or adapter pass).
141
- // 8. To compare two IR representations (of type \p T).
142
- template <typename IRUnitT> class ChangePrinter {
143
- protected:
144
- ChangePrinter () : InitialIR(true ) {}
145
-
146
- public:
147
- virtual ~ChangePrinter ();
148
-
149
- // Determine if this pass/IR is interesting and if so, save the IR
150
- // otherwise it is left on the stack without data
151
- void saveIRBeforePass (Any IR, StringRef PassID);
152
- // Compare the IR from before the pass after the pass.
153
- void handleIRAfterPass (Any IR, StringRef PassID);
154
- // Handle the situation where a pass is invalidated.
155
- void handleInvalidatedPass (StringRef PassID);
156
-
157
- protected:
158
- // called on the first IR processed
159
- virtual void handleInitialIR (Any IR) = 0;
160
- // called before and after a pass to get the representation of the IR
161
- virtual void generateIRRepresentation (Any IR, StringRef PassID,
162
- IRUnitT &Output) = 0;
163
- // called when the pass is not iteresting
164
- virtual void omitAfter (StringRef PassID, std::string &Name) = 0;
165
- // called when an interesting IR has changed
166
- virtual void handleAfter (StringRef PassID, std::string &Name,
167
- const IRUnitT &Before, const IRUnitT &After,
168
- Any) = 0;
169
- // called when an interesting pass is invalidated
170
- virtual void handleInvalidated (StringRef PassID) = 0;
171
- // called when the IR or pass is not interesting
172
- virtual void handleFiltered (StringRef PassID, std::string &Name) = 0;
173
- // called when an ignored pass is encountered
174
- virtual void handleIgnored (StringRef PassID, std::string &Name) = 0;
175
- // called to compare the before and after representations of the IR
176
- virtual bool same (const IRUnitT &Before, const IRUnitT &After) = 0;
177
-
178
- // stack of IRs before passes
179
- std::vector<IRUnitT> BeforeStack;
180
- // Is this the first IR seen?
181
- bool InitialIR;
182
- };
183
-
184
- // A change printer based on the string representation of the IR as created
185
- // by unwrapAndPrint. The string representation is stored in a std::string
186
- // to preserve it as the IR changes in each pass. Note that the banner is
187
- // included in this representation but it is massaged before reporting.
188
- class IRChangePrinter : public ChangePrinter <std::string> {
189
- public:
190
- IRChangePrinter ();
191
- ~IRChangePrinter () override ;
192
- void registerCallbacks (PassInstrumentationCallbacks &PIC);
193
-
194
- protected:
195
- // called on the first IR processed
196
- void handleInitialIR (Any IR) override ;
197
- // called before and after a pass to get the representation of the IR
198
- void generateIRRepresentation (Any IR, StringRef PassID,
199
- std::string &Output) override ;
200
- // called when the pass is not iteresting
201
- void omitAfter (StringRef PassID, std::string &Name) override ;
202
- // called when an interesting IR has changed
203
- void handleAfter (StringRef PassID, std::string &Name,
204
- const std::string &Before, const std::string &After,
205
- Any) override ;
206
- // called when an interesting pass is invalidated
207
- void handleInvalidated (StringRef PassID) override ;
208
- // called when the IR or pass is not interesting
209
- void handleFiltered (StringRef PassID, std::string &Name) override ;
210
- // called when an ignored pass is encountered
211
- void handleIgnored (StringRef PassID, std::string &Name) override ;
212
- // called to compare the before and after representations of the IR
213
- bool same (const std::string &Before, const std::string &After) override ;
214
-
215
- raw_ostream &Out;
216
- };
217
-
218
127
// / This class provides an interface to register all the standard pass
219
128
// / instrumentations and manages their state (if any).
220
129
class StandardInstrumentations {
@@ -223,7 +132,6 @@ class StandardInstrumentations {
223
132
TimePassesHandler TimePasses;
224
133
OptNoneInstrumentation OptNone;
225
134
PreservedCFGCheckerInstrumentation PreservedCFGChecker;
226
- IRChangePrinter PrintChangedIR;
227
135
228
136
public:
229
137
StandardInstrumentations (bool DebugLogging) : PrintPass(DebugLogging) {}
0 commit comments