format: apply clang format Signed-off-by: Nathan Gauër <brioche@google.com>
diff --git a/include/spirv-tools/linker.hpp b/include/spirv-tools/linker.hpp index d2f3e72..cd6df7e 100644 --- a/include/spirv-tools/linker.hpp +++ b/include/spirv-tools/linker.hpp
@@ -16,7 +16,6 @@ #define INCLUDE_SPIRV_TOOLS_LINKER_HPP_ #include <cstdint> - #include <memory> #include <vector>
diff --git a/source/diff/diff.cpp b/source/diff/diff.cpp index 7ed41de..01fb7a4 100644 --- a/source/diff/diff.cpp +++ b/source/diff/diff.cpp
@@ -1416,7 +1416,6 @@ GroupIdsAndMatch<std::string>( src, dst, "", &Differ::GetSanitizedName, [this](const IdGroup& src_group, const IdGroup& dst_group) { - // Match only if there's a unique forward declaration with this debug // name. if (src_group.size() == 1 && dst_group.size() == 1) { @@ -1595,7 +1594,6 @@ GroupIdsAndMatch<std::string>( src_params, dst_params, "", &Differ::GetSanitizedName, [this](const IdGroup& src_group, const IdGroup& dst_group) { - // There shouldn't be two parameters with the same name, so the ids // should match. There is nothing restricting the SPIR-V however to have // two parameters with the same name, so be resilient against that. @@ -1610,7 +1608,6 @@ src_params, dst_params, 0, &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) { - const size_t shared_param_count = std::min(src_group_by_type_id.size(), dst_group_by_type_id.size()); @@ -2121,7 +2118,6 @@ &Differ::GroupIdsHelperGetTypePointerStorageClass, [this](const IdGroup& src_group_by_storage_class, const IdGroup& dst_group_by_storage_class) { - // Group them further by the type they are pointing to and loop over // them. GroupIdsAndMatch<SpvOp>( @@ -2129,7 +2125,6 @@ &Differ::GroupIdsHelperGetTypePointerTypeOp, [this](const IdGroup& src_group_by_type_op, const IdGroup& dst_group_by_type_op) { - // Group them even further by debug info, if possible and match by // debug name. MatchTypeForwardPointersByName(src_group_by_type_op, @@ -2373,7 +2368,6 @@ GroupIdsAndMatch<std::string>( src_func_ids, dst_func_ids, "", &Differ::GetSanitizedName, [this](const IdGroup& src_group, const IdGroup& dst_group) { - // If there is a single function with this name in src and dst, it's a // definite match. if (src_group.size() == 1 && dst_group.size() == 1) { @@ -2387,7 +2381,6 @@ &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) { - if (src_group_by_type_id.size() == 1 && dst_group_by_type_id.size() == 1) { id_map_.MapIds(src_group_by_type_id[0], @@ -2432,7 +2425,6 @@ src_func_ids, dst_func_ids, 0, &Differ::GroupIdsHelperGetTypeId, [this](const IdGroup& src_group_by_type_id, const IdGroup& dst_group_by_type_id) { - BestEffortMatchFunctions(src_group_by_type_id, dst_group_by_type_id, src_func_insts_, dst_func_insts_); });
diff --git a/source/ext_inst.cpp b/source/ext_inst.cpp index 4e27954..1818dda 100644 --- a/source/ext_inst.cpp +++ b/source/ext_inst.cpp
@@ -20,19 +20,16 @@ // See https://www.khronos.org/registry/spir-v/specs/1.0/DebugInfo.html // TODO(dneto): DebugInfo.h should probably move to SPIRV-Headers. #include "DebugInfo.h" - -#include "source/latest_version_glsl_std_450_header.h" -#include "source/latest_version_opencl_std_header.h" -#include "source/macro.h" -#include "source/spirv_definition.h" - #include "debuginfo.insts.inc" #include "glsl.std.450.insts.inc" #include "nonsemantic.clspvreflection.insts.inc" #include "nonsemantic.shader.debuginfo.100.insts.inc" #include "opencl.debuginfo.100.insts.inc" #include "opencl.std.insts.inc" - +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "source/macro.h" +#include "source/spirv_definition.h" #include "spirv-tools/libspirv.h" #include "spv-amd-gcn-shader.insts.inc" #include "spv-amd-shader-ballot.insts.inc"
diff --git a/source/fuzz/available_instructions.cpp b/source/fuzz/available_instructions.cpp index 0db8b20..260df0e 100644 --- a/source/fuzz/available_instructions.cpp +++ b/source/fuzz/available_instructions.cpp
@@ -13,6 +13,7 @@ // limitations under the License. #include "source/fuzz/available_instructions.h" + #include "source/fuzz/fuzzer_util.h" namespace spvtools {
diff --git a/source/fuzz/fuzzer_context.h b/source/fuzz/fuzzer_context.h index 77a5d40..603346c 100644 --- a/source/fuzz/fuzzer_context.h +++ b/source/fuzz/fuzzer_context.h
@@ -121,9 +121,7 @@ static uint32_t GetMinFreshId(opt::IRContext* ir_context); // Returns true if all transformations should be compatible with WGSL. - bool IsWgslCompatible() const { - return is_wgsl_compatible_; - } + bool IsWgslCompatible() const { return is_wgsl_compatible_; } // Probabilities associated with applying various transformations. // Keep them in alphabetical order.
diff --git a/source/fuzz/fuzzer_pass_wrap_vector_synonym.cpp b/source/fuzz/fuzzer_pass_wrap_vector_synonym.cpp index 35adcfe..6c9d339 100644 --- a/source/fuzz/fuzzer_pass_wrap_vector_synonym.cpp +++ b/source/fuzz/fuzzer_pass_wrap_vector_synonym.cpp
@@ -13,6 +13,7 @@ // limitations under the License. #include "source/fuzz/fuzzer_pass_wrap_vector_synonym.h" + #include "source/fuzz/fuzzer_context.h" #include "source/fuzz/fuzzer_util.h" #include "source/fuzz/transformation_composite_construct.h" @@ -35,7 +36,6 @@ opt::BasicBlock::iterator instruction_iterator, const protobufs::InstructionDescriptor& instruction_descriptor) -> void { - // Randomly decide whether to wrap it to a vector operation. if (!GetFuzzerContext()->ChoosePercentage( GetFuzzerContext()->GetChanceOfWrappingVectorSynonym())) {
diff --git a/source/fuzz/fuzzer_util.cpp b/source/fuzz/fuzzer_util.cpp index 1d368a9..da2662d 100644 --- a/source/fuzz/fuzzer_util.cpp +++ b/source/fuzz/fuzzer_util.cpp
@@ -1740,9 +1740,8 @@ bool HasBlockOrBufferBlockDecoration(opt::IRContext* ir_context, uint32_t id) { for (auto decoration : {SpvDecorationBlock, SpvDecorationBufferBlock}) { if (!ir_context->get_decoration_mgr()->WhileEachDecoration( - id, decoration, [](const opt::Instruction & /*unused*/) -> bool { - return false; - })) { + id, decoration, + [](const opt::Instruction& /*unused*/) -> bool { return false; })) { return true; } }
diff --git a/source/fuzz/transformation_add_loop_to_create_int_constant_synonym.cpp b/source/fuzz/transformation_add_loop_to_create_int_constant_synonym.cpp index 657fafa..803b4c9 100644 --- a/source/fuzz/transformation_add_loop_to_create_int_constant_synonym.cpp +++ b/source/fuzz/transformation_add_loop_to_create_int_constant_synonym.cpp
@@ -13,6 +13,7 @@ // limitations under the License. #include "source/fuzz/transformation_add_loop_to_create_int_constant_synonym.h" + #include "source/fuzz/fuzzer_util.h" namespace spvtools {
diff --git a/source/fuzz/transformation_swap_two_functions.cpp b/source/fuzz/transformation_swap_two_functions.cpp index 85d9e79..747ed7e 100644 --- a/source/fuzz/transformation_swap_two_functions.cpp +++ b/source/fuzz/transformation_swap_two_functions.cpp
@@ -14,11 +14,10 @@ #include "source/fuzz/transformation_swap_two_functions.h" +#include "source/fuzz/fuzzer_util.h" #include "source/opt/function.h" #include "source/opt/module.h" -#include "source/fuzz/fuzzer_util.h" - namespace spvtools { namespace fuzz {
diff --git a/source/opt/block_merge_pass.h b/source/opt/block_merge_pass.h index aabf789..a3603d5 100644 --- a/source/opt/block_merge_pass.h +++ b/source/opt/block_merge_pass.h
@@ -49,11 +49,9 @@ } private: - // Search |func| for blocks which have a single Branch to a block // with no other predecessors. Merge these blocks into a single block. bool MergeBlocks(Function* func); - }; } // namespace opt
diff --git a/source/opt/cfg_cleanup_pass.cpp b/source/opt/cfg_cleanup_pass.cpp index 6d48637..0bffec8 100644 --- a/source/opt/cfg_cleanup_pass.cpp +++ b/source/opt/cfg_cleanup_pass.cpp
@@ -16,11 +16,11 @@ // constructs (e.g., unreachable basic blocks, empty control flow structures, // etc) +#include "source/opt/cfg_cleanup_pass.h" + #include <queue> #include <unordered_set> -#include "source/opt/cfg_cleanup_pass.h" - #include "source/opt/function.h" #include "source/opt/module.h"
diff --git a/source/opt/dead_branch_elim_pass.cpp b/source/opt/dead_branch_elim_pass.cpp index d99b7f7..96e31a3 100644 --- a/source/opt/dead_branch_elim_pass.cpp +++ b/source/opt/dead_branch_elim_pass.cpp
@@ -56,7 +56,9 @@ GetConstCondition(cInst->GetSingleWordInOperand(0), &negVal); if (condIsConst) *condVal = !negVal; } break; - default: { condIsConst = false; } break; + default: { + condIsConst = false; + } break; } return condIsConst; }
diff --git a/source/opt/dead_insert_elim_pass.cpp b/source/opt/dead_insert_elim_pass.cpp index d877f0f..99c2e31 100644 --- a/source/opt/dead_insert_elim_pass.cpp +++ b/source/opt/dead_insert_elim_pass.cpp
@@ -59,7 +59,9 @@ case SpvOpTypeStruct: { return typeInst->NumInOperands(); } break; - default: { return 0; } break; + default: { + return 0; + } break; } } @@ -103,8 +105,8 @@ std::unordered_set<uint32_t> obj_visited_phis; MarkInsertChain(get_def_use_mgr()->GetDef(objId), nullptr, 0, &obj_visited_phis); - // If extract indices match insert, we are done. Mark insert and - // inserted object. + // If extract indices match insert, we are done. Mark insert and + // inserted object. } else if (ExtInsMatch(*pExtIndices, insInst, extOffset)) { liveInserts_.insert(insInst->result_id()); uint32_t objId = insInst->GetSingleWordInOperand(kInsertObjectIdInIdx); @@ -112,7 +114,7 @@ MarkInsertChain(get_def_use_mgr()->GetDef(objId), nullptr, 0, &obj_visited_phis); break; - // If non-matching intersection, mark insert + // If non-matching intersection, mark insert } else if (ExtInsConflict(*pExtIndices, insInst, extOffset)) { liveInserts_.insert(insInst->result_id()); // If more extract indices than insert, we are done. Use remaining @@ -124,8 +126,8 @@ MarkInsertChain(get_def_use_mgr()->GetDef(objId), pExtIndices, extOffset + numInsertIndices, &obj_visited_phis); break; - // If fewer extract indices than insert, also mark inserted object and - // continue up chain. + // If fewer extract indices than insert, also mark inserted object and + // continue up chain. } else { uint32_t objId = insInst->GetSingleWordInOperand(kInsertObjectIdInIdx); std::unordered_set<uint32_t> obj_visited_phis;
diff --git a/source/opt/dominator_tree.cpp b/source/opt/dominator_tree.cpp index 2680be2..0d130ba 100644 --- a/source/opt/dominator_tree.cpp +++ b/source/opt/dominator_tree.cpp
@@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "source/opt/dominator_tree.h" + #include <iostream> #include <memory> #include <set> #include "source/cfa.h" -#include "source/opt/dominator_tree.h" #include "source/opt/ir_context.h" // Calculates the dominator or postdominator tree for a given function.
diff --git a/source/opt/eliminate_dead_functions_pass.cpp b/source/opt/eliminate_dead_functions_pass.cpp index a465521..01a6e5a 100644 --- a/source/opt/eliminate_dead_functions_pass.cpp +++ b/source/opt/eliminate_dead_functions_pass.cpp
@@ -13,10 +13,10 @@ // limitations under the License. #include "source/opt/eliminate_dead_functions_pass.h" -#include "source/opt/eliminate_dead_functions_util.h" #include <unordered_set> +#include "source/opt/eliminate_dead_functions_util.h" #include "source/opt/ir_context.h" namespace spvtools {
diff --git a/source/opt/freeze_spec_constant_value_pass.cpp b/source/opt/freeze_spec_constant_value_pass.cpp index 10e98fd..391a45c 100644 --- a/source/opt/freeze_spec_constant_value_pass.cpp +++ b/source/opt/freeze_spec_constant_value_pass.cpp
@@ -13,6 +13,7 @@ // limitations under the License. #include "source/opt/freeze_spec_constant_value_pass.h" + #include "source/opt/ir_context.h" namespace spvtools {
diff --git a/source/opt/function.h b/source/opt/function.h index 146cbe3..a039b09 100644 --- a/source/opt/function.h +++ b/source/opt/function.h
@@ -96,7 +96,9 @@ inline uint32_t type_id() const { return def_inst_->type_id(); } // Returns the function's control mask - inline uint32_t control_mask() const { return def_inst_->GetSingleWordInOperand(0); } + inline uint32_t control_mask() const { + return def_inst_->GetSingleWordInOperand(0); + } // Returns the entry basic block for this function. const std::unique_ptr<BasicBlock>& entry() const { return blocks_.front(); }
diff --git a/source/opt/inst_bindless_check_pass.cpp b/source/opt/inst_bindless_check_pass.cpp index c2c5d6c..6ead75e 100644 --- a/source/opt/inst_bindless_check_pass.cpp +++ b/source/opt/inst_bindless_check_pass.cpp
@@ -355,7 +355,9 @@ const analysis::Integer* i_ty = sz_ty->AsInteger(); size *= i_ty->width(); } break; - default: { assert(false && "unexpected type"); } break; + default: { + assert(false && "unexpected type"); + } break; } size /= 8; return size; @@ -491,7 +493,9 @@ // Get element type for next step curr_ty_id = curr_ty_inst->GetSingleWordInOperand(member_idx); } break; - default: { assert(false && "unexpected non-composite type"); } break; + default: { + assert(false && "unexpected non-composite type"); + } break; } if (sum_id == 0) sum_id = curr_offset_id;
diff --git a/source/opt/instrument_pass.cpp b/source/opt/instrument_pass.cpp index d143d59..9c0ead9 100644 --- a/source/opt/instrument_pass.cpp +++ b/source/opt/instrument_pass.cpp
@@ -335,7 +335,9 @@ GenDebugOutputFieldCode(base_offset_id, kInstRayTracingOutLaunchIdZ, z_launch_inst->result_id(), builder); } break; - default: { assert(false && "unsupported stage"); } break; + default: { + assert(false && "unsupported stage"); + } break; } }
diff --git a/source/opt/loop_dependence_helpers.cpp b/source/opt/loop_dependence_helpers.cpp index de27a0a..cc4aed1 100644 --- a/source/opt/loop_dependence_helpers.cpp +++ b/source/opt/loop_dependence_helpers.cpp
@@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/opt/loop_dependence.h" - #include <ostream> #include <set> #include <string> @@ -23,6 +21,7 @@ #include "source/opt/basic_block.h" #include "source/opt/instruction.h" +#include "source/opt/loop_dependence.h" #include "source/opt/scalar_analysis.h" #include "source/opt/scalar_analysis_nodes.h"
diff --git a/source/opt/loop_fission.cpp b/source/opt/loop_fission.cpp index b4df8c6..6de2678 100644 --- a/source/opt/loop_fission.cpp +++ b/source/opt/loop_fission.cpp
@@ -177,7 +177,6 @@ traverser_functor(use); }; def_use->ForEachUse(user, traverse_use); - }; // We start the traversal of the use def graph by invoking the above
diff --git a/source/opt/loop_peeling.cpp b/source/opt/loop_peeling.cpp index 34f0a8d..bcea2fa 100644 --- a/source/opt/loop_peeling.cpp +++ b/source/opt/loop_peeling.cpp
@@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "source/opt/loop_peeling.h" + #include <algorithm> #include <functional> #include <memory> @@ -22,7 +24,6 @@ #include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" #include "source/opt/loop_descriptor.h" -#include "source/opt/loop_peeling.h" #include "source/opt/loop_utils.h" #include "source/opt/scalar_analysis.h" #include "source/opt/scalar_analysis_nodes.h" @@ -115,20 +116,19 @@ // if (cond) // z += cst2; // } - loop_->GetHeaderBlock()->ForEachPhiInst([cloned_loop_exit, def_use_mgr, - clone_results, - this](Instruction* phi) { - for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { - if (!loop_->IsInsideLoop(phi->GetSingleWordInOperand(i + 1))) { - phi->SetInOperand(i, - {clone_results->value_map_.at( - exit_value_.at(phi->result_id())->result_id())}); - phi->SetInOperand(i + 1, {cloned_loop_exit}); - def_use_mgr->AnalyzeInstUse(phi); - return; - } - } - }); + loop_->GetHeaderBlock()->ForEachPhiInst( + [cloned_loop_exit, def_use_mgr, clone_results, this](Instruction* phi) { + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + if (!loop_->IsInsideLoop(phi->GetSingleWordInOperand(i + 1))) { + phi->SetInOperand( + i, {clone_results->value_map_.at( + exit_value_.at(phi->result_id())->result_id())}); + phi->SetInOperand(i + 1, {cloned_loop_exit}); + def_use_mgr->AnalyzeInstUse(phi); + return; + } + } + }); // Force the creation of a new preheader for the original loop and set it as // the merge block for the cloned loop. @@ -528,36 +528,35 @@ // dominate the preheader. // We had to the preheader (our if merge block) the required phi instruction // and patch the header phi. - GetOriginalLoop()->GetHeaderBlock()->ForEachPhiInst( - [&clone_results, if_block, this](Instruction* phi) { - analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + GetOriginalLoop()->GetHeaderBlock()->ForEachPhiInst([&clone_results, if_block, + this](Instruction* phi) { + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); - auto find_value_idx = [](Instruction* phi_inst, Loop* loop) { - uint32_t preheader_value_idx = - !loop->IsInsideLoop(phi_inst->GetSingleWordInOperand(1)) ? 0 : 2; - return preheader_value_idx; - }; + auto find_value_idx = [](Instruction* phi_inst, Loop* loop) { + uint32_t preheader_value_idx = + !loop->IsInsideLoop(phi_inst->GetSingleWordInOperand(1)) ? 0 : 2; + return preheader_value_idx; + }; - Instruction* cloned_phi = - def_use_mgr->GetDef(clone_results.value_map_.at(phi->result_id())); - uint32_t cloned_preheader_value = cloned_phi->GetSingleWordInOperand( - find_value_idx(cloned_phi, GetClonedLoop())); + Instruction* cloned_phi = + def_use_mgr->GetDef(clone_results.value_map_.at(phi->result_id())); + uint32_t cloned_preheader_value = cloned_phi->GetSingleWordInOperand( + find_value_idx(cloned_phi, GetClonedLoop())); - Instruction* new_phi = - InstructionBuilder(context_, - &*GetOriginalLoop()->GetPreHeaderBlock()->tail(), - IRContext::kAnalysisDefUse | - IRContext::kAnalysisInstrToBlockMapping) - .AddPhi(phi->type_id(), - {phi->GetSingleWordInOperand( - find_value_idx(phi, GetOriginalLoop())), - GetClonedLoop()->GetMergeBlock()->id(), - cloned_preheader_value, if_block->id()}); + Instruction* new_phi = + InstructionBuilder(context_, + &*GetOriginalLoop()->GetPreHeaderBlock()->tail(), + IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping) + .AddPhi(phi->type_id(), {phi->GetSingleWordInOperand(find_value_idx( + phi, GetOriginalLoop())), + GetClonedLoop()->GetMergeBlock()->id(), + cloned_preheader_value, if_block->id()}); - phi->SetInOperand(find_value_idx(phi, GetOriginalLoop()), - {new_phi->result_id()}); - def_use_mgr->AnalyzeInstUse(phi); - }); + phi->SetInOperand(find_value_idx(phi, GetOriginalLoop()), + {new_phi->result_id()}); + def_use_mgr->AnalyzeInstUse(phi); + }); context_->InvalidateAnalysesExceptFor( IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping |
diff --git a/source/opt/loop_unswitch_pass.cpp b/source/opt/loop_unswitch_pass.cpp index 1ee7e5e..b9629e0 100644 --- a/source/opt/loop_unswitch_pass.cpp +++ b/source/opt/loop_unswitch_pass.cpp
@@ -31,7 +31,6 @@ #include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" #include "source/opt/loop_descriptor.h" - #include "source/opt/loop_utils.h" namespace spvtools {
diff --git a/source/opt/loop_utils.cpp b/source/opt/loop_utils.cpp index 8c6d355..d3945af 100644 --- a/source/opt/loop_utils.cpp +++ b/source/opt/loop_utils.cpp
@@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "source/opt/loop_utils.h" + #include <algorithm> #include <memory> #include <unordered_map> @@ -24,7 +26,6 @@ #include "source/opt/ir_builder.h" #include "source/opt/ir_context.h" #include "source/opt/loop_descriptor.h" -#include "source/opt/loop_utils.h" namespace spvtools { namespace opt { @@ -536,7 +537,6 @@ [new_merge_block, this](Instruction* inst, uint32_t operand) { if (this->loop_->IsInsideLoop(inst)) inst->SetOperand(operand, {new_merge_block}); - }); new_loop->SetMergeBlock(new_exit_bb.get());
diff --git a/source/opt/pass_manager.h b/source/opt/pass_manager.h index 11961a3..f6e5cc4 100644 --- a/source/opt/pass_manager.h +++ b/source/opt/pass_manager.h
@@ -20,11 +20,10 @@ #include <utility> #include <vector> +#include "source/opt/ir_context.h" #include "source/opt/log.h" #include "source/opt/module.h" #include "source/opt/pass.h" - -#include "source/opt/ir_context.h" #include "spirv-tools/libspirv.hpp" namespace spvtools {
diff --git a/source/opt/pch_source_opt.h b/source/opt/pch_source_opt.h index 7356651..c85ec32 100644 --- a/source/opt/pch_source_opt.h +++ b/source/opt/pch_source_opt.h
@@ -21,6 +21,7 @@ #include <unordered_set> #include <utility> #include <vector> + #include "source/opt/basic_block.h" #include "source/opt/decoration_manager.h" #include "source/opt/def_use_manager.h"
diff --git a/source/opt/remove_unused_interface_variables_pass.cpp b/source/opt/remove_unused_interface_variables_pass.cpp index 31e87bd..80bb70b 100644 --- a/source/opt/remove_unused_interface_variables_pass.cpp +++ b/source/opt/remove_unused_interface_variables_pass.cpp
@@ -13,6 +13,7 @@ // limitations under the License. #include "remove_unused_interface_variables_pass.h" + #include "source/spirv_constant.h" namespace spvtools { namespace opt {
diff --git a/source/opt/scalar_analysis_simplification.cpp b/source/opt/scalar_analysis_simplification.cpp index 3c1ecc0..fed6cc0 100644 --- a/source/opt/scalar_analysis_simplification.cpp +++ b/source/opt/scalar_analysis_simplification.cpp
@@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/opt/scalar_analysis.h" - #include <functional> #include <map> #include <memory> @@ -22,6 +20,8 @@ #include <utility> #include <vector> +#include "source/opt/scalar_analysis.h" + // Simplifies scalar analysis DAGs. // // 1. Given a node passed to SimplifyExpression we first simplify the graph by
diff --git a/source/opt/strip_debug_info_pass.cpp b/source/opt/strip_debug_info_pass.cpp index 6a0ebf2..e97700e 100644 --- a/source/opt/strip_debug_info_pass.cpp +++ b/source/opt/strip_debug_info_pass.cpp
@@ -13,6 +13,7 @@ // limitations under the License. #include "source/opt/strip_debug_info_pass.h" + #include "source/opt/ir_context.h" #include "source/util/string_utils.h"
diff --git a/source/parsed_operand.cpp b/source/parsed_operand.cpp index 5f8e94d..06aaf46 100644 --- a/source/parsed_operand.cpp +++ b/source/parsed_operand.cpp
@@ -17,6 +17,7 @@ #include "source/parsed_operand.h" #include <cassert> + #include "source/util/hex_float.h" namespace spvtools {
diff --git a/source/reduce/merge_blocks_reduction_opportunity_finder.cpp b/source/reduce/merge_blocks_reduction_opportunity_finder.cpp index ea5e9da..5b90fb3 100644 --- a/source/reduce/merge_blocks_reduction_opportunity_finder.cpp +++ b/source/reduce/merge_blocks_reduction_opportunity_finder.cpp
@@ -13,6 +13,7 @@ // limitations under the License. #include "source/reduce/merge_blocks_reduction_opportunity_finder.h" + #include "source/opt/block_merge_util.h" #include "source/reduce/merge_blocks_reduction_opportunity.h"
diff --git a/source/reduce/pch_source_reduce.h b/source/reduce/pch_source_reduce.h index 81bed20..a9ff78f 100644 --- a/source/reduce/pch_source_reduce.h +++ b/source/reduce/pch_source_reduce.h
@@ -15,6 +15,7 @@ #include <algorithm> #include <functional> #include <string> + #include "source/reduce/change_operand_reduction_opportunity.h" #include "source/reduce/operand_to_const_reduction_opportunity_finder.h" #include "source/reduce/reduction_opportunity.h"
diff --git a/source/reduce/reduction_util.h b/source/reduce/reduction_util.h index bcdb77c..87cee5b 100644 --- a/source/reduce/reduction_util.h +++ b/source/reduce/reduction_util.h
@@ -15,10 +15,9 @@ #ifndef SOURCE_REDUCE_REDUCTION_UTIL_H_ #define SOURCE_REDUCE_REDUCTION_UTIL_H_ -#include "spirv-tools/libspirv.hpp" - #include "source/opt/ir_context.h" #include "source/reduce/reduction_opportunity.h" +#include "spirv-tools/libspirv.hpp" namespace spvtools { namespace reduce {
diff --git a/source/reduce/remove_struct_member_reduction_opportunity.h b/source/reduce/remove_struct_member_reduction_opportunity.h index 899e5ea..d3341d3 100644 --- a/source/reduce/remove_struct_member_reduction_opportunity.h +++ b/source/reduce/remove_struct_member_reduction_opportunity.h
@@ -15,9 +15,8 @@ #ifndef SOURCE_REDUCE_REMOVE_STRUCT_MEMBER_REDUCTION_OPPORTUNITY_H_ #define SOURCE_REDUCE_REMOVE_STRUCT_MEMBER_REDUCTION_OPPORTUNITY_H_ -#include "source/reduce/reduction_opportunity.h" - #include "source/opt/instruction.h" +#include "source/reduce/reduction_opportunity.h" namespace spvtools { namespace reduce {
diff --git a/source/spirv_fuzzer_options.h b/source/spirv_fuzzer_options.h index bb8d910..1b8994b 100644 --- a/source/spirv_fuzzer_options.h +++ b/source/spirv_fuzzer_options.h
@@ -15,11 +15,11 @@ #ifndef SOURCE_SPIRV_FUZZER_OPTIONS_H_ #define SOURCE_SPIRV_FUZZER_OPTIONS_H_ -#include "spirv-tools/libspirv.h" - #include <string> #include <utility> +#include "spirv-tools/libspirv.h" + // Manages command line options passed to the SPIR-V Fuzzer. New struct // members may be added for any new option. struct spv_fuzzer_options_t {
diff --git a/source/spirv_optimizer_options.cpp b/source/spirv_optimizer_options.cpp index e92ffc0..1750b6b 100644 --- a/source/spirv_optimizer_options.cpp +++ b/source/spirv_optimizer_options.cpp
@@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "source/spirv_optimizer_options.h" + #include <cassert> #include <cstring> -#include "source/spirv_optimizer_options.h" - SPIRV_TOOLS_EXPORT spv_optimizer_options spvOptimizerOptionsCreate(void) { return new spv_optimizer_options_t(); }
diff --git a/source/spirv_reducer_options.cpp b/source/spirv_reducer_options.cpp index 9086433..774ddfb 100644 --- a/source/spirv_reducer_options.cpp +++ b/source/spirv_reducer_options.cpp
@@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "source/spirv_reducer_options.h" + #include <cassert> #include <cstring> -#include "source/spirv_reducer_options.h" - namespace { // The default maximum number of steps the reducer will take before giving up. const uint32_t kDefaultStepLimit = 2500;
diff --git a/source/spirv_reducer_options.h b/source/spirv_reducer_options.h index 911747d..a80830f 100644 --- a/source/spirv_reducer_options.h +++ b/source/spirv_reducer_options.h
@@ -15,11 +15,11 @@ #ifndef SOURCE_SPIRV_REDUCER_OPTIONS_H_ #define SOURCE_SPIRV_REDUCER_OPTIONS_H_ -#include "spirv-tools/libspirv.h" - #include <string> #include <utility> +#include "spirv-tools/libspirv.h" + // Manages command line options passed to the SPIR-V Reducer. New struct // members may be added for any new option. struct spv_reducer_options_t {
diff --git a/source/spirv_validator_options.cpp b/source/spirv_validator_options.cpp index b72a644..e1324dc 100644 --- a/source/spirv_validator_options.cpp +++ b/source/spirv_validator_options.cpp
@@ -111,8 +111,8 @@ options->scalar_block_layout = val; } -void spvValidatorOptionsSetWorkgroupScalarBlockLayout(spv_validator_options options, - bool val) { +void spvValidatorOptionsSetWorkgroupScalarBlockLayout( + spv_validator_options options, bool val) { options->workgroup_scalar_block_layout = val; }
diff --git a/source/util/hex_float.h b/source/util/hex_float.h index 06e3c57..44eaa40 100644 --- a/source/util/hex_float.h +++ b/source/util/hex_float.h
@@ -1200,8 +1200,8 @@ } template <> -inline std::ostream& operator<<<Float16>(std::ostream& os, - const FloatProxy<Float16>& value) { +inline std::ostream& operator<< <Float16>(std::ostream& os, + const FloatProxy<Float16>& value) { os << HexFloat<FloatProxy<Float16>>(value); return os; }
diff --git a/source/util/string_utils.cpp b/source/util/string_utils.cpp index b56c353..b96aa7b 100644 --- a/source/util/string_utils.cpp +++ b/source/util/string_utils.cpp
@@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "source/util/string_utils.h" + #include <algorithm> #include <cstdint> #include <type_traits> -#include "source/util/string_utils.h" - namespace spvtools { namespace utils {
diff --git a/source/util/timer.cpp b/source/util/timer.cpp index c8b8d5b..dc49dd4 100644 --- a/source/util/timer.cpp +++ b/source/util/timer.cpp
@@ -18,6 +18,7 @@ #include <sys/resource.h> #include <sys/time.h> + #include <iomanip> #include <iostream> #include <string>
diff --git a/source/util/timer.h b/source/util/timer.h index 0808311..6163fe2 100644 --- a/source/util/timer.h +++ b/source/util/timer.h
@@ -20,6 +20,7 @@ #if defined(SPIRV_TIMER_ENABLED) #include <sys/resource.h> + #include <cassert> #include <iostream>
diff --git a/source/val/validate_adjacency.cpp b/source/val/validate_adjacency.cpp index 8e6c373..b7e25af 100644 --- a/source/val/validate_adjacency.cpp +++ b/source/val/validate_adjacency.cpp
@@ -15,13 +15,12 @@ // Validates correctness of the intra-block preconditions of SPIR-V // instructions. -#include "source/val/validate.h" - #include <string> #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_arithmetics.cpp b/source/val/validate_arithmetics.cpp index bae9b5d..669d3c7 100644 --- a/source/val/validate_arithmetics.cpp +++ b/source/val/validate_arithmetics.cpp
@@ -14,13 +14,12 @@ // Performs validation of arithmetic instructions. -#include "source/val/validate.h" - #include <vector> #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_atomics.cpp b/source/val/validate_atomics.cpp index bf565c3..0fa6ca5 100644 --- a/source/val/validate_atomics.cpp +++ b/source/val/validate_atomics.cpp
@@ -16,13 +16,12 @@ // Validates correctness of atomic SPIR-V instructions. -#include "source/val/validate.h" - #include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/util/bitutils.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validate_memory_semantics.h" #include "source/val/validate_scopes.h" #include "source/val/validation_state.h" @@ -185,7 +184,7 @@ } // Can't use result_type because OpAtomicStore doesn't have a result - if ( _.IsIntScalarType(data_type) &&_.GetBitWidth(data_type) == 64 && + if (_.IsIntScalarType(data_type) && _.GetBitWidth(data_type) == 64 && !_.HasCapability(SpvCapabilityInt64Atomics)) { return _.diag(SPV_ERROR_INVALID_DATA, inst) << spvOpcodeString(opcode)
diff --git a/source/val/validate_builtins.cpp b/source/val/validate_builtins.cpp index 6f4b0f9..f779605 100644 --- a/source/val/validate_builtins.cpp +++ b/source/val/validate_builtins.cpp
@@ -108,7 +108,9 @@ case SpvOpGenericCastToPtrExplicit: { return SpvStorageClass(inst.word(4)); } - default: { break; } + default: { + break; + } } return SpvStorageClassMax; }
diff --git a/source/val/validate_composites.cpp b/source/val/validate_composites.cpp index c3d948d..26a97e3 100644 --- a/source/val/validate_composites.cpp +++ b/source/val/validate_composites.cpp
@@ -14,12 +14,11 @@ // Validates correctness of composite SPIR-V instructions. -#include "source/val/validate.h" - #include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_debug.cpp b/source/val/validate_debug.cpp index 7ab597a..8f7ad73 100644 --- a/source/val/validate_debug.cpp +++ b/source/val/validate_debug.cpp
@@ -12,11 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/val/validate.h" - #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_decorations.cpp b/source/val/validate_decorations.cpp index c4834cd..cae8063 100644 --- a/source/val/validate_decorations.cpp +++ b/source/val/validate_decorations.cpp
@@ -427,8 +427,7 @@ // or row major-ness. spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, const char* decoration_str, bool blockRules, - bool scalar_block_layout, - uint32_t incoming_offset, + bool scalar_block_layout, uint32_t incoming_offset, MemberConstraints& constraints, ValidationState_t& vstate) { if (vstate.options()->skip_block_layout) return SPV_SUCCESS; @@ -551,8 +550,7 @@ if (SpvOpTypeStruct == opcode && SPV_SUCCESS != (recursive_status = checkLayout( id, storage_class_str, decoration_str, blockRules, - scalar_block_layout, - offset, constraints, vstate))) + scalar_block_layout, offset, constraints, vstate))) return recursive_status; // Check matrix stride. if (SpvOpTypeMatrix == opcode) { @@ -914,17 +912,20 @@ num_workgroup_variables > 0 && num_workgroup_variables_with_block > 0) { if (num_workgroup_variables != num_workgroup_variables_with_block) { - return vstate.diag(SPV_ERROR_INVALID_BINARY, vstate.FindDef(entry_point)) + return vstate.diag(SPV_ERROR_INVALID_BINARY, + vstate.FindDef(entry_point)) << "When declaring WorkgroupMemoryExplicitLayoutKHR, " - "either all or none of the Workgroup Storage Class variables " + "either all or none of the Workgroup Storage Class " + "variables " "in the entry point interface must point to struct types " "decorated with Block. Entry point id " << entry_point << " does not meet this requirement."; } if (num_workgroup_variables_with_block > 1 && num_workgroup_variables_with_block != - num_workgroup_variables_with_aliased) { - return vstate.diag(SPV_ERROR_INVALID_BINARY, vstate.FindDef(entry_point)) + num_workgroup_variables_with_aliased) { + return vstate.diag(SPV_ERROR_INVALID_BINARY, + vstate.FindDef(entry_point)) << "When declaring WorkgroupMemoryExplicitLayoutKHR, " "if more than one Workgroup Storage Class variable in " "the entry point interface point to a type decorated " @@ -1122,10 +1123,10 @@ vstate); // Prepare for messages const char* sc_str = - uniform ? "Uniform" - : (push_constant ? "PushConstant" - : (workgroup ? "Workgroup" - : "StorageBuffer")); + uniform + ? "Uniform" + : (push_constant ? "PushConstant" + : (workgroup ? "Workgroup" : "StorageBuffer")); if (spvIsVulkanEnv(vstate.context()->target_env)) { const bool block = hasDecoration(id, SpvDecorationBlock, vstate); @@ -1193,9 +1194,9 @@ const bool bufferDeco = SpvDecorationBufferBlock == dec.dec_type(); const bool blockRules = uniform && blockDeco; const bool bufferRules = - (uniform && bufferDeco) || - ((push_constant || storage_buffer || - phys_storage_buffer || workgroup) && blockDeco); + (uniform && bufferDeco) || ((push_constant || storage_buffer || + phys_storage_buffer || workgroup) && + blockDeco); if (uniform && blockDeco) { vstate.RegisterPointerToUniformBlock(ptrInst->id()); vstate.RegisterStructForUniformBlock(id); @@ -1209,9 +1210,9 @@ if (blockRules || bufferRules) { const char* deco_str = blockDeco ? "Block" : "BufferBlock"; spv_result_t recursive_status = SPV_SUCCESS; - const bool scalar_block_layout = workgroup ? - vstate.options()->workgroup_scalar_block_layout : - vstate.options()->scalar_block_layout; + const bool scalar_block_layout = + workgroup ? vstate.options()->workgroup_scalar_block_layout + : vstate.options()->scalar_block_layout; if (isMissingOffsetInStruct(id, vstate)) { return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) @@ -1779,7 +1780,8 @@ { \ spv_result_t e##LINE = (X); \ if (e##LINE != SPV_SUCCESS) return e##LINE; \ - } static_assert(true, "require extra semicolon") + } \ + static_assert(true, "require extra semicolon") #define PASS_OR_BAIL(X) PASS_OR_BAIL_AT_LINE(X, __LINE__) // Check rules for decorations where we start from the decoration rather
diff --git a/source/val/validate_derivatives.cpp b/source/val/validate_derivatives.cpp index 25b941a..3a4cf2f 100644 --- a/source/val/validate_derivatives.cpp +++ b/source/val/validate_derivatives.cpp
@@ -14,13 +14,12 @@ // Validates correctness of derivative SPIR-V instructions. -#include "source/val/validate.h" - #include <string> #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_execution_limitations.cpp b/source/val/validate_execution_limitations.cpp index e1f4d7b..13fea58 100644 --- a/source/val/validate_execution_limitations.cpp +++ b/source/val/validate_execution_limitations.cpp
@@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/val/validate.h" - #include "source/val/function.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_extensions.cpp b/source/val/validate_extensions.cpp index 1e69cb3..2a9cc2b 100644 --- a/source/val/validate_extensions.cpp +++ b/source/val/validate_extensions.cpp
@@ -18,8 +18,6 @@ #include <string> #include <vector> -#include "spirv/unified1/NonSemanticClspvReflection.h" - #include "NonSemanticShaderDebugInfo100.h" #include "OpenCLDebugInfo100.h" #include "source/common_debug_info.h" @@ -34,6 +32,7 @@ #include "source/val/instruction.h" #include "source/val/validate.h" #include "source/val/validation_state.h" +#include "spirv/unified1/NonSemanticClspvReflection.h" namespace spvtools { namespace val {
diff --git a/source/val/validate_id.cpp b/source/val/validate_id.cpp index 2bab203..fa3b8b8 100644 --- a/source/val/validate_id.cpp +++ b/source/val/validate_id.cpp
@@ -12,11 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/val/validate.h" - -#include <cassert> - #include <algorithm> +#include <cassert> #include <iostream> #include <iterator> #include <stack> @@ -31,6 +28,7 @@ #include "source/operand.h" #include "source/spirv_validator_options.h" #include "source/val/function.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" #include "spirv-tools/libspirv.h"
diff --git a/source/val/validate_image.cpp b/source/val/validate_image.cpp index 9c7c8c1..b94e4f4 100644 --- a/source/val/validate_image.cpp +++ b/source/val/validate_image.cpp
@@ -722,7 +722,9 @@ return true; } - default: { return false; } + default: { + return false; + } } return false;
diff --git a/source/val/validate_literals.cpp b/source/val/validate_literals.cpp index 53aae07..d5e7c8f 100644 --- a/source/val/validate_literals.cpp +++ b/source/val/validate_literals.cpp
@@ -14,13 +14,12 @@ // Validates literal numbers. -#include "source/val/validate.h" - #include <cassert> #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_logicals.cpp b/source/val/validate_logicals.cpp index ec1e207..61cf26a 100644 --- a/source/val/validate_logicals.cpp +++ b/source/val/validate_logicals.cpp
@@ -14,11 +14,10 @@ // Validates correctness of logical SPIR-V instructions. -#include "source/val/validate.h" - #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_memory.cpp b/source/val/validate_memory.cpp index 8a66bee..e9abb55 100644 --- a/source/val/validate_memory.cpp +++ b/source/val/validate_memory.cpp
@@ -810,7 +810,8 @@ } break; case SpvStorageClassWorkgroup: - if (!_.HasCapability(SpvCapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR)) { + if (!_.HasCapability( + SpvCapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR)) { storage_class_ok = false; } break; @@ -866,7 +867,8 @@ } break; case SpvStorageClassWorkgroup: - if (!_.HasCapability(SpvCapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR)) { + if (!_.HasCapability( + SpvCapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR)) { storage_class_ok = false; } break;
diff --git a/source/val/validate_misc.cpp b/source/val/validate_misc.cpp index 5acc21e..fb8f96d 100644 --- a/source/val/validate_misc.cpp +++ b/source/val/validate_misc.cpp
@@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/val/validate.h" - #include "source/opcode.h" #include "source/spirv_target_env.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validate_scopes.h" #include "source/val/validation_state.h"
diff --git a/source/val/validate_non_uniform.cpp b/source/val/validate_non_uniform.cpp index 6d4f8a2..1ecc9d2 100644 --- a/source/val/validate_non_uniform.cpp +++ b/source/val/validate_non_uniform.cpp
@@ -14,14 +14,13 @@ // Validates correctness of barrier SPIR-V instructions. -#include "source/val/validate.h" - #include "source/diagnostic.h" #include "source/opcode.h" #include "source/spirv_constant.h" #include "source/spirv_target_env.h" #include "source/util/bitutils.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validate_scopes.h" #include "source/val/validation_state.h"
diff --git a/source/val/validate_primitives.cpp b/source/val/validate_primitives.cpp index 7d11f2e..3d1beed 100644 --- a/source/val/validate_primitives.cpp +++ b/source/val/validate_primitives.cpp
@@ -14,13 +14,12 @@ // Validates correctness of primitive SPIR-V instructions. -#include "source/val/validate.h" - #include <string> #include "source/diagnostic.h" #include "source/opcode.h" #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/val/validate_small_type_uses.cpp b/source/val/validate_small_type_uses.cpp index 9db82e7..bf943f8 100644 --- a/source/val/validate_small_type_uses.cpp +++ b/source/val/validate_small_type_uses.cpp
@@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "source/val/validate.h" - #include "source/val/instruction.h" +#include "source/val/validate.h" #include "source/val/validation_state.h" namespace spvtools {
diff --git a/source/wasm/spirv-tools.cpp b/source/wasm/spirv-tools.cpp index 33f2f05..f6c654f 100644 --- a/source/wasm/spirv-tools.cpp +++ b/source/wasm/spirv-tools.cpp
@@ -12,18 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "spirv-tools/libspirv.hpp" +#include <emscripten/bind.h> +#include <emscripten/val.h> #include <iostream> #include <string> #include <vector> -#include <emscripten/bind.h> -#include <emscripten/val.h> +#include "spirv-tools/libspirv.hpp" using namespace emscripten; -void print_msg_to_stderr (spv_message_level_t, const char*, - const spv_position_t&, const char* m) { +void print_msg_to_stderr(spv_message_level_t, const char*, + const spv_position_t&, const char* m) { std::cerr << "error: " << m << std::endl; }; @@ -46,17 +46,18 @@ std::vector<uint32_t> spirv; if (!core.Assemble(source, &spirv, options)) spirv.clear(); const uint8_t* ptr = reinterpret_cast<const uint8_t*>(spirv.data()); - return emscripten::val(emscripten::typed_memory_view(spirv.size() * 4, - ptr)); + return emscripten::val(emscripten::typed_memory_view(spirv.size() * 4, ptr)); } EMSCRIPTEN_BINDINGS(my_module) { function("dis", &dis); function("as", &as); - - constant("SPV_ENV_UNIVERSAL_1_0", static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_0)); + + constant("SPV_ENV_UNIVERSAL_1_0", + static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_0)); constant("SPV_ENV_VULKAN_1_0", static_cast<uint32_t>(SPV_ENV_VULKAN_1_0)); - constant("SPV_ENV_UNIVERSAL_1_1", static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_1)); + constant("SPV_ENV_UNIVERSAL_1_1", + static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_1)); constant("SPV_ENV_OPENCL_2_1", static_cast<uint32_t>(SPV_ENV_OPENCL_2_1)); constant("SPV_ENV_OPENCL_2_2", static_cast<uint32_t>(SPV_ENV_OPENCL_2_2)); constant("SPV_ENV_OPENGL_4_0", static_cast<uint32_t>(SPV_ENV_OPENGL_4_0)); @@ -64,31 +65,50 @@ constant("SPV_ENV_OPENGL_4_2", static_cast<uint32_t>(SPV_ENV_OPENGL_4_2)); constant("SPV_ENV_OPENGL_4_3", static_cast<uint32_t>(SPV_ENV_OPENGL_4_3)); constant("SPV_ENV_OPENGL_4_5", static_cast<uint32_t>(SPV_ENV_OPENGL_4_5)); - constant("SPV_ENV_UNIVERSAL_1_2", static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_2)); + constant("SPV_ENV_UNIVERSAL_1_2", + static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_2)); constant("SPV_ENV_OPENCL_1_2", static_cast<uint32_t>(SPV_ENV_OPENCL_1_2)); - constant("SPV_ENV_OPENCL_EMBEDDED_1_2", static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_1_2)); + constant("SPV_ENV_OPENCL_EMBEDDED_1_2", + static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_1_2)); constant("SPV_ENV_OPENCL_2_0", static_cast<uint32_t>(SPV_ENV_OPENCL_2_0)); - constant("SPV_ENV_OPENCL_EMBEDDED_2_0", static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_2_0)); - constant("SPV_ENV_OPENCL_EMBEDDED_2_1", static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_2_1)); - constant("SPV_ENV_OPENCL_EMBEDDED_2_2", static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_2_2)); - constant("SPV_ENV_UNIVERSAL_1_3", static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_3)); + constant("SPV_ENV_OPENCL_EMBEDDED_2_0", + static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_2_0)); + constant("SPV_ENV_OPENCL_EMBEDDED_2_1", + static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_2_1)); + constant("SPV_ENV_OPENCL_EMBEDDED_2_2", + static_cast<uint32_t>(SPV_ENV_OPENCL_EMBEDDED_2_2)); + constant("SPV_ENV_UNIVERSAL_1_3", + static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_3)); constant("SPV_ENV_VULKAN_1_1", static_cast<uint32_t>(SPV_ENV_VULKAN_1_1)); constant("SPV_ENV_WEBGPU_0", static_cast<uint32_t>(SPV_ENV_WEBGPU_0)); - constant("SPV_ENV_UNIVERSAL_1_4", static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_4)); - constant("SPV_ENV_VULKAN_1_1_SPIRV_1_4", static_cast<uint32_t>(SPV_ENV_VULKAN_1_1_SPIRV_1_4)); - constant("SPV_ENV_UNIVERSAL_1_5", static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_5)); + constant("SPV_ENV_UNIVERSAL_1_4", + static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_4)); + constant("SPV_ENV_VULKAN_1_1_SPIRV_1_4", + static_cast<uint32_t>(SPV_ENV_VULKAN_1_1_SPIRV_1_4)); + constant("SPV_ENV_UNIVERSAL_1_5", + static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_5)); constant("SPV_ENV_VULKAN_1_2", static_cast<uint32_t>(SPV_ENV_VULKAN_1_2)); constant("SPV_ENV_UNIVERSAL_1_6", static_cast<uint32_t>(SPV_ENV_UNIVERSAL_1_6)); - constant("SPV_BINARY_TO_TEXT_OPTION_NONE", static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_NONE)); - constant("SPV_BINARY_TO_TEXT_OPTION_PRINT", static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_PRINT)); - constant("SPV_BINARY_TO_TEXT_OPTION_COLOR", static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_COLOR)); - constant("SPV_BINARY_TO_TEXT_OPTION_INDENT", static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_INDENT)); - constant("SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET", static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET)); - constant("SPV_BINARY_TO_TEXT_OPTION_NO_HEADER", static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)); - constant("SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES", static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES)); + constant("SPV_BINARY_TO_TEXT_OPTION_NONE", + static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_NONE)); + constant("SPV_BINARY_TO_TEXT_OPTION_PRINT", + static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_PRINT)); + constant("SPV_BINARY_TO_TEXT_OPTION_COLOR", + static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_COLOR)); + constant("SPV_BINARY_TO_TEXT_OPTION_INDENT", + static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_INDENT)); + constant("SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET", + static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET)); + constant("SPV_BINARY_TO_TEXT_OPTION_NO_HEADER", + static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)); + constant("SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES", + static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES)); - constant("SPV_TEXT_TO_BINARY_OPTION_NONE", static_cast<uint32_t>(SPV_TEXT_TO_BINARY_OPTION_NONE)); - constant("SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS", static_cast<uint32_t>(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS)); + constant("SPV_TEXT_TO_BINARY_OPTION_NONE", + static_cast<uint32_t>(SPV_TEXT_TO_BINARY_OPTION_NONE)); + constant( + "SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS", + static_cast<uint32_t>(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS)); }