[PATCH] D59747: [WebAssembly] Add CFGStacikfied field to WebAssemblyFunctionInfo
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 24 06:49:29 PDT 2019
aheejin created this revision.
aheejin added reviewers: dschuff, sunfish.
Herald added subscribers: llvm-commits, jgravelle-google, sbc100.
Herald added a project: LLVM.
This adds `CFGStackified` field and its serialization to
WebAssemblyFunctionInfo. This will be used in D59740 <https://reviews.llvm.org/D59740>.
Repository:
rL LLVM
https://reviews.llvm.org/D59747
Files:
lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
test/CodeGen/WebAssembly/function-info.mir
Index: test/CodeGen/WebAssembly/function-info.mir
===================================================================
--- test/CodeGen/WebAssembly/function-info.mir
+++ test/CodeGen/WebAssembly/function-info.mir
@@ -1,7 +1,8 @@
# RUN: llc -mtriple=wasm32-unknown-unknown -run-pass wasm-cfg-stackify %s -o - | FileCheck %s
# CHECK-LABEL: function_property_test
-# CHECK: machineFunctionInfo: {}
+# CHECK: machineFunctionInfo:
+# CHECK: isCFGStackified: true
name: function_property_test
liveins:
- { reg: '$arguments' }
Index: lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
===================================================================
--- lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
+++ lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h
@@ -56,6 +56,9 @@
// overaligned values on the user stack.
unsigned BasePtrVreg = -1U;
+ // Function properties.
+ bool CFGStackified = false;
+
public:
explicit WebAssemblyFunctionInfo(MachineFunction &MF) : MF(MF) {}
~WebAssemblyFunctionInfo() override;
@@ -123,6 +126,9 @@
assert(Reg & INT32_MIN);
return Reg & INT32_MAX;
}
+
+ bool isCFGStackified() const { return CFGStackified; }
+ void setCFGStackified(bool Value = true) { CFGStackified = Value; }
};
void computeLegalValueVTs(const Function &F, const TargetMachine &TM, Type *Ty,
@@ -144,6 +150,8 @@
namespace yaml {
struct WebAssemblyFunctionInfo final : public yaml::MachineFunctionInfo {
+ bool CFGStackified = false;
+
WebAssemblyFunctionInfo() = default;
WebAssemblyFunctionInfo(const llvm::WebAssemblyFunctionInfo &MFI);
@@ -152,7 +160,9 @@
};
template <> struct MappingTraits<WebAssemblyFunctionInfo> {
- static void mapping(IO &YamlIO, WebAssemblyFunctionInfo &MFI) {}
+ static void mapping(IO &YamlIO, WebAssemblyFunctionInfo &MFI) {
+ YamlIO.mapOptional("isCFGStackified", MFI.CFGStackified, false);
+ }
};
} // end namespace yaml
Index: lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
+++ lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp
@@ -79,11 +79,14 @@
}
yaml::WebAssemblyFunctionInfo::WebAssemblyFunctionInfo(
- const llvm::WebAssemblyFunctionInfo &MFI) {}
+ const llvm::WebAssemblyFunctionInfo &MFI)
+ : CFGStackified(MFI.isCFGStackified()) {}
void yaml::WebAssemblyFunctionInfo::mappingImpl(yaml::IO &YamlIO) {
MappingTraits<WebAssemblyFunctionInfo>::mapping(YamlIO, *this);
}
void WebAssemblyFunctionInfo::initializeBaseYamlFields(
- const yaml::WebAssemblyFunctionInfo &YamlMFI) {}
+ const yaml::WebAssemblyFunctionInfo &YamlMFI) {
+ CFGStackified = YamlMFI.CFGStackified;
+}
Index: lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
+++ lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
@@ -874,5 +874,6 @@
.isOSBinFormatELF())
appendEndToFunction(MF, TII);
+ MF.getInfo<WebAssemblyFunctionInfo>()->setCFGStackified();
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59747.192030.patch
Type: text/x-patch
Size: 3185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190324/34a56988/attachment.bin>
More information about the llvm-commits
mailing list