diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-06-27 18:11:15 +0000 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2019-06-27 18:11:15 +0000 |
commit | 6b3f56b65fa1e5094201fedb8a9cb9cd30eac9e5 (patch) | |
tree | ea91cf89b4cd9ddc712c24ae49759eb3db3b1df5 /llvm/lib/Target/WebAssembly/MCTargetDesc | |
parent | 1fd1c6097959b7ab7218cf1695adf19f6547df30 (diff) | |
download | bcm5719-llvm-6b3f56b65fa1e5094201fedb8a9cb9cd30eac9e5.tar.gz bcm5719-llvm-6b3f56b65fa1e5094201fedb8a9cb9cd30eac9e5.zip |
[WebAssembly] Fix p2align in assembler.
Summary:
- Match the syntax output by InstPrinter.
- Fix it always emitting 0 for align. Had to work around fact that
opcode is not available for GetDefaultP2Align while parsing.
- Updated tests that were erroneously happy with a p2align=0
Fixes https://bugs.llvm.org/show_bug.cgi?id=40752
Reviewers: aheejin, sbc100
Subscribers: jgravelle-google, sunfish, jfb, llvm-commits, dschuff
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63633
llvm-svn: 364570
Diffstat (limited to 'llvm/lib/Target/WebAssembly/MCTargetDesc')
-rw-r--r-- | llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h index 8790428b6c8..67532013afd 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h @@ -123,7 +123,7 @@ namespace llvm { namespace WebAssembly { /// Return the default p2align value for a load or store with the given opcode. -inline unsigned GetDefaultP2Align(unsigned Opcode) { +inline unsigned GetDefaultP2AlignAny(unsigned Opcode) { switch (Opcode) { case WebAssembly::LOAD8_S_I32: case WebAssembly::LOAD8_S_I32_S: @@ -333,8 +333,16 @@ inline unsigned GetDefaultP2Align(unsigned Opcode) { case WebAssembly::STORE_v2f64_S: return 4; default: + return -1; + } +} + +inline unsigned GetDefaultP2Align(unsigned Opcode) { + auto Align = GetDefaultP2AlignAny(Opcode); + if (Align == -1U) { llvm_unreachable("Only loads and stores have p2align values"); } + return Align; } /// This is used to indicate block signatures. |