Coverage Report

Created: 2023-03-01 07:33

/src/spirv-tools/source/opt/fix_func_call_arguments.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2022 Advanced Micro Devices, Inc.
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 _VAR_FUNC_CALL_PASS_H
16
#define _VAR_FUNC_CALL_PASS_H
17
18
#include "source/opt/pass.h"
19
20
namespace spvtools {
21
namespace opt {
22
class FixFuncCallArgumentsPass : public Pass {
23
 public:
24
0
  FixFuncCallArgumentsPass() {}
25
0
  const char* name() const override { return "fix-for-funcall-param"; }
26
  Status Process() override;
27
  // Returns true if the module has one one function.
28
  bool ModuleHasASingleFunction();
29
  // Copies from the memory pointed to by |operand_inst| to a new function scope
30
  // variable created before |func_call_inst|, and
31
  // copies the value of the new variable back to the memory pointed to by
32
  // |operand_inst| after |funct_call_inst|  Returns the id of
33
  // the new variable.
34
  uint32_t ReplaceAccessChainFuncCallArguments(Instruction* func_call_inst,
35
                                               Instruction* operand_inst);
36
37
  // Fix function call |func_call_inst| non memory object arguments
38
  bool FixFuncCallArguments(Instruction* func_call_inst);
39
40
0
  IRContext::Analysis GetPreservedAnalyses() override {
41
0
    return IRContext::kAnalysisTypes;
42
0
  }
43
};
44
}  // namespace opt
45
}  // namespace spvtools
46
47
#endif  // _VAR_FUNC_CALL_PASS_H