// Copyright (c) 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef SOURCE_OPT_VALUE_NUMBER_TABLE_H_ #define SOURCE_OPT_VALUE_NUMBER_TABLE_H_ #include <cstdint> #include <unordered_map> #include "source/opt/instruction.h" namespace spvtools { namespace opt { class IRContext; // Returns true if the two instructions compute the same value. Used by the // value number table to compare two instructions. class ComputeSameValue { … }; // The hash function used in the value number table. class ValueTableHash { … }; // This class implements the value number analysis. It is using a hash-based // approach to value numbering. It is essentially doing dominator-tree value // numbering described in // // Preston Briggs, Keith D. Cooper, and L. Taylor Simpson. 1997. Value // numbering. Softw. Pract. Exper. 27, 6 (June 1997), 701-724. // https://www.cs.rice.edu/~keith/Promo/CRPC-TR94517.pdf.gz // // The main difference is that because we do not perform redundancy elimination // as we build the value number table, we do not have to deal with cleaning up // the scope. class ValueNumberTable { … }; } // namespace opt } // namespace spvtools #endif // SOURCE_OPT_VALUE_NUMBER_TABLE_H_