diff options
author | JF Bastien <jfb@google.com> | 2015-10-30 16:41:21 +0000 |
---|---|---|
committer | JF Bastien <jfb@google.com> | 2015-10-30 16:41:21 +0000 |
commit | 5789a69435290339026e174a8769211544cfeb16 (patch) | |
tree | abca4eb41375b1cb46531b2b9c31ee126b717148 /llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | |
parent | b2978da715b4c7e62d39e1a5f9d92d3dca4998ec (diff) | |
download | llvm-5789a69435290339026e174a8769211544cfeb16.zip llvm-5789a69435290339026e174a8769211544cfeb16.tar.gz llvm-5789a69435290339026e174a8769211544cfeb16.tar.bz2 |
[WebAssembly] Fix import statement
Summary:
Imports should be generated like (param i32 f32...) not (param i32) (param f32) ...
Author: binji
Reviewers: jfb
Subscribers: jfb, dschuff
llvm-svn: 251714
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index 7ee452e..59c1ff3 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -339,24 +339,25 @@ void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) { } void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) { - SmallString<128> Str; - raw_svector_ostream OS(Str); + SmallString<128> Str; + raw_svector_ostream OS(Str); for (const Function &F : M) if (F.isDeclarationForLinker()) { assert(F.hasName() && "imported functions must have a name"); if (F.getName().startswith("llvm.")) - continue; + continue; if (Str.empty()) - OS << "\t.imports\n"; + OS << "\t.imports\n"; Type *Rt = F.getReturnType(); - OS << "\t.import " << toSymbol(F.getName()) << " \"\" \"" << F.getName() - << "\""; + OS << "\t.import " << toSymbol(F.getName()) << " \"\" \"" << F.getName() + << "\" (param"; for (const Argument &A : F.args()) - OS << " (param " << toString(A.getType()) << ')'; + OS << ' ' << toString(A.getType()); + OS << ')'; if (!Rt->isVoidTy()) - OS << " (result " << toString(Rt) << ')'; + OS << " (result " << toString(Rt) << ')'; OS << '\n'; - } + } OutStreamer->EmitRawText(OS.str()); } |