summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-08-24 21:03:24 +0000
committerDan Gohman <dan433584@gmail.com>2015-08-24 21:03:24 +0000
commit69c4c7639617f2cee2fb77883083d81eb3cb8818 (patch)
tree2560673d64d583754f071518b2becfa80d6a41d1 /llvm/lib/Target/WebAssembly
parent44a6184a6dc88aaaa2d46dfe1ccc77c0e9a675cf (diff)
downloadbcm5719-llvm-69c4c7639617f2cee2fb77883083d81eb3cb8818.tar.gz
bcm5719-llvm-69c4c7639617f2cee2fb77883083d81eb3cb8818.zip
[WebAssembly] CodeGen support for __builtin_wasm_page_size()
llvm-svn: 245872
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td7
2 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
index 4216fb6ebe2..6f98b4f6ed0 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
@@ -79,7 +79,7 @@ private:
static SmallString<32> Name(const WebAssemblyInstrInfo *TII,
const MachineInstr *MI) {
std::string N(StringRef(TII->getName(MI->getOpcode())).lower());
- std::string::size_type End = N.find('_');
+ std::string::size_type End = N.rfind('_');
End = std::string::npos == End ? N.length() : End;
return SmallString<32>(&N[0], &N[End]);
}
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
index 5ab40e826ca..8457dc89c4d 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td
@@ -44,3 +44,10 @@
* load_global: load the value of a given global variable
* store_global: store a given value to a given global variable
*/
+
+def page_size_I32 : I<(outs Int32:$dst), (ins),
+ [(set Int32:$dst, (int_wasm_page_size))]>,
+ Requires<[HasAddr32]>;
+def page_size_I64 : I<(outs Int64:$dst), (ins),
+ [(set Int64:$dst, (int_wasm_page_size))]>,
+ Requires<[HasAddr64]>;
OpenPOWER on IntegriCloud