[WebAssembly] Remove .import printing.
authorDan Gohman <dan433584@gmail.com>
Tue, 15 Dec 2015 02:20:44 +0000 (02:20 +0000)
committerDan Gohman <dan433584@gmail.com>
Tue, 15 Dec 2015 02:20:44 +0000 (02:20 +0000)
For now, LLVM doesn't know about wasm module imports, so it shouldn't
emit .import directives.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255602 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
test/CodeGen/WebAssembly/import.ll [deleted file]

index fc2928079d2c8c4a696484a193695f49b0b22ded..c1403fb0c9e797de871027335537db769098bbb6 100644 (file)
@@ -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/test/CodeGen/WebAssembly/import.ll b/test/CodeGen/WebAssembly/import.ll
deleted file mode 100644 (file)
index 2547bae..0000000
+++ /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()