summaryrefslogtreecommitdiff
path: root/src/passes
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes')
-rw-r--r--src/passes/Precompute.cpp6
-rw-r--r--src/passes/Print.cpp53
-rw-r--r--src/passes/StringLowering.cpp11
3 files changed, 9 insertions, 61 deletions
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp
index 4f9ad046d..295d86b40 100644
--- a/src/passes/Precompute.cpp
+++ b/src/passes/Precompute.cpp
@@ -203,9 +203,9 @@ public:
// string.encode_wtf16_array is effectively an Array read operation, so
// just like ArrayGet above we must check for immutability.
- auto ptrType = curr->ptr->type;
- if (ptrType.isRef()) {
- auto heapType = ptrType.getHeapType();
+ auto refType = curr->ref->type;
+ if (refType.isRef()) {
+ auto heapType = refType.getHeapType();
if (heapType.isArray()) {
if (heapType.getArray().element.mutable_ == Immutable) {
return Super::visitStringNew(curr);
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index ab5e0db90..c57ab29c3 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -2237,32 +2237,6 @@ struct PrintExpressionContents
}
void visitStringNew(StringNew* curr) {
switch (curr->op) {
- case StringNewUTF8:
- if (!curr->try_) {
- printMedium(o, "string.new_utf8");
- } else {
- printMedium(o, "string.new_utf8_try");
- }
- break;
- case StringNewWTF8:
- printMedium(o, "string.new_wtf8");
- break;
- case StringNewLossyUTF8:
- printMedium(o, "string.new_lossy_utf8");
- break;
- case StringNewWTF16:
- printMedium(o, "string.new_wtf16");
- break;
- case StringNewUTF8Array:
- if (!curr->try_) {
- printMedium(o, "string.new_utf8_array");
- } else {
- printMedium(o, "string.new_utf8_array_try");
- }
- break;
- case StringNewWTF8Array:
- printMedium(o, "string.new_wtf8_array");
- break;
case StringNewLossyUTF8Array:
printMedium(o, "string.new_lossy_utf8_array");
break;
@@ -2291,45 +2265,18 @@ struct PrintExpressionContents
case StringMeasureUTF8:
printMedium(o, "string.measure_utf8");
break;
- case StringMeasureWTF8:
- printMedium(o, "string.measure_wtf8");
- break;
case StringMeasureWTF16:
printMedium(o, "string.measure_wtf16");
break;
- case StringMeasureIsUSV:
- printMedium(o, "string.is_usv_sequence");
- break;
- case StringMeasureHash:
- printMedium(o, "string.hash");
- break;
default:
WASM_UNREACHABLE("invalid string.measure*");
}
}
void visitStringEncode(StringEncode* curr) {
switch (curr->op) {
- case StringEncodeUTF8:
- printMedium(o, "string.encode_utf8");
- break;
- case StringEncodeLossyUTF8:
- printMedium(o, "string.encode_lossy_utf8");
- break;
- case StringEncodeWTF8:
- printMedium(o, "string.encode_wtf8");
- break;
- case StringEncodeWTF16:
- printMedium(o, "string.encode_wtf16");
- break;
- case StringEncodeUTF8Array:
- printMedium(o, "string.encode_utf8_array");
- break;
case StringEncodeLossyUTF8Array:
printMedium(o, "string.encode_lossy_utf8_array");
break;
- case StringEncodeWTF8Array:
- printMedium(o, "string.encode_wtf8_array");
- break;
case StringEncodeWTF16Array:
printMedium(o, "string.encode_wtf16_array");
break;
diff --git a/src/passes/StringLowering.cpp b/src/passes/StringLowering.cpp
index 27f4e9c07..9903f090e 100644
--- a/src/passes/StringLowering.cpp
+++ b/src/passes/StringLowering.cpp
@@ -375,12 +375,12 @@ struct StringLowering : public StringGathering {
switch (curr->op) {
case StringNewWTF16Array:
replaceCurrent(builder.makeCall(lowering.fromCharCodeArrayImport,
- {curr->ptr, curr->start, curr->end},
+ {curr->ref, curr->start, curr->end},
lowering.nnExt));
return;
case StringNewFromCodePoint:
replaceCurrent(builder.makeCall(
- lowering.fromCodePointImport, {curr->ptr}, lowering.nnExt));
+ lowering.fromCodePointImport, {curr->ref}, lowering.nnExt));
return;
default:
WASM_UNREACHABLE("TODO: all of string.new*");
@@ -397,9 +397,10 @@ struct StringLowering : public StringGathering {
Builder builder(*getModule());
switch (curr->op) {
case StringEncodeWTF16Array:
- replaceCurrent(builder.makeCall(lowering.intoCharCodeArrayImport,
- {curr->ref, curr->ptr, curr->start},
- Type::i32));
+ replaceCurrent(
+ builder.makeCall(lowering.intoCharCodeArrayImport,
+ {curr->str, curr->array, curr->start},
+ Type::i32));
return;
default:
WASM_UNREACHABLE("TODO: all of string.encode*");