From ce3b931448fa9e0fc8d8c445cff0be3b91518dd7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 24 Oct 2017 17:06:01 -0700 Subject: [PATCH] notation change: ast => ir --- CMakeLists.txt | 24 ++++++++++----------- README.md | 6 +++--- src/asm2wasm.h | 10 ++++----- src/binaryen-c.cpp | 2 +- src/cfg/Relooper.cpp | 2 +- src/{ast => ir}/CMakeLists.txt | 4 ++-- src/{ast => ir}/ExpressionAnalyzer.cpp | 4 ++-- src/{ast => ir}/ExpressionManipulator.cpp | 2 +- src/{ast => ir}/LocalGraph.cpp | 4 ++-- src/{ast => ir}/bits.h | 8 +++---- src/{ast => ir}/block-utils.h | 10 ++++----- src/{ast => ir}/branch-utils.h | 6 +++--- src/{ast => ir}/cost.h | 6 +++--- src/{ast => ir}/count.h | 6 +++--- src/{ast => ir}/effects.h | 6 +++--- src/{ast => ir}/find_all.h | 6 +++--- src/{ast => ir}/global-utils.h | 6 +++--- src/{ast => ir}/hashed.h | 6 +++--- src/{ast => ir}/import-utils.h | 6 +++--- src/{ast => ir}/label-utils.h | 6 +++--- src/{ast => ir}/literal-utils.h | 6 +++--- src/{ast => ir}/load-utils.h | 6 +++--- src/{ast => ir}/local-graph.h | 6 +++--- src/{ast => ir}/localize.h | 6 +++--- src/{ast => ir}/manipulation.h | 6 +++--- src/{ast => ir}/memory-utils.h | 6 +++--- src/{ast => ir}/module-utils.h | 6 +++--- src/{ast => ir}/properties.h | 8 +++---- src/{ast => ir}/trapping.h | 6 +++--- src/{ast => ir}/type-updating.h | 6 +++--- src/{ast_utils.h => ir/utils.h} | 8 +++---- src/passes/CoalesceLocals.cpp | 2 +- src/passes/CodeFolding.cpp | 6 +++--- src/passes/CodePushing.cpp | 2 +- src/passes/DeadCodeElimination.cpp | 6 +++--- src/passes/DuplicateFunctionElimination.cpp | 2 +- src/passes/Flatten.cpp | 4 ++-- src/passes/Inlining.cpp | 4 ++-- src/passes/LegalizeJSInterface.cpp | 4 ++-- src/passes/LocalCSE.cpp | 4 ++-- src/passes/MergeBlocks.cpp | 4 ++-- src/passes/NameList.cpp | 2 +- src/passes/OptimizeInstructions.cpp | 14 ++++++------ src/passes/PickLoadSigns.cpp | 2 +- src/passes/PostEmscripten.cpp | 2 +- src/passes/Precompute.cpp | 8 +++---- src/passes/Print.cpp | 2 +- src/passes/PrintCallGraph.cpp | 3 ++- src/passes/ReReloop.cpp | 2 +- src/passes/RelooperJumpThreading.cpp | 4 ++-- src/passes/RemoveUnusedBrs.cpp | 6 +++--- src/passes/RemoveUnusedModuleElements.cpp | 2 +- src/passes/SSAify.cpp | 4 ++-- src/passes/SafeHeap.cpp | 4 ++-- src/passes/SimplifyLocals.cpp | 8 +++---- src/passes/TrapMode.cpp | 2 +- src/passes/Vacuum.cpp | 6 +++--- src/tools/asm2wasm.cpp | 2 +- src/tools/s2wasm.cpp | 2 +- src/tools/translate-to-fuzz.h | 2 +- src/tools/wasm-ctor-eval.cpp | 8 +++---- src/tools/wasm-reduce.cpp | 2 +- src/wasm-builder.h | 2 +- src/wasm-linker.cpp | 2 +- src/wasm/wasm-binary.cpp | 4 ++-- src/wasm/wasm-s-parser.cpp | 2 +- src/wasm/wasm-validator.cpp | 4 ++-- src/wasm/wasm.cpp | 2 +- src/wasm2asm.h | 2 +- 69 files changed, 172 insertions(+), 171 deletions(-) rename src/{ast => ir}/CMakeLists.txt (56%) rename src/{ast => ir}/ExpressionAnalyzer.cpp (99%) rename src/{ast => ir}/ExpressionManipulator.cpp (99%) rename src/{ast => ir}/LocalGraph.cpp (99%) rename src/{ast => ir}/bits.h (96%) rename src/{ast => ir}/block-utils.h (94%) rename src/{ast => ir}/branch-utils.h (98%) rename src/{ast => ir}/cost.h (99%) rename src/{ast => ir}/count.h (94%) rename src/{ast => ir}/effects.h (99%) rename src/{ast => ir}/find_all.h (93%) rename src/{ast => ir}/global-utils.h (94%) rename src/{ast => ir}/hashed.h (94%) rename src/{ast => ir}/import-utils.h (93%) rename src/{ast => ir}/label-utils.h (94%) rename src/{ast => ir}/literal-utils.h (93%) rename src/{ast => ir}/load-utils.h (93%) rename src/{ast => ir}/local-graph.h (97%) rename src/{ast => ir}/localize.h (93%) rename src/{ast => ir}/manipulation.h (95%) rename src/{ast => ir}/memory-utils.h (95%) rename src/{ast => ir}/module-utils.h (95%) rename src/{ast => ir}/properties.h (97%) rename src/{ast => ir}/trapping.h (96%) rename src/{ast => ir}/type-updating.h (98%) rename src/{ast_utils.h => ir/utils.h} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a5e2d99043..b41f15b9fd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,7 +174,7 @@ ENDIF() # Current (partial) dependency structure is as follows: # passes -> wasm -> asmjs -> support # TODO: It's odd that wasm should depend on asmjs, maybe we should fix that. -ADD_SUBDIRECTORY(src/ast) +ADD_SUBDIRECTORY(src/ir) ADD_SUBDIRECTORY(src/asmjs) ADD_SUBDIRECTORY(src/cfg) ADD_SUBDIRECTORY(src/emscripten-optimizer) @@ -193,7 +193,7 @@ IF(BUILD_STATIC_LIB) ELSE() ADD_LIBRARY(binaryen SHARED ${binaryen_SOURCES}) ENDIF() -TARGET_LINK_LIBRARIES(binaryen passes wasm asmjs emscripten-optimizer ast cfg support) +TARGET_LINK_LIBRARIES(binaryen passes wasm asmjs emscripten-optimizer ir cfg support) INSTALL(TARGETS binaryen DESTINATION ${CMAKE_INSTALL_LIBDIR}) INSTALL(FILES src/binaryen-c.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) @@ -206,7 +206,7 @@ SET(wasm-shell_SOURCES ) ADD_EXECUTABLE(wasm-shell ${wasm-shell_SOURCES}) -TARGET_LINK_LIBRARIES(wasm-shell wasm asmjs emscripten-optimizer passes ast cfg support) +TARGET_LINK_LIBRARIES(wasm-shell wasm asmjs emscripten-optimizer passes ir cfg support) SET_PROPERTY(TARGET wasm-shell PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm-shell PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm-shell DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -217,7 +217,7 @@ SET(wasm-opt_SOURCES ) ADD_EXECUTABLE(wasm-opt ${wasm-opt_SOURCES}) -TARGET_LINK_LIBRARIES(wasm-opt wasm asmjs emscripten-optimizer passes ast cfg support) +TARGET_LINK_LIBRARIES(wasm-opt wasm asmjs emscripten-optimizer passes ir cfg support) SET_PROPERTY(TARGET wasm-opt PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm-opt PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm-opt DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -227,7 +227,7 @@ SET(wasm-merge_SOURCES ) ADD_EXECUTABLE(wasm-merge ${wasm-merge_SOURCES}) -TARGET_LINK_LIBRARIES(wasm-merge wasm asmjs emscripten-optimizer passes ast cfg support) +TARGET_LINK_LIBRARIES(wasm-merge wasm asmjs emscripten-optimizer passes ir cfg support) SET_PROPERTY(TARGET wasm-merge PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm-merge PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm-merge DESTINATION bin) @@ -238,7 +238,7 @@ SET(asm2wasm_SOURCES ) ADD_EXECUTABLE(asm2wasm ${asm2wasm_SOURCES}) -TARGET_LINK_LIBRARIES(asm2wasm emscripten-optimizer passes wasm asmjs ast cfg support) +TARGET_LINK_LIBRARIES(asm2wasm emscripten-optimizer passes wasm asmjs ir cfg support) SET_PROPERTY(TARGET asm2wasm PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET asm2wasm PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS asm2wasm DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -248,7 +248,7 @@ SET(wasm2asm_SOURCES ) ADD_EXECUTABLE(wasm2asm ${wasm2asm_SOURCES}) -TARGET_LINK_LIBRARIES(wasm2asm passes wasm asmjs emscripten-optimizer ast cfg support) +TARGET_LINK_LIBRARIES(wasm2asm passes wasm asmjs emscripten-optimizer ir cfg support) SET_PROPERTY(TARGET wasm2asm PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm2asm PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm2asm DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -260,7 +260,7 @@ SET(s2wasm_SOURCES ) ADD_EXECUTABLE(s2wasm ${s2wasm_SOURCES}) -TARGET_LINK_LIBRARIES(s2wasm passes wasm asmjs ast cfg support) +TARGET_LINK_LIBRARIES(s2wasm passes wasm asmjs ir cfg support) SET_PROPERTY(TARGET s2wasm PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET s2wasm PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS s2wasm DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -270,7 +270,7 @@ SET(wasm_as_SOURCES ) ADD_EXECUTABLE(wasm-as ${wasm_as_SOURCES}) -TARGET_LINK_LIBRARIES(wasm-as wasm asmjs passes ast cfg support) +TARGET_LINK_LIBRARIES(wasm-as wasm asmjs passes ir cfg support) SET_PROPERTY(TARGET wasm-as PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm-as PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm-as DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -280,7 +280,7 @@ SET(wasm_dis_SOURCES ) ADD_EXECUTABLE(wasm-dis ${wasm_dis_SOURCES}) -TARGET_LINK_LIBRARIES(wasm-dis passes wasm asmjs ast cfg support) +TARGET_LINK_LIBRARIES(wasm-dis passes wasm asmjs ir cfg support) SET_PROPERTY(TARGET wasm-dis PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm-dis PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm-dis DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -290,7 +290,7 @@ SET(wasm-ctor-eval_SOURCES ) ADD_EXECUTABLE(wasm-ctor-eval ${wasm-ctor-eval_SOURCES}) -TARGET_LINK_LIBRARIES(wasm-ctor-eval emscripten-optimizer passes wasm asmjs ast cfg support) +TARGET_LINK_LIBRARIES(wasm-ctor-eval emscripten-optimizer passes wasm asmjs ir cfg support) SET_PROPERTY(TARGET wasm-ctor-eval PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm-ctor-eval PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm-ctor-eval DESTINATION bin) @@ -303,7 +303,7 @@ IF (UNIX) # TODO: port to windows ) ADD_EXECUTABLE(wasm-reduce ${wasm-reduce_SOURCES}) - TARGET_LINK_LIBRARIES(wasm-reduce wasm asmjs passes wasm ast cfg support) + TARGET_LINK_LIBRARIES(wasm-reduce wasm asmjs passes wasm ir cfg support) SET_PROPERTY(TARGET wasm-reduce PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET wasm-reduce PROPERTY CXX_STANDARD_REQUIRED ON) INSTALL(TARGETS wasm-reduce DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/README.md b/README.md index 9a23b30819a..450c0bbd386 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,15 @@ Consult the [contributing instructions](Contributing.md) if you're interested in ## Binaryen IR -Binaryen's internal IR is an AST, designed to be +Binaryen's internal IR is designed to be * **Flexible and fast** for optimization. * **As close as possible to WebAssembly** so it is simple and fast to convert it to and from WebAssembly. There are a few differences between Binaryen IR and the WebAssembly language: - * AST structure - * Binaryen IR [is an AST](https://github.com/WebAssembly/binaryen/issues/663) (i.e. it has hierarchical structure), for convenience of optimization. This differs from the WebAssembly binary format which is a stack machine. + * Tree structure + * Binaryen IR [is an tree](https://github.com/WebAssembly/binaryen/issues/663), i.e., it has hierarchical structure, for convenience of optimization. This differs from the WebAssembly binary format which is a stack machine. * Consequently Binaryen's text format allows only s-expressions. WebAssembly's official text format is primarily a linear instruction list (with s-expression extensions). Binaryen can't read the linear style, but it can read a wasm text file if it contains only s-expressions. * Types and unreachable code * WebAssembly limits block/if/loop types to none and the concrete value types (i32, i64, f32, f64). Binaryen IR has an unreachable type, and it allows block/if/loop to take it, allowing [local transforms that don't need to know the global context](https://github.com/WebAssembly/binaryen/issues/903). diff --git a/src/asm2wasm.h b/src/asm2wasm.h index 9a4305f6a35..c02376963a1 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -31,11 +31,11 @@ #include "passes/passes.h" #include "pass.h" #include "parsing.h" -#include "ast_utils.h" -#include "ast/bits.h" -#include "ast/branch-utils.h" -#include "ast/literal-utils.h" -#include "ast/trapping.h" +#include "ir/bits.h" +#include "ir/branch-utils.h" +#include "ir/literal-utils.h" +#include "ir/trapping.h" +#include "ir/utils.h" #include "wasm-builder.h" #include "wasm-emscripten.h" #include "wasm-module-building.h" diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 0384317825d..15635c94051 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -31,7 +31,7 @@ #include "wasm-validator.h" #include "wasm2asm.h" #include "cfg/Relooper.h" -#include "ast_utils.h" +#include "ir/utils.h" #include "shell-interface.h" using namespace wasm; diff --git a/src/cfg/Relooper.cpp b/src/cfg/Relooper.cpp index b326d761dc4..22b455aaf36 100644 --- a/src/cfg/Relooper.cpp +++ b/src/cfg/Relooper.cpp @@ -23,7 +23,7 @@ #include #include -#include "ast_utils.h" +#include "ir/utils.h" #include "parsing.h" namespace CFG { diff --git a/src/ast/CMakeLists.txt b/src/ir/CMakeLists.txt similarity index 56% rename from src/ast/CMakeLists.txt rename to src/ir/CMakeLists.txt index c01deaaafc1..607207968c2 100644 --- a/src/ast/CMakeLists.txt +++ b/src/ir/CMakeLists.txt @@ -1,6 +1,6 @@ -SET(ast_SOURCES +SET(ir_SOURCES ExpressionAnalyzer.cpp ExpressionManipulator.cpp LocalGraph.cpp ) -ADD_LIBRARY(ast STATIC ${ast_SOURCES}) +ADD_LIBRARY(ir STATIC ${ir_SOURCES}) diff --git a/src/ast/ExpressionAnalyzer.cpp b/src/ir/ExpressionAnalyzer.cpp similarity index 99% rename from src/ast/ExpressionAnalyzer.cpp rename to src/ir/ExpressionAnalyzer.cpp index d223bf213d6..05450d56701 100644 --- a/src/ast/ExpressionAnalyzer.cpp +++ b/src/ir/ExpressionAnalyzer.cpp @@ -15,8 +15,8 @@ */ #include "support/hash.h" -#include "ast_utils.h" -#include "ast/load-utils.h" +#include "ir/utils.h" +#include "ir/load-utils.h" namespace wasm { // Given a stack of expressions, checks if the topmost is used as a result. diff --git a/src/ast/ExpressionManipulator.cpp b/src/ir/ExpressionManipulator.cpp similarity index 99% rename from src/ast/ExpressionManipulator.cpp rename to src/ir/ExpressionManipulator.cpp index 6cb0219c533..aa2a103882e 100644 --- a/src/ast/ExpressionManipulator.cpp +++ b/src/ir/ExpressionManipulator.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "ast_utils.h" +#include "ir/utils.h" #include "support/hash.h" namespace wasm { diff --git a/src/ast/LocalGraph.cpp b/src/ir/LocalGraph.cpp similarity index 99% rename from src/ast/LocalGraph.cpp rename to src/ir/LocalGraph.cpp index 0d36fec84eb..cee187c6dc1 100644 --- a/src/ast/LocalGraph.cpp +++ b/src/ir/LocalGraph.cpp @@ -18,8 +18,8 @@ #include #include -#include -#include +#include +#include namespace wasm { diff --git a/src/ast/bits.h b/src/ir/bits.h similarity index 96% rename from src/ast/bits.h rename to src/ir/bits.h index 7a86e70f4f0..4196b74c11a 100644 --- a/src/ast/bits.h +++ b/src/ir/bits.h @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef wasm_ast_bits_h -#define wasm_ast_bits_h +#ifndef wasm_ir_bits_h +#define wasm_ir_bits_h #include "support/bits.h" #include "wasm-builder.h" -#include "ast/literal-utils.h" +#include "ir/literal-utils.h" namespace wasm { @@ -103,5 +103,5 @@ struct Bits { } // namespace wasm -#endif // wasm_ast_bits_h +#endif // wasm_ir_bits_h diff --git a/src/ast/block-utils.h b/src/ir/block-utils.h similarity index 94% rename from src/ast/block-utils.h rename to src/ir/block-utils.h index 56c11f24058..f7c68aa3966 100644 --- a/src/ast/block-utils.h +++ b/src/ir/block-utils.h @@ -14,13 +14,13 @@ * limitations under the License. */ -#ifndef wasm_ast_block_h -#define wasm_ast_block_h +#ifndef wasm_ir_block_h +#define wasm_ir_block_h #include "literal.h" #include "wasm.h" -#include "ast/branch-utils.h" -#include "ast/effects.h" +#include "ir/branch-utils.h" +#include "ir/effects.h" namespace wasm { @@ -63,5 +63,5 @@ namespace BlockUtils { } // namespace wasm -#endif // wasm_ast_block_h +#endif // wasm_ir_block_h diff --git a/src/ast/branch-utils.h b/src/ir/branch-utils.h similarity index 98% rename from src/ast/branch-utils.h rename to src/ir/branch-utils.h index d574945eff5..26e8e7c87dc 100644 --- a/src/ast/branch-utils.h +++ b/src/ir/branch-utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_branch_h -#define wasm_ast_branch_h +#ifndef wasm_ir_branch_h +#define wasm_ir_branch_h #include "wasm.h" #include "wasm-traversal.h" @@ -179,5 +179,5 @@ struct BranchSeeker : public PostWalker { } // namespace wasm -#endif // wasm_ast_branch_h +#endif // wasm_ir_branch_h diff --git a/src/ast/cost.h b/src/ir/cost.h similarity index 99% rename from src/ast/cost.h rename to src/ir/cost.h index 56050b1896c..9a97574f42b 100644 --- a/src/ast/cost.h +++ b/src/ir/cost.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_cost_h -#define wasm_ast_cost_h +#ifndef wasm_ir_cost_h +#define wasm_ir_cost_h namespace wasm { @@ -251,5 +251,5 @@ struct CostAnalyzer : public Visitor { } // namespace wasm -#endif // wasm_ast_cost_h +#endif // wasm_ir_cost_h diff --git a/src/ast/count.h b/src/ir/count.h similarity index 94% rename from src/ast/count.h rename to src/ir/count.h index 098df9e2752..1fef3a870f0 100644 --- a/src/ast/count.h +++ b/src/ir/count.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_count_h -#define wasm_ast_count_h +#ifndef wasm_ir_count_h +#define wasm_ir_count_h namespace wasm { @@ -46,5 +46,5 @@ struct GetLocalCounter : public PostWalker { } // namespace wasm -#endif // wasm_ast_count_h +#endif // wasm_ir_count_h diff --git a/src/ast/effects.h b/src/ir/effects.h similarity index 99% rename from src/ast/effects.h rename to src/ir/effects.h index 1ae27d2a785..98911d451eb 100644 --- a/src/ast/effects.h +++ b/src/ir/effects.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_effects_h -#define wasm_ast_effects_h +#ifndef wasm_ir_effects_h +#define wasm_ir_effects_h namespace wasm { @@ -275,4 +275,4 @@ struct EffectAnalyzer : public PostWalker { } // namespace wasm -#endif // wasm_ast_effects_h +#endif // wasm_ir_effects_h diff --git a/src/ast/find_all.h b/src/ir/find_all.h similarity index 93% rename from src/ast/find_all.h rename to src/ir/find_all.h index 98fe4c5a74d..83c7516661b 100644 --- a/src/ast/find_all.h +++ b/src/ir/find_all.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_find_all_h -#define wasm_ast_find_all_h +#ifndef wasm_ir_find_all_h +#define wasm_ir_find_all_h #include @@ -44,5 +44,5 @@ struct FindAll { } // namespace wasm -#endif // wasm_ast_find_all_h +#endif // wasm_ir_find_all_h diff --git a/src/ast/global-utils.h b/src/ir/global-utils.h similarity index 94% rename from src/ast/global-utils.h rename to src/ir/global-utils.h index 96fec282bf3..bcf0dae72e0 100644 --- a/src/ast/global-utils.h +++ b/src/ir/global-utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_global_h -#define wasm_ast_global_h +#ifndef wasm_ir_global_h +#define wasm_ir_global_h #include #include @@ -51,5 +51,5 @@ namespace GlobalUtils { } // namespace wasm -#endif // wasm_ast_global_h +#endif // wasm_ir_global_h diff --git a/src/ast/hashed.h b/src/ir/hashed.h similarity index 94% rename from src/ast/hashed.h rename to src/ir/hashed.h index 04ee7f40197..dc4012455d0 100644 --- a/src/ast/hashed.h +++ b/src/ir/hashed.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef _wasm_ast_hashed_h +#ifndef _wasm_ir_hashed_h #include "support/hash.h" #include "wasm.h" -#include "ast_utils.h" +#include "ir/utils.h" namespace wasm { @@ -55,5 +55,5 @@ class HashedExpressionMap : public std::unordered_map { } // namespace wasm -#endif // wasm_ast_label_h +#endif // wasm_ir_label_h diff --git a/src/ast/literal-utils.h b/src/ir/literal-utils.h similarity index 93% rename from src/ast/literal-utils.h rename to src/ir/literal-utils.h index afa8146b940..a702c52ebe4 100644 --- a/src/ast/literal-utils.h +++ b/src/ir/literal-utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_literl_utils_h -#define wasm_ast_literl_utils_h +#ifndef wasm_ir_literal_utils_h +#define wasm_ir_literal_utils_h #include "wasm.h" @@ -52,5 +52,5 @@ inline Expression* makeZero(WasmType type, Module& wasm) { } // namespace wasm -#endif // wasm_ast_literl_utils_h +#endif // wasm_ir_literal_utils_h diff --git a/src/ast/load-utils.h b/src/ir/load-utils.h similarity index 93% rename from src/ast/load-utils.h rename to src/ir/load-utils.h index d5817ff513a..edc7eb90f76 100644 --- a/src/ast/load-utils.h +++ b/src/ir/load-utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_load_h -#define wasm_ast_load_h +#ifndef wasm_ir_load_h +#define wasm_ir_load_h #include "wasm.h" @@ -36,5 +36,5 @@ inline bool isSignRelevant(Load* load) { } // namespace wasm -#endif // wasm_ast_load_h +#endif // wasm_ir_load_h diff --git a/src/ast/local-graph.h b/src/ir/local-graph.h similarity index 97% rename from src/ast/local-graph.h rename to src/ir/local-graph.h index 03915da5eb1..4c4c1ee0a10 100644 --- a/src/ast/local-graph.h +++ b/src/ir/local-graph.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_local_graph_h -#define wasm_ast_local_graph_h +#ifndef wasm_ir_local_graph_h +#define wasm_ir_local_graph_h namespace wasm { @@ -107,5 +107,5 @@ struct LocalGraph : public PostWalker { } // namespace wasm -#endif // wasm_ast_local_graph_h +#endif // wasm_ir_local_graph_h diff --git a/src/ast/localize.h b/src/ir/localize.h similarity index 93% rename from src/ast/localize.h rename to src/ir/localize.h index 9e7dd6653e2..c910d9f9bac 100644 --- a/src/ast/localize.h +++ b/src/ir/localize.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_localizer_h -#define wasm_ast_localizer_h +#ifndef wasm_ir_localizer_h +#define wasm_ir_localizer_h #include @@ -43,5 +43,5 @@ struct Localizer { } // namespace wasm -#endif // wasm_ast_localizer_h +#endif // wasm_ir_localizer_h diff --git a/src/ast/manipulation.h b/src/ir/manipulation.h similarity index 95% rename from src/ast/manipulation.h rename to src/ir/manipulation.h index 29b6a346daf..57188ad6841 100644 --- a/src/ast/manipulation.h +++ b/src/ir/manipulation.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_manipulation_h -#define wasm_ast_manipulation_h +#ifndef wasm_ir_manipulation_h +#define wasm_ir_manipulation_h #include "wasm.h" @@ -65,5 +65,5 @@ namespace ExpressionManipulator { } // wasm -#endif // wams_ast_manipulation_h +#endif // wams_ir_manipulation_h diff --git a/src/ast/memory-utils.h b/src/ir/memory-utils.h similarity index 95% rename from src/ast/memory-utils.h rename to src/ir/memory-utils.h index dfb33837dfa..920583f7d92 100644 --- a/src/ast/memory-utils.h +++ b/src/ir/memory-utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_memory_h -#define wasm_ast_memory_h +#ifndef wasm_ir_memory_h +#define wasm_ir_memory_h #include #include @@ -52,5 +52,5 @@ namespace MemoryUtils { } // namespace wasm -#endif // wasm_ast_memory_h +#endif // wasm_ir_memory_h diff --git a/src/ast/module-utils.h b/src/ir/module-utils.h similarity index 95% rename from src/ast/module-utils.h rename to src/ir/module-utils.h index 11a5a35300c..0c828f83ad1 100644 --- a/src/ast/module-utils.h +++ b/src/ir/module-utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_module_h -#define wasm_ast_module_h +#ifndef wasm_ir_module_h +#define wasm_ir_module_h #include "wasm.h" @@ -55,5 +55,5 @@ struct BinaryIndexes { } // namespace wasm -#endif // wasm_ast_module_h +#endif // wasm_ir_module_h diff --git a/src/ast/properties.h b/src/ir/properties.h similarity index 97% rename from src/ast/properties.h rename to src/ir/properties.h index 8c8655c07fd..cf481218c05 100644 --- a/src/ast/properties.h +++ b/src/ir/properties.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef wasm_ast_properties_h -#define wasm_ast_properties_h +#ifndef wasm_ir_properties_h +#define wasm_ir_properties_h #include "wasm.h" -#include "ast/bits.h" +#include "ir/bits.h" namespace wasm { @@ -137,5 +137,5 @@ struct Properties { } // wasm -#endif // wams_ast_properties_h +#endif // wams_ir_properties_h diff --git a/src/ast/trapping.h b/src/ir/trapping.h similarity index 96% rename from src/ast/trapping.h rename to src/ir/trapping.h index 7b170ccb46a..a3a87f8efbb 100644 --- a/src/ast/trapping.h +++ b/src/ir/trapping.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_trapping_h -#define wasm_ast_trapping_h +#ifndef wasm_ir_trapping_h +#define wasm_ir_trapping_h #include @@ -117,4 +117,4 @@ inline TrapMode trapModeFromString(std::string const& str) { } // wasm -#endif // wasm_ast_trapping_h +#endif // wasm_ir_trapping_h diff --git a/src/ast/type-updating.h b/src/ir/type-updating.h similarity index 98% rename from src/ast/type-updating.h rename to src/ir/type-updating.h index c5f1d534449..79b26aa433b 100644 --- a/src/ast/type-updating.h +++ b/src/ir/type-updating.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef wasm_ast_type_updating_h -#define wasm_ast_type_updating_h +#ifndef wasm_ir_type_updating_h +#define wasm_ir_type_updating_h #include "wasm-traversal.h" @@ -283,4 +283,4 @@ struct TypeUpdater : public ExpressionStackWalker #include #include -#include +#include namespace wasm { diff --git a/src/passes/DeadCodeElimination.cpp b/src/passes/DeadCodeElimination.cpp index 5c0cfc2915d..97c63baf535 100644 --- a/src/passes/DeadCodeElimination.cpp +++ b/src/passes/DeadCodeElimination.cpp @@ -32,9 +32,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace wasm { diff --git a/src/passes/DuplicateFunctionElimination.cpp b/src/passes/DuplicateFunctionElimination.cpp index a96bd8fdfa7..c7852237be8 100644 --- a/src/passes/DuplicateFunctionElimination.cpp +++ b/src/passes/DuplicateFunctionElimination.cpp @@ -22,7 +22,7 @@ #include "wasm.h" #include "pass.h" -#include "ast_utils.h" +#include "ir/utils.h" #include "support/hash.h" namespace wasm { diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index b16d9df3f2a..00130838e22 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -51,8 +51,8 @@ #include #include #include -#include -#include +#include +#include namespace wasm { diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp index e5fdcbb9d1b..b3e111e5ab9 100644 --- a/src/passes/Inlining.cpp +++ b/src/passes/Inlining.cpp @@ -32,8 +32,8 @@ #include #include #include -#include -#include +#include +#include #include namespace wasm { diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp index cbd34e4075b..7f6ee6b48ca 100644 --- a/src/passes/LegalizeJSInterface.cpp +++ b/src/passes/LegalizeJSInterface.cpp @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include +#include namespace wasm { diff --git a/src/passes/LocalCSE.cpp b/src/passes/LocalCSE.cpp index 609caf43af9..7b27e06d314 100644 --- a/src/passes/LocalCSE.cpp +++ b/src/passes/LocalCSE.cpp @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include +#include namespace wasm { diff --git a/src/passes/MergeBlocks.cpp b/src/passes/MergeBlocks.cpp index 619d7b5a507..798ad927fa1 100644 --- a/src/passes/MergeBlocks.cpp +++ b/src/passes/MergeBlocks.cpp @@ -64,8 +64,8 @@ #include #include #include -#include -#include +#include +#include namespace wasm { diff --git a/src/passes/NameList.cpp b/src/passes/NameList.cpp index 85bac62e99c..ebc3a5c55d0 100644 --- a/src/passes/NameList.cpp +++ b/src/passes/NameList.cpp @@ -20,7 +20,7 @@ #include "wasm.h" #include "pass.h" -#include "ast_utils.h" +#include "ir/utils.h" namespace wasm { diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index ada95aee6c1..5194c8ce73b 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -24,13 +24,13 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // TODO: Use the new sign-extension opcodes where appropriate. This needs to be conditionalized on the availability of atomics. diff --git a/src/passes/PickLoadSigns.cpp b/src/passes/PickLoadSigns.cpp index d7947960ce2..82734683931 100644 --- a/src/passes/PickLoadSigns.cpp +++ b/src/passes/PickLoadSigns.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include namespace wasm { diff --git a/src/passes/PostEmscripten.cpp b/src/passes/PostEmscripten.cpp index 937a70e36e2..a7f0e628237 100644 --- a/src/passes/PostEmscripten.cpp +++ b/src/passes/PostEmscripten.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include namespace wasm { diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index d2a7d0b9af2..f4c20d0d0c5 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -22,10 +22,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace wasm { diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index beae693d91e..ed868deb6c1 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace wasm { diff --git a/src/passes/PrintCallGraph.cpp b/src/passes/PrintCallGraph.cpp index 30a33e9ad48..ac11dfb8bc0 100644 --- a/src/passes/PrintCallGraph.cpp +++ b/src/passes/PrintCallGraph.cpp @@ -21,9 +21,10 @@ #include #include + #include "wasm.h" #include "pass.h" -#include "ast_utils.h" +#include "ir/utils.h" namespace wasm { diff --git a/src/passes/ReReloop.cpp b/src/passes/ReReloop.cpp index c36363ba942..99e60a72fe7 100644 --- a/src/passes/ReReloop.cpp +++ b/src/passes/ReReloop.cpp @@ -28,7 +28,7 @@ #include "wasm-traversal.h" #include "pass.h" #include "cfg/Relooper.h" -#include "ast_utils.h" +#include "ir/utils.h" #ifdef RERELOOP_DEBUG #include diff --git a/src/passes/RelooperJumpThreading.cpp b/src/passes/RelooperJumpThreading.cpp index ad7582fb40a..db865d1bb0c 100644 --- a/src/passes/RelooperJumpThreading.cpp +++ b/src/passes/RelooperJumpThreading.cpp @@ -21,8 +21,8 @@ #include "wasm.h" #include "pass.h" -#include "ast_utils.h" -#include "ast/manipulation.h" +#include "ir/utils.h" +#include "ir/manipulation.h" namespace wasm { diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index d2cdec7ad3a..33ffc42b6c4 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -20,9 +20,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace wasm { diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp index d9f6a79785a..8bf2f9c9a46 100644 --- a/src/passes/RemoveUnusedModuleElements.cpp +++ b/src/passes/RemoveUnusedModuleElements.cpp @@ -25,7 +25,7 @@ #include "wasm.h" #include "pass.h" -#include "ast_utils.h" +#include "ir/utils.h" #include "asm_v_wasm.h" namespace wasm { diff --git a/src/passes/SSAify.cpp b/src/passes/SSAify.cpp index aafea8a973a..fd274e28d58 100644 --- a/src/passes/SSAify.cpp +++ b/src/passes/SSAify.cpp @@ -34,8 +34,8 @@ #include "pass.h" #include "wasm-builder.h" #include "support/permutations.h" -#include "ast/literal-utils.h" -#include "ast/local-graph.h" +#include "ir/literal-utils.h" +#include "ir/local-graph.h" namespace wasm { diff --git a/src/passes/SafeHeap.cpp b/src/passes/SafeHeap.cpp index 046f86857f5..3349f983ac2 100644 --- a/src/passes/SafeHeap.cpp +++ b/src/passes/SafeHeap.cpp @@ -25,8 +25,8 @@ #include "asm_v_wasm.h" #include "asmjs/shared-constants.h" #include "wasm-builder.h" -#include "ast/bits.h" -#include "ast/import-utils.h" +#include "ir/bits.h" +#include "ir/import-utils.h" namespace wasm { diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index cf64517b761..f6997d14e07 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -45,10 +45,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace wasm { diff --git a/src/passes/TrapMode.cpp b/src/passes/TrapMode.cpp index 2cb7b2f6b34..727d611025c 100644 --- a/src/passes/TrapMode.cpp +++ b/src/passes/TrapMode.cpp @@ -22,7 +22,7 @@ #include "asm_v_wasm.h" #include "asmjs/shared-constants.h" -#include "ast/trapping.h" +#include "ir/trapping.h" #include "mixed_arena.h" #include "pass.h" #include "wasm.h" diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp index ea2377679a1..4326bbc3b2e 100644 --- a/src/passes/Vacuum.cpp +++ b/src/passes/Vacuum.cpp @@ -21,9 +21,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace wasm { diff --git a/src/tools/asm2wasm.cpp b/src/tools/asm2wasm.cpp index 3ce140b0409..455410cd6b7 100644 --- a/src/tools/asm2wasm.cpp +++ b/src/tools/asm2wasm.cpp @@ -20,7 +20,7 @@ #include -#include "ast/trapping.h" +#include "ir/trapping.h" #include "support/colors.h" #include "support/command-line.h" #include "support/file.h" diff --git a/src/tools/s2wasm.cpp b/src/tools/s2wasm.cpp index 2556cf48284..37604e74ba8 100644 --- a/src/tools/s2wasm.cpp +++ b/src/tools/s2wasm.cpp @@ -20,7 +20,7 @@ #include -#include "ast/trapping.h" +#include "ir/trapping.h" #include "support/colors.h" #include "support/command-line.h" #include "support/file.h" diff --git a/src/tools/translate-to-fuzz.h b/src/tools/translate-to-fuzz.h index 39b183d6e8d..07e01befc2e 100644 --- a/src/tools/translate-to-fuzz.h +++ b/src/tools/translate-to-fuzz.h @@ -26,7 +26,7 @@ high chance for set at start of loop */ #include -#include +#include namespace wasm { diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index dc9b15144e8..631966d408d 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -31,10 +31,10 @@ #include "wasm-io.h" #include "wasm-interpreter.h" #include "wasm-builder.h" -#include "ast/memory-utils.h" -#include "ast/global-utils.h" -#include "ast/import-utils.h" -#include "ast/literal-utils.h" +#include "ir/memory-utils.h" +#include "ir/global-utils.h" +#include "ir/import-utils.h" +#include "ir/literal-utils.h" using namespace wasm; diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index ff3408b9a9f..53c197185a2 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -32,7 +32,7 @@ #include "support/file.h" #include "wasm-io.h" #include "wasm-builder.h" -#include "ast/literal-utils.h" +#include "ir/literal-utils.h" #include "wasm-validator.h" using namespace wasm; diff --git a/src/wasm-builder.h b/src/wasm-builder.h index e5ca7984573..bc670bb8fa8 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -18,7 +18,7 @@ #define wasm_wasm_builder_h #include "wasm.h" -#include "ast/manipulation.h" +#include "ir/manipulation.h" namespace wasm { diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp index c209d3e16c6..b2f337d5a17 100644 --- a/src/wasm-linker.cpp +++ b/src/wasm-linker.cpp @@ -16,7 +16,7 @@ #include "wasm-linker.h" #include "asm_v_wasm.h" -#include "ast_utils.h" +#include "ir/utils.h" #include "s2wasm.h" #include "support/utilities.h" #include "wasm-builder.h" diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index bd0684d281a..43eb94601b9 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -19,8 +19,8 @@ #include "support/bits.h" #include "wasm-binary.h" -#include "ast/branch-utils.h" -#include "ast/module-utils.h" +#include "ir/branch-utils.h" +#include "ir/module-utils.h" namespace wasm { diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 0e329067e01..599eec5b82b 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -22,7 +22,7 @@ #include "asm_v_wasm.h" #include "asmjs/shared-constants.h" -#include "ast/branch-utils.h" +#include "ir/branch-utils.h" #include "shared-constants.h" #include "wasm-binary.h" #include "wasm-builder.h" diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 5120eea7a77..780d74c2d88 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -22,8 +22,8 @@ #include "wasm.h" #include "wasm-printing.h" #include "wasm-validator.h" -#include "ast_utils.h" -#include "ast/branch-utils.h" +#include "ir/utils.h" +#include "ir/branch-utils.h" #include "support/colors.h" diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 6441991c950..8739d96f70c 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -16,7 +16,7 @@ #include "wasm.h" #include "wasm-traversal.h" -#include "ast/branch-utils.h" +#include "ir/branch-utils.h" namespace wasm { diff --git a/src/wasm2asm.h b/src/wasm2asm.h index 028e4d4d5c7..05896aacd13 100644 --- a/src/wasm2asm.h +++ b/src/wasm2asm.h @@ -31,7 +31,7 @@ #include "emscripten-optimizer/optimizer.h" #include "mixed_arena.h" #include "asm_v_wasm.h" -#include "ast_utils.h" +#include "ir/utils.h" #include "passes/passes.h" namespace wasm {