2
0

fuzzer_pass_flatten_conditional_branches.h 1.8 KB

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