summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2016-01-26 03:39:31 +0000
committerDan Gohman <dan433584@gmail.com>2016-01-26 03:39:31 +0000
commitbb3722430f8bf7ceaa22e4f13df2a1730d93cfd7 (patch)
tree219adb250190e13c6003449f67bec940d71f5079 /llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
parent3a5c958182021abe2c2293409720ce9262711ef3 (diff)
downloadbcm5719-llvm-bb3722430f8bf7ceaa22e4f13df2a1730d93cfd7.tar.gz
bcm5719-llvm-bb3722430f8bf7ceaa22e4f13df2a1730d93cfd7.zip
[WebAssembly] Implement unaligned loads and stores.
Differential Revision: http://reviews.llvm.org/D16534 llvm-svn: 258779
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index e9933b09298..3906b9d5387 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -285,6 +285,20 @@ bool WebAssemblyTargetLowering::isLegalAddressingMode(const DataLayout &DL,
return true;
}
+bool WebAssemblyTargetLowering::allowsMisalignedMemoryAccesses(
+ EVT /*VT*/, unsigned /*AddrSpace*/, unsigned /*Align*/,
+ bool *Fast) const {
+ // WebAssembly supports unaligned accesses, though it should be declared
+ // with the p2align attribute on loads and stores which do so, and there
+ // may be a performance impact. We tell LLVM they're "fast" because
+ // for the kinds of things that LLVM uses this for (merging agacent stores
+ // of constants, etc.), WebAssembly implementations will either want the
+ // unaligned access or they'll split anyway.
+ if (Fast)
+ *Fast = true;
+ return true;
+}
+
//===----------------------------------------------------------------------===//
// WebAssembly Lowering private implementation.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud