[WebAssembly] Switch to a more traditional assembly syntax
This new syntax is built around putting each instruction on its own line
in a "mnemonic op, op, op" like syntax. It also uses conventional data
section directives like ".byte" and so on rather than requiring everything
to be in hierarchical S-expression format. This is a more natural syntax
for a ".s" file format from the perspective of LLVM MC and related tools,
while remaining easy to translate into other forms as needed.
llvm-svn: 249364
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 475d13c..1c7d86b 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -370,6 +370,10 @@
++ArgNo;
}
+ // Record the number of arguments, since argument indices and local variable
+ // indices are in the same index space.
+ MF.getInfo<WebAssemblyFunctionInfo>()->setNumArguments(ArgNo);
+
return Chain;
}
@@ -450,5 +454,6 @@
MCSection *WebAssemblyTargetObjectFile::SelectSectionForGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
- return getDataSection();
+ // TODO: Be more sophisticated than this.
+ return isa<Function>(GV) ? getTextSection() : getDataSection();
}