summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/TableGen/WebAssemblyStackifierEmitter.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/WebAssemblyStackifierEmitter.cpp b/llvm/utils/TableGen/WebAssemblyStackifierEmitter.cpp
index de637e5be57..0b9741d22b8 100644
--- a/llvm/utils/TableGen/WebAssemblyStackifierEmitter.cpp
+++ b/llvm/utils/TableGen/WebAssemblyStackifierEmitter.cpp
@@ -17,6 +17,17 @@
namespace llvm {
+// Find all register WebAssembly instructions and their corresponding stack
+// instructions. For each pair, emit a switch case of the form
+//
+// case WebAssembly::RegisterInstr: return WebAssembly::StackInstr;
+//
+// For example,
+//
+// case WebAssembly::ADD_I32: return WebAssembly::ADD_I32_S;
+//
+// This is useful for converting instructions from their register form to their
+// equivalent stack form.
void EmitWebAssemblyStackifier(RecordKeeper &RK, raw_ostream &OS) {
Record *InstrClass = RK.getClass("WebAssemblyInst");
for (auto &RecordPair : RK.getDefs()) {
@@ -26,7 +37,7 @@ void EmitWebAssemblyStackifier(RecordKeeper &RK, raw_ostream &OS) {
if (IsStackBased)
continue;
OS << " case WebAssembly::" << RecordPair.first << ": return "
- << "WebAssembly::" << RecordPair.first << "_S; break;\n";
+ << "WebAssembly::" << RecordPair.first << "_S;\n";
}
}
OpenPOWER on IntegriCloud