[llvm] r255602 - [WebAssembly] Remove .import printing.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 18:20:44 PST 2015


Author: djg
Date: Mon Dec 14 20:20:44 2015
New Revision: 255602

URL: http://llvm.org/viewvc/llvm-project?rev=255602&view=rev
Log:
[WebAssembly] Remove .import printing.

For now, LLVM doesn't know about wasm module imports, so it shouldn't
emit .import directives.

Removed:
    llvm/trunk/test/CodeGen/WebAssembly/import.ll
Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp?rev=255602&r1=255601&r2=255602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp Mon Dec 14 20:20:44 2015
@@ -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::EmitInstruct
   }
 }
 
-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,

Removed: llvm/trunk/test/CodeGen/WebAssembly/import.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/import.ll?rev=255601&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/import.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/import.ll (removed)
@@ -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()




More information about the llvm-commits mailing list