Revert "[WebAssembly] Emit type signatures for declared functions"
This reverts r271599, it broke the integration tests.
More places than I expected had nontrival return types in imports, or
else the check was wrong.
llvm-svn: 271606
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
index 3d61c15..789a176 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
@@ -64,16 +64,6 @@
void WebAssemblyTargetAsmStreamer::emitEndFunc() { OS << "\t.endfunc\n"; }
-void WebAssemblyTargetAsmStreamer::emitIndirectFunctionType(
- StringRef name, SmallVectorImpl<MVT> &SignatureVTs, size_t NumResults) {
- OS << "\t.functype\t" << name;
- if (NumResults == 0) OS << ", void";
- for (auto Ty : SignatureVTs) {
- OS << ", " << WebAssembly::TypeToString(Ty);
- }
- OS << "\n";
-}
-
// FIXME: What follows is not the real binary encoding.
static void EncodeTypes(MCStreamer &Streamer, ArrayRef<MVT> Types) {
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
index 51354ef..c66a515 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
@@ -37,12 +37,6 @@
virtual void emitLocal(ArrayRef<MVT> Types) = 0;
/// .endfunc
virtual void emitEndFunc() = 0;
- /// .functype
- virtual void emitIndirectFunctionType(StringRef name,
- SmallVectorImpl<MVT> &SignatureVTs,
- size_t NumResults) {
- llvm_unreachable("emitIndirectFunctionType not implemented");
- }
};
/// This part is for ascii assembly output
@@ -56,9 +50,6 @@
void emitResult(ArrayRef<MVT> Types) override;
void emitLocal(ArrayRef<MVT> Types) override;
void emitEndFunc() override;
- void emitIndirectFunctionType(StringRef name,
- SmallVectorImpl<MVT> &SignatureVTs,
- size_t NumResults) override;
};
/// This part is for ELF object output
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
index 45e43f6..64128bf 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
@@ -67,7 +67,6 @@
// AsmPrinter Implementation.
//===------------------------------------------------------------------===//
- void EmitEndOfAsmFile(Module &M) override;
void EmitJumpTableInfo() override;
void EmitConstantPool() override;
void EmitFunctionBodyStart() override;
@@ -125,6 +124,16 @@
//===----------------------------------------------------------------------===//
// WebAssemblyAsmPrinter Implementation.
//===----------------------------------------------------------------------===//
+
+void WebAssemblyAsmPrinter::EmitConstantPool() {
+ assert(MF->getConstantPool()->getConstants().empty() &&
+ "WebAssembly disables constant pools");
+}
+
+void WebAssemblyAsmPrinter::EmitJumpTableInfo() {
+ // Nothing to do; jump tables are incorporated into the instruction stream.
+}
+
static void ComputeLegalValueVTs(const Function &F, const TargetMachine &TM,
Type *Ty, SmallVectorImpl<MVT> &ValueVTs) {
const DataLayout &DL(F.getParent()->getDataLayout());
@@ -141,36 +150,6 @@
}
}
-void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) {
- for (const auto &F : M) {
- // Emit function type info for all undefined functions
- if (F.isDeclarationForLinker() && !F.isIntrinsic()) {
- SmallVector<MVT, 4> SignatureVTs;
- ComputeLegalValueVTs(F, TM, F.getReturnType(), SignatureVTs);
- if (SignatureVTs.size() > 1) {
- report_fatal_error(
- "Import functions with nontrival return types are not supported");
- }
- size_t NumResults = SignatureVTs.size();
- for (auto &Arg : F.args()) {
- ComputeLegalValueVTs(F, TM, Arg.getType(), SignatureVTs);
- }
-
- getTargetStreamer()->emitIndirectFunctionType(F.getName(), SignatureVTs,
- NumResults);
- }
- }
-}
-
-void WebAssemblyAsmPrinter::EmitConstantPool() {
- assert(MF->getConstantPool()->getConstants().empty() &&
- "WebAssembly disables constant pools");
-}
-
-void WebAssemblyAsmPrinter::EmitJumpTableInfo() {
- // Nothing to do; jump tables are incorporated into the instruction stream.
-}
-
void WebAssemblyAsmPrinter::EmitFunctionBodyStart() {
if (!MFI->getParams().empty())
getTargetStreamer()->emitParam(MFI->getParams());