#include <iterator>
#include <limits>
#include <unordered_map>
+#include <vector>
#include "assembly_grammar.h"
#include "diagnostic.h"
#include "ext_inst.h"
#include "opcode.h"
#include "operand.h"
-#include "spirv-tools/libspirv.h"
+#include "spirv/1.1/spirv.h"
#include "spirv_constant.h"
#include "spirv_endian.h"
#define LIBSPIRV_BINARY_H_
#include "spirv-tools/libspirv.h"
-#include "spirv/1.1/spirv.h"
#include "spirv_definition.h"
// Functions
#define LIBSPIRV_DIAGNOSTIC_H_
#include <sstream>
-#include <utility>
+#include <string>
#include "spirv-tools/libspirv.hpp"
#include "spirv-tools/libspirv.hpp"
-#include "message.h"
#include "table.h"
namespace spvtools {
#include <string>
-#include "spirv-tools/libspirv.hpp"
+#include "spirv-tools/libspirv.h"
namespace spvtools {
#include <memory>
#include <string>
-#include <vector>
#include "module.h"
#include "spirv-tools/libspirv.hpp"
#ifndef LIBSPIRV_OPT_CONSTANTS_H_
#define LIBSPIRV_OPT_CONSTANTS_H_
-#include <cassert>
#include <memory>
+#include <utility>
#include <vector>
#include "make_unique.h"
#include "def_use_manager.h"
-#include <functional>
-
-#include "instruction.h"
#include "log.h"
-#include "module.h"
#include "reflect.h"
namespace spvtools {
#include <list>
#include <unordered_map>
-#include <utility>
#include <vector>
#include "instruction.h"
-#include "message.h"
#include "module.h"
+#include "spirv-tools/libspirv.hpp"
namespace spvtools {
namespace opt {
#include "fold_spec_constant_op_and_composite_pass.h"
+#include <algorithm>
#include <initializer_list>
-#include <memory>
#include <tuple>
-#include <unordered_map>
#include "constants.h"
#include "make_unique.h"
type_mgr_(nullptr),
id_to_const_val_() {}
+Pass::Status FoldSpecConstantOpAndCompositePass::Process(ir::Module* module) {
+ Initialize(module);
+ return ProcessImpl(module);
+}
+
+void FoldSpecConstantOpAndCompositePass::Initialize(ir::Module* module) {
+ type_mgr_.reset(new analysis::TypeManager(consumer(), *module));
+ def_use_mgr_.reset(new analysis::DefUseManager(consumer(), module));
+ for (const auto& id_def : def_use_mgr_->id_to_defs()) {
+ max_id_ = std::max(max_id_, id_def.first);
+ }
+ module_ = module;
+};
+
Pass::Status FoldSpecConstantOpAndCompositePass::ProcessImpl(
ir::Module* module) {
bool modified = false;
#ifndef LIBSPIRV_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_
#define LIBSPIRV_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_
-#include <algorithm>
#include <memory>
#include <unordered_map>
#include <vector>
FoldSpecConstantOpAndCompositePass();
const char* name() const override { return "fold-spec-const-op-composite"; }
- Status Process(ir::Module* module) override {
- Initialize(module);
- return ProcessImpl(module);
- };
+
+ Status Process(ir::Module* module) override;
private:
// Initializes the type manager, def-use manager and get the maximal id used
// in the module.
- void Initialize(ir::Module* module) {
- type_mgr_.reset(new analysis::TypeManager(consumer(), *module));
- def_use_mgr_.reset(new analysis::DefUseManager(consumer(), module));
- for (const auto& id_def : def_use_mgr_->id_to_defs()) {
- max_id_ = std::max(max_id_, id_def.first);
- }
- module_ = module;
- };
+ void Initialize(ir::Module* module);
// The real entry of processing. Iterates through the types-constants-globals
// section of the given module, finds the Spec Constants defined with
#include "instruction.h"
-#include <cassert>
#include <initializer_list>
#include "reflect.h"
#include "basic_block.h"
#include "instruction.h"
-#include "message.h"
#include "module.h"
-#include "spirv-tools/libspirv.h"
+#include "spirv-tools/libspirv.hpp"
namespace spvtools {
namespace ir {
#ifndef LIBSPIRV_OPT_ITERATOR_H_
#define LIBSPIRV_OPT_ITERATOR_H_
+#include <cstddef> // for ptrdiff_t
#include <iterator>
#include <memory>
#include <type_traits>
// std::vector<|ValueType|>.
template <typename ValueType, bool IsConst = false>
class UptrVectorIterator
- : public std::iterator<
- std::random_access_iterator_tag,
- typename std::conditional<IsConst, const ValueType, ValueType>::type,
- ptrdiff_t> {
+ : public std::iterator<std::random_access_iterator_tag,
+ typename std::conditional<IsConst, const ValueType,
+ ValueType>::type> {
public:
using super = std::iterator<
std::random_access_iterator_tag,
#include <utility>
#include <vector>
-#include "message.h"
+#include "spirv-tools/libspirv.hpp"
// Asserts the given condition is true. Otherwise, sends a message to the
// consumer and exits the problem with failure code. Accepts the following
#ifndef LIBSPIRV_OPT_PASS_H_
#define LIBSPIRV_OPT_PASS_H_
-#include <memory>
+#include <utility>
-#include "message.h"
#include "module.h"
+#include "spirv-tools/libspirv.hpp"
namespace spvtools {
namespace opt {
#include <vector>
#include "log.h"
-#include "message.h"
#include "module.h"
#include "pass.h"
+#include "spirv-tools/libspirv.hpp"
+
namespace spvtools {
namespace opt {
#include <cctype>
#include <cstring>
-#include <string>
#include <tuple>
-#include <unordered_map>
#include <vector>
-#include "spirv-tools/libspirv.h"
-#include "util/parse_number.h"
-
#include "def_use_manager.h"
#include "make_unique.h"
+#include "spirv-tools/libspirv.h"
#include "type_manager.h"
#include "types.h"
+#include "util/parse_number.h"
namespace spvtools {
namespace opt {
// See the License for the specific language governing permissions and
// limitations under the License.
-#include <algorithm>
+#include "type_manager.h"
+
+#include <utility>
#include "log.h"
#include "reflect.h"
-#include "type_manager.h"
namespace spvtools {
namespace opt {
#include <memory>
#include <unordered_map>
#include <unordered_set>
+#include <vector>
-#include "message.h"
#include "module.h"
+#include "spirv-tools/libspirv.hpp"
#include "types.h"
namespace spvtools {
#include "table.h"
-#include <cstdlib>
+#include <utility>
spv_context spvContextCreate(spv_target_env env) {
switch (env) {
#include "enum_set.h"
#include "message.h"
-#include "spirv-tools/libspirv.h"
+#include "spirv-tools/libspirv.hpp"
namespace libspirv {