summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2020-11-13 11:48:01 -0800
committerGitHub <noreply@github.com>2020-11-13 11:48:01 -0800
commit4989d79fb15dfc01d35be4b595d4246f91a55405 (patch)
tree1aa8eb144de36b802b90d0b45fbf19c9e3e6c064
parent0f49b56029f93c1b54736ed2473d23f457d46894 (diff)
downloadbinaryen-4989d79fb15dfc01d35be4b595d4246f91a55405.tar.gz
binaryen-4989d79fb15dfc01d35be4b595d4246f91a55405.tar.bz2
binaryen-4989d79fb15dfc01d35be4b595d4246f91a55405.zip
Make getExpressionName resemble instruction names (#3352)
This function does not return exact instruction names but more of category names. But when there is a matching instruction, as in case of `global.get/set` or `local.get/set`, it seems to return instruction names. In that regard, this makes `getExpressionName`'s return values to similar to that of real instruction names when possible, in case of some atomic instructions and `memory.init/copy` and `data.drop`. It is hard to make a test for this because this function is used in a very limited way in the codebase, such as: - When printing error messages - When printing a stack instruction names, but only for control flow instructions - When printing instruction names in Metrics
-rw-r--r--src/wasm/wasm.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 5b4a276dd..c7a187b43 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -154,15 +154,15 @@ const char* getExpressionName(Expression* curr) {
case Expression::Id::UnreachableId:
return "unreachable";
case Expression::Id::AtomicCmpxchgId:
- return "atomic_cmpxchg";
+ return "atomic.cmpxchg";
case Expression::Id::AtomicRMWId:
- return "atomic_rmw";
+ return "atomic.rmw";
case Expression::Id::AtomicWaitId:
- return "atomic_wait";
+ return "atomic.wait";
case Expression::Id::AtomicNotifyId:
- return "atomic_notify";
+ return "atomic.notify";
case Expression::Id::AtomicFenceId:
- return "atomic_fence";
+ return "atomic.fence";
case Expression::Id::SIMDExtractId:
return "simd_extract";
case Expression::Id::SIMDReplaceId:
@@ -178,13 +178,13 @@ const char* getExpressionName(Expression* curr) {
case Expression::Id::SIMDLoadStoreLaneId:
return "simd_load_store_lane";
case Expression::Id::MemoryInitId:
- return "memory_init";
+ return "memory.init";
case Expression::Id::DataDropId:
- return "data_drop";
+ return "data.drop";
case Expression::Id::MemoryCopyId:
- return "memory_copy";
+ return "memory.copy";
case Expression::Id::MemoryFillId:
- return "memory_fill";
+ return "memory.fill";
case Expression::Id::PopId:
return "pop";
case Expression::Id::RefNullId: