#ifndef wasm_asm_v_wasm_h
#define wasm_asm_v_wasm_h
#include "emscripten-optimizer/optimizer.h"
#include "mixed_arena.h"
#include "wasm.h"
namespace wasm {
Type asmToWasmType(AsmType asmType);
AsmType wasmToAsmType(Type type);
char getSig(Type type);
std::string getSig(Function* func);
std::string getSig(Type results, Type params);
template<typename T,
typename std::enable_if<std::is_base_of<Expression, T>::value>::type* =
nullptr>
std::string getSig(T* call) {
std::string ret;
ret += getSig(call->type);
for (auto operand : call->operands) {
ret += getSig(operand->type);
}
return ret;
}
template<typename ListType>
std::string getSig(Type result, const ListType& operands) {
std::string ret;
ret += getSig(result);
for (auto operand : operands) {
ret += getSig(operand->type);
}
return ret;
}
template<typename ListType>
std::string getSigFromStructs(Type result, const ListType& operands) {
std::string ret;
ret += getSig(result);
for (auto operand : operands) {
ret += getSig(operand.type);
}
return ret;
}
Expression* ensureDouble(Expression* expr, MixedArena& allocator);
}
#endif