Debian Codegraph @

third_party/spirv-tools/source/fuzz/fuzzer_pass_flatten_conditional_branches.h

raw
1 // Copyright (c) 2020 Google LLC
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 SOURCE_FUZZ_FUZZER_PASS_FLATTEN_CONDITIONAL_BRANCHES_H
16 #define SOURCE_FUZZ_FUZZER_PASS_FLATTEN_CONDITIONAL_BRANCHES_H
17
18 #include "source/fuzz/fuzzer_pass.h"
19
20 namespace spvtools {
21 namespace fuzz {
22
23 class FuzzerPassFlattenConditionalBranches : public FuzzerPass {
24 public:
25 FuzzerPassFlattenConditionalBranches(
26 opt::IRContext* ir_context, TransformationContext* transformation_context,
27 FuzzerContext* fuzzer_context,
28 protobufs::TransformationSequence* transformations);
29
30 ~FuzzerPassFlattenConditionalBranches() override;
31
32 void Apply() override;
33
34 private:
35 // If the SPIR-V version requires vector OpSelects to be component-wise, or
36 // if |use_vector_select_if_optional| holds, |fresh_id_for_bvec_selector| is
37 // populated with a fresh id if it is currently zero, and a
38 // |vector_dimension|-dimensional boolean vector type is added to the module
39 // if not already present.
40 void PrepareForOpPhiOnVectors(uint32_t vector_dimension,
41 bool use_vector_select_if_optional,
42 uint32_t* fresh_id_for_bvec_selector);
43 };
44 } // namespace fuzz
45 } // namespace spvtools
46 #endif // SOURCE_FUZZ_FUZZER_PASS_FLATTEN_CONDITIONAL_BRANCHES_H