• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The Tint Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SRC_TRANSFORM_REMOVE_PHONIES_H_
16 #define SRC_TRANSFORM_REMOVE_PHONIES_H_
17 
18 #include <string>
19 #include <unordered_map>
20 
21 #include "src/transform/transform.h"
22 
23 namespace tint {
24 namespace transform {
25 
26 /// RemovePhonies is a Transform that removes all phony-assignment statements,
27 /// while preserving function call expressions in the RHS of the assignment that
28 /// may have side-effects.
29 class RemovePhonies : public Castable<RemovePhonies, Transform> {
30  public:
31   /// Constructor
32   RemovePhonies();
33 
34   /// Destructor
35   ~RemovePhonies() override;
36 
37  protected:
38   /// Runs the transform using the CloneContext built for transforming a
39   /// program. Run() is responsible for calling Clone() on the CloneContext.
40   /// @param ctx the CloneContext primed with the input program and
41   /// ProgramBuilder
42   /// @param inputs optional extra transform-specific input data
43   /// @param outputs optional extra transform-specific output data
44   void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) override;
45 };
46 
47 }  // namespace transform
48 }  // namespace tint
49 
50 #endif  // SRC_TRANSFORM_REMOVE_PHONIES_H_
51