summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/fuzzing.h27
-rw-r--r--src/tools/spec-wrapper.h3
-rw-r--r--src/tools/wasm-reduce.cpp15
-rw-r--r--src/tools/wasm2c-wrapper.h6
-rw-r--r--src/tools/wasm2js.cpp8
5 files changed, 36 insertions, 23 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index 95ccf2613..7fef9c208 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -315,7 +315,8 @@ private:
}
SmallVector<Type, 2> options;
options.push_back(type); // includes itself
- switch (type.getSingle()) {
+ TODO_SINGLE_COMPOUND(type);
+ switch (type.getBasic()) {
case Type::externref:
if (wasm.features.hasExceptionHandling()) {
options.push_back(Type::exnref);
@@ -1315,7 +1316,7 @@ private:
Expression* makeNonAtomicLoad(Type type) {
auto offset = logify(get());
auto ptr = makePointer();
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32: {
bool signed_ = get() & 1;
switch (upTo(3)) {
@@ -1421,7 +1422,7 @@ private:
auto offset = logify(get());
auto ptr = makePointer();
auto value = make(type);
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32: {
switch (upTo(3)) {
case 0:
@@ -1581,7 +1582,7 @@ private:
switch (upTo(4)) {
case 0: {
// totally random, entire range
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32:
return Literal(get32());
case Type::i64:
@@ -1626,7 +1627,7 @@ private:
default:
WASM_UNREACHABLE("invalid value");
}
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32:
return Literal(int32_t(small));
case Type::i64:
@@ -1649,7 +1650,7 @@ private:
case 2: {
// special values
Literal value;
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32:
value =
Literal(pick<int32_t>(0,
@@ -1717,7 +1718,7 @@ private:
case 3: {
// powers of 2
Literal value;
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32:
value = Literal(int32_t(1) << upTo(32));
break;
@@ -1794,9 +1795,11 @@ private:
return makeTrivial(type);
}
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32: {
- switch (getSingleConcreteType().getSingle()) {
+ auto singleConcreteType = getSingleConcreteType();
+ TODO_SINGLE_COMPOUND(singleConcreteType);
+ switch (singleConcreteType.getBasic()) {
case Type::i32: {
auto op = pick(
FeatureOptions<UnaryOp>()
@@ -2015,7 +2018,7 @@ private:
return makeTrivial(type);
}
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32: {
switch (upTo(4)) {
case 0:
@@ -2319,7 +2322,7 @@ private:
}
}
Index bytes;
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32: {
switch (upTo(3)) {
case 0:
@@ -2410,7 +2413,7 @@ private:
Expression* makeSIMDExtract(Type type) {
auto op = static_cast<SIMDExtractOp>(0);
- switch (type.getSingle()) {
+ switch (type.getBasic()) {
case Type::i32:
op = pick(ExtractLaneSVecI8x16,
ExtractLaneUVecI8x16,
diff --git a/src/tools/spec-wrapper.h b/src/tools/spec-wrapper.h
index a77dfc43f..3a674e495 100644
--- a/src/tools/spec-wrapper.h
+++ b/src/tools/spec-wrapper.h
@@ -32,7 +32,8 @@ static std::string generateSpecWrapper(Module& wasm) {
exp->name.str + "\" ";
for (Type param : func->sig.params.expand()) {
// zeros in arguments TODO more?
- switch (param.getSingle()) {
+ TODO_SINGLE_COMPOUND(param);
+ switch (param.getBasic()) {
case Type::i32:
ret += "(i32.const 0)";
break;
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index 029b9092d..e0491c0db 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -578,9 +578,11 @@ struct Reducer
continue; // no conversion
}
Expression* fixed = nullptr;
- switch (curr->type.getSingle()) {
+ TODO_SINGLE_COMPOUND(curr->type);
+ switch (curr->type.getBasic()) {
case Type::i32: {
- switch (child->type.getSingle()) {
+ TODO_SINGLE_COMPOUND(child->type);
+ switch (child->type.getBasic()) {
case Type::i32:
WASM_UNREACHABLE("invalid type");
case Type::i64:
@@ -605,7 +607,8 @@ struct Reducer
break;
}
case Type::i64: {
- switch (child->type.getSingle()) {
+ TODO_SINGLE_COMPOUND(child->type);
+ switch (child->type.getBasic()) {
case Type::i32:
fixed = builder->makeUnary(ExtendSInt32, child);
break;
@@ -630,7 +633,8 @@ struct Reducer
break;
}
case Type::f32: {
- switch (child->type.getSingle()) {
+ TODO_SINGLE_COMPOUND(child->type);
+ switch (child->type.getBasic()) {
case Type::i32:
fixed = builder->makeUnary(ConvertSInt32ToFloat32, child);
break;
@@ -655,7 +659,8 @@ struct Reducer
break;
}
case Type::f64: {
- switch (child->type.getSingle()) {
+ TODO_SINGLE_COMPOUND(child->type);
+ switch (child->type.getBasic()) {
case Type::i32:
fixed = builder->makeUnary(ConvertSInt32ToFloat64, child);
break;
diff --git a/src/tools/wasm2c-wrapper.h b/src/tools/wasm2c-wrapper.h
index b3205c6fe..eae92ad60 100644
--- a/src/tools/wasm2c-wrapper.h
+++ b/src/tools/wasm2c-wrapper.h
@@ -123,7 +123,8 @@ int main(int argc, char** argv) {
if (result != Type::none) {
ret += std::string("printf(\"[fuzz-exec] note result: ") + exp->name.str +
" => ";
- switch (result.getSingle()) {
+ TODO_SINGLE_COMPOUND(result);
+ switch (result.getBasic()) {
case Type::i32:
ret += "%d\\n\", ";
break;
@@ -146,7 +147,8 @@ int main(int argc, char** argv) {
auto params = func->sig.params.expand();
auto wasm2cSignature = [](Type type) {
- switch (type.getSingle()) {
+ TODO_SINGLE_COMPOUND(type);
+ switch (type.getBasic()) {
case Type::none:
return 'v';
case Type::i32:
diff --git a/src/tools/wasm2js.cpp b/src/tools/wasm2js.cpp
index 24e4037e7..fb78336d0 100644
--- a/src/tools/wasm2js.cpp
+++ b/src/tools/wasm2js.cpp
@@ -18,13 +18,13 @@
// wasm2js console tool
//
+#include "wasm2js.h"
#include "optimization-options.h"
#include "pass.h"
#include "support/colors.h"
#include "support/command-line.h"
#include "support/file.h"
#include "wasm-s-parser.h"
-#include "wasm2js.h"
using namespace cashew;
using namespace wasm;
@@ -123,7 +123,8 @@ static void traversePrePost(Ref node,
}
static void traversePost(Ref node, std::function<void(Ref)> visit) {
- traversePrePost(node, [](Ref node) {}, visit);
+ traversePrePost(
+ node, [](Ref node) {}, visit);
}
static void replaceInPlace(Ref target, Ref value) {
@@ -604,7 +605,8 @@ Ref AssertionEmitter::emitAssertReturnFunc(Builder& wasmBuilder,
Expression* expected = sexpBuilder.parseExpression(e[2]);
Type resType = expected->type;
actual->type = resType;
- switch (resType.getSingle()) {
+ TODO_SINGLE_COMPOUND(resType);
+ switch (resType.getBasic()) {
case Type::i32:
body = wasmBuilder.makeBinary(EqInt32, actual, expected);
break;