summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-11-23 19:12:37 +0000
committerDan Gohman <dan433584@gmail.com>2015-11-23 19:12:37 +0000
commitf6857223c9fd534825cd8307b9cb37ada230ec83 (patch)
tree13a36c07f79e25ff0d38e247abd05afa0e46cce9 /llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
parent8e8b4fb678016640be0284f6aa73b8806fb76aec (diff)
downloadbcm5719-llvm-f6857223c9fd534825cd8307b9cb37ada230ec83.tar.gz
bcm5719-llvm-f6857223c9fd534825cd8307b9cb37ada230ec83.zip
[WebAssembly] Always print loop end labels
WebAssembly is currently using labels to end scopes, so for example a loop scope looks like this: BB0_0: loop BB0_1 ... BB0_1: with BB0_0 being the label of the first block not in the loop. This requires that the label be printed even when it's only reachable via fallthrough. To arrange this, insert a no-op LOOP_END instruction in such cases at the end of the loop. llvm-svn: 253901
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
index c452e1dd024..f7f37ee8c89 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
@@ -221,6 +221,10 @@ void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) {
// These represent values which are live into the function entry, so there's
// no instruction to emit.
break;
+ case WebAssembly::LOOP_END:
+ // This is a no-op which just exists to tell AsmPrinter.cpp that there's a
+ // fallthrough which nevertheless requires a label for the destination here.
+ break;
default: {
WebAssemblyMCInstLower MCInstLowering(OutContext, *this);
MCInst TmpInst;
OpenPOWER on IntegriCloud