diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 96b5c84edab..2b08ae3c66c 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -3894,10 +3894,6 @@ printStackIR(std::ostream& o, Module* module, const PassOptions& options) { return o; } -} // namespace wasm - -namespace std { - std::ostream& operator<<(std::ostream& o, wasm::Module& module) { wasm::PassRunner runner(&module); wasm::Printer printer(&o); @@ -3958,4 +3954,19 @@ std::ostream& operator<<(std::ostream& o, return o << importNames.module << "." << importNames.name; } -} // namespace std +std::ostream& operator<<(std::ostream& os, wasm::MemoryOrder mo) { + switch (mo) { + case wasm::MemoryOrder::Unordered: + os << "Unordered"; + break; + case wasm::MemoryOrder::SeqCst: + os << "SeqCst"; + break; + case wasm::MemoryOrder::AcqRel: + os << "AcqRel"; + break; + } + return os; +} + +} // namespace wasm diff --git a/src/wasm.h b/src/wasm.h index 67c268e9588..ab6323b5f35 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -2654,15 +2654,6 @@ struct ShallowExpression { Module* module = nullptr; }; -} // namespace wasm - -namespace std { -template<> struct hash { - size_t operator()(const wasm::Address a) const { - return std::hash()(a.addr); - } -}; - std::ostream& operator<<(std::ostream& o, wasm::Module& module); std::ostream& operator<<(std::ostream& o, wasm::Function& func); std::ostream& operator<<(std::ostream& o, wasm::Expression& expression); @@ -2673,6 +2664,15 @@ std::ostream& operator<<(std::ostream& o, wasm::ModuleHeapType pair); std::ostream& operator<<(std::ostream& os, wasm::MemoryOrder mo); std::ostream& operator<<(std::ostream& o, const wasm::ImportNames& importNames); +} // namespace wasm + +namespace std { +template<> struct hash { + size_t operator()(const wasm::Address a) const { + return std::hash()(a.addr); + } +}; + } // namespace std #endif // wasm_wasm_h diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 111f4c9d21d..44c1daea622 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -2015,22 +2015,3 @@ void Module::clearDebugInfo() { } } // namespace wasm - -namespace std { - -std::ostream& operator<<(std::ostream& os, wasm::MemoryOrder mo) { - switch (mo) { - case wasm::MemoryOrder::Unordered: - os << "Unordered"; - break; - case wasm::MemoryOrder::SeqCst: - os << "SeqCst"; - break; - case wasm::MemoryOrder::AcqRel: - os << "AcqRel"; - break; - } - return os; -} - -} // namespace std