diff options
| author | Dan Gohman <dan433584@gmail.com> | 2015-12-15 02:20:44 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2015-12-15 02:20:44 +0000 |
| commit | dcba338188e4b427356eea5fcad566332bb47e41 (patch) | |
| tree | 54050c0bef391ce63e1901019a46b8c86509ccbf | |
| parent | 65f0a71f40d2525d9d0c306b528209d21c8dd19e (diff) | |
| download | bcm5719-llvm-dcba338188e4b427356eea5fcad566332bb47e41.tar.gz bcm5719-llvm-dcba338188e4b427356eea5fcad566332bb47e41.zip | |
[WebAssembly] Remove .import printing.
For now, LLVM doesn't know about wasm module imports, so it shouldn't
emit .import directives.
llvm-svn: 255602
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | 58 | ||||
| -rw-r--r-- | llvm/test/CodeGen/WebAssembly/import.ll | 32 |
2 files changed, 0 insertions, 90 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index fc2928079d2..c1403fb0c9e 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -71,7 +71,6 @@ private: void EmitConstantPool() override; void EmitFunctionBodyStart() override; void EmitInstruction(const MachineInstr *MI) override; - void EmitEndOfAsmFile(Module &M) override; bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS) override; @@ -213,63 +212,6 @@ void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) { } } -void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) { - const DataLayout &DL = M.getDataLayout(); - - 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.isIntrinsic()) - continue; - if (Str.empty()) - OS << "\t.imports\n"; - - MCSymbol *Sym = OutStreamer->getContext().getOrCreateSymbol(F.getName()); - OS << "\t.import " << *Sym << " \"\" " << *Sym; - - const WebAssemblyTargetLowering &TLI = - *TM.getSubtarget<WebAssemblySubtarget>(F).getTargetLowering(); - - // If we need to legalize the return type, it'll get converted into - // passing a pointer. - bool SawParam = false; - SmallVector<MVT, 4> ResultVTs; - ComputeLegalValueVTs(F, TM, F.getReturnType(), ResultVTs); - if (ResultVTs.size() > 1) { - ResultVTs.clear(); - OS << " (param " << toString(TLI.getPointerTy(DL)); - SawParam = true; - } - - for (const Argument &A : F.args()) { - SmallVector<MVT, 4> ParamVTs; - ComputeLegalValueVTs(F, TM, A.getType(), ParamVTs); - for (MVT VT : ParamVTs) { - if (!SawParam) { - OS << " (param"; - SawParam = true; - } - OS << ' ' << toString(VT); - } - } - if (SawParam) - OS << ')'; - - for (MVT VT : ResultVTs) - OS << " (result " << toString(VT) << ')'; - - OS << '\n'; - } - - StringRef Text = OS.str(); - if (!Text.empty()) - OutStreamer->EmitRawText(Text.substr(0, Text.size() - 1)); - - AsmPrinter::EmitEndOfAsmFile(M); -} - bool WebAssemblyAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, diff --git a/llvm/test/CodeGen/WebAssembly/import.ll b/llvm/test/CodeGen/WebAssembly/import.ll deleted file mode 100644 index 2547bae92ea..00000000000 --- a/llvm/test/CodeGen/WebAssembly/import.ll +++ /dev/null @@ -1,32 +0,0 @@ -; RUN: llc < %s -asm-verbose=false | FileCheck %s - -target datalayout = "e-p:32:32-i64:64-n32:64-S128" -target triple = "wasm32-unknown-unknown" - -; CHECK-LABEL: .text -; CHECK-LABEL: f: -define void @f(i32 %a, float %b, i128 %c, i1 %d) { - tail call i32 @printi(i32 %a) - tail call float @printf(float %b) - tail call void @printv() - tail call void @split_arg(i128 %c) - tail call void @expanded_arg(i1 %d) - tail call i1 @lowered_result() - ret void -} - -; CHECK-LABEL: .imports -; CHECK-NEXT: .import printi "" printi (param i32) (result i32){{$}} -; CHECK-NEXT: .import printf "" printf (param f32) (result f32){{$}} -; CHECK-NEXT: .import printv "" printv{{$}} -; CHECK-NEXT: .import add2 "" add2 (param i32 i32) (result i32){{$}} -; CHECK-NEXT: .import split_arg "" split_arg (param i64 i64){{$}} -; CHECK-NEXT: .import expanded_arg "" expanded_arg (param i32){{$}} -; CHECK-NEXT: .import lowered_result "" lowered_result (result i32){{$}} -declare i32 @printi(i32) -declare float @printf(float) -declare void @printv() -declare i32 @add2(i32, i32) -declare void @split_arg(i128) -declare void @expanded_arg(i1) -declare i1 @lowered_result() |

