forked from OSchip/llvm-project
llvm-readobj: support globals in initializer expressions
Differential Revision: https://reviews.llvm.org/D117747
This commit is contained in:
parent
58e7bf78a3
commit
5b2c3d7bbc
|
@ -0,0 +1,32 @@
|
|||
# RUN: yaml2obj %s | llvm-readobj --sections - | FileCheck %s
|
||||
|
||||
# Test use of global.get in initializer expressions.
|
||||
|
||||
--- !WASM
|
||||
FileHeader:
|
||||
Version: 0x00000001
|
||||
Sections:
|
||||
- Type: DATA
|
||||
Segments:
|
||||
- SectionOffset: 6
|
||||
InitFlags: 0
|
||||
Offset:
|
||||
Opcode: GLOBAL_GET
|
||||
Index: 1
|
||||
Content: '64'
|
||||
...
|
||||
|
||||
# CHECK: Section {
|
||||
# CHECK-NEXT: Type: DATA (0xB)
|
||||
# CHECK-NEXT: Size: 7
|
||||
# CHECK-NEXT: Offset: 8
|
||||
# CHECK-NEXT: Segments [
|
||||
# CHECK-NEXT: Segment {
|
||||
# CHECK-NEXT: Size: 1
|
||||
# CHECK-NEXT: Offset [
|
||||
# CHECK-NEXT: Global: 1
|
||||
# CHECK-NEXT: ]
|
||||
# CHECK-NEXT: }
|
||||
# CHECK-NEXT: ]
|
||||
# CHECK-NEXT: }
|
||||
# CHECK-NEXT: ]
|
|
@ -183,7 +183,10 @@ void WasmDumper::printSectionHeaders() {
|
|||
W.printNumber("Offset", Seg.Offset.Value.Int32);
|
||||
else if (Seg.Offset.Opcode == wasm::WASM_OPCODE_I64_CONST)
|
||||
W.printNumber("Offset", Seg.Offset.Value.Int64);
|
||||
else
|
||||
else if (Seg.Offset.Opcode == wasm::WASM_OPCODE_GLOBAL_GET) {
|
||||
ListScope Group(W, "Offset");
|
||||
W.printNumber("Global", Seg.Offset.Value.Global);
|
||||
} else
|
||||
llvm_unreachable("unknown init expr opcode");
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue