[PATCH] D117739: [lld][WebAssemlby] Convert test to check disassembly output. NFC

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 19 18:42:33 PST 2022


sbc100 created this revision.
Herald added a subscriber: wingo.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117739

Files:
  lld/test/wasm/shared.s


Index: lld/test/wasm/shared.s
===================================================================
--- lld/test/wasm/shared.s
+++ lld/test/wasm/shared.s
@@ -1,6 +1,7 @@
 # RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
 # RUN: wasm-ld --experimental-pic -shared -o %t.wasm %t.o
 # RUN: obj2yaml %t.wasm | FileCheck %s
+# RUN: llvm-objdump --disassemble-symbols=__wasm_call_ctors,__wasm_apply_data_relocs --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck %s --check-prefixes DIS
 
 .functype func_external () -> ()
 
@@ -205,16 +206,46 @@
 # CHECK-NEXT:         Functions:       [ 3, 2 ]
 
 # check the generated code in __wasm_call_ctors and __wasm_apply_data_relocs functions
-# TODO(sbc): Disassemble and verify instructions.
-
-# CHECK:        - Type:            CODE
-# CHECK-NEXT:     Functions:
-# CHECK-NEXT:       - Index:           0
-# CHECK-NEXT:         Locals:          []
-# CHECK-NEXT:         Body:            10010B
-# CHECK-NEXT:       - Index:           1
-# CHECK-NEXT:         Locals:          []
-# CHECK-NEXT:         Body:            230141046A2304360200230141086A230241016A3602002301410C6A230141006A360200230141106A2305360200230141146A230641046A3602000B
+
+# DIS:      <__wasm_call_ctors>:
+# DIS-EMPTY:
+# DIS-NEXT:                 call    1
+# DIS-NEXT:                 end
+
+# DIS:      <__wasm_apply_data_relocs>:
+# DIS-EMPTY:
+# DIS-NEXT:                 global.get      1
+# DIS-NEXT:                 i32.const       4
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 global.get      4
+# DIS-NEXT:                 i32.store       0
+# DIS-NEXT:                 global.get      1
+# DIS-NEXT:                 i32.const       8
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 global.get      2
+# DIS-NEXT:                 i32.const       1
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 i32.store       0
+# DIS-NEXT:                 global.get      1
+# DIS-NEXT:                 i32.const       12
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 global.get      1
+# DIS-NEXT:                 i32.const       0
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 i32.store       0
+# DIS-NEXT:                 global.get      1
+# DIS-NEXT:                 i32.const       16
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 global.get      5
+# DIS-NEXT:                 i32.store       0
+# DIS-NEXT:                 global.get      1
+# DIS-NEXT:                 i32.const       20
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 global.get      6
+# DIS-NEXT:                 i32.const       4
+# DIS-NEXT:                 i32.add
+# DIS-NEXT:                 i32.store       0
+# DIS-NEXT:                 end
 
 # check the data segment initialized with __memory_base global as offset
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117739.401475.patch
Type: text/x-patch
Size: 2877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220120/1abbee53/attachment.bin>


More information about the llvm-commits mailing list