| 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 |
#include "source/fuzz/transformation_compute_data_synonym_fact_closure.h" |
| 16 |
|
| 17 |
namespace spvtools { |
| 18 |
namespace fuzz { |
| 19 |
|
| 20 |
TransformationComputeDataSynonymFactClosure:: |
| 21 |
TransformationComputeDataSynonymFactClosure( |
| 22 |
const spvtools::fuzz::protobufs:: |
| 23 |
TransformationComputeDataSynonymFactClosure& message) |
| 24 |
: message_(message) {} |
| 25 |
|
| 26 |
TransformationComputeDataSynonymFactClosure:: |
| 27 |
TransformationComputeDataSynonymFactClosure( |
| 28 |
uint32_t maximum_equivalence_class_size) { |
| 29 |
message_.set_maximum_equivalence_class_size(maximum_equivalence_class_size); |
| 30 |
} |
| 31 |
|
| 32 |
bool TransformationComputeDataSynonymFactClosure::IsApplicable( |
| 33 |
opt::IRContext* /*unused*/, const TransformationContext& /*unused*/) const { |
| 34 |
return true; |
| 35 |
} |
| 36 |
|
| 37 |
void TransformationComputeDataSynonymFactClosure::Apply( |
| 38 |
opt::IRContext* /*unused*/, |
| 39 |
TransformationContext* transformation_context) const { |
| 40 |
transformation_context->GetFactManager()->ComputeClosureOfFacts( |
| 41 |
message_.maximum_equivalence_class_size()); |
| 42 |
} |
| 43 |
|
| 44 |
protobufs::Transformation |
| 45 |
TransformationComputeDataSynonymFactClosure::ToMessage() const { |
| 46 |
protobufs::Transformation result; |
| 47 |
*result.mutable_compute_data_synonym_fact_closure() = message_; |
| 48 |
return result; |
| 49 |
} |
| 50 |
|
| 51 |
std::unordered_set<uint32_t> |
| 52 |
TransformationComputeDataSynonymFactClosure::GetFreshIds() const { |
| 53 |
return std::unordered_set<uint32_t>(); |
| 54 |
} |
| 55 |
|
| 56 |
} // namespace fuzz |
| 57 |
} // namespace spvtools |