Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/passes/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
18 changes: 9 additions & 9 deletions src/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2654,15 +2654,6 @@ struct ShallowExpression {
Module* module = nullptr;
};

} // namespace wasm

namespace std {
template<> struct hash<wasm::Address> {
size_t operator()(const wasm::Address a) const {
return std::hash<wasm::Address::address64_t>()(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);
Expand All @@ -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<wasm::Address> {
size_t operator()(const wasm::Address a) const {
return std::hash<wasm::Address::address64_t>()(a.addr);
}
};

} // namespace std

#endif // wasm_wasm_h
19 changes: 0 additions & 19 deletions src/wasm/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading