aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/obj2yaml/wasm2yaml.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-01-09 21:38:53 +0000
committerSam Clegg <sbc@chromium.org>2018-01-09 21:38:53 +0000
commite53af7f6df2cabaa62516e32ae00aaf271258fa4 (patch)
treedac521f63a63655bedd0ea9cb27429a8943ea6cb /llvm/tools/obj2yaml/wasm2yaml.cpp
parentd68fa1be57ae66236af53f7a16e78309d2aecdea (diff)
downloadllvm-e53af7f6df2cabaa62516e32ae00aaf271258fa4.zip
llvm-e53af7f6df2cabaa62516e32ae00aaf271258fa4.tar.gz
llvm-e53af7f6df2cabaa62516e32ae00aaf271258fa4.tar.bz2
[WebAssembly] Explicitly specify function/global index space in YAML
These indexes are useful because they are not always zero based and functions and globals are referenced elsewhere by their index. This matches what we already do for the type index space. Differential Revision: https://reviews.llvm.org/D41877 llvm-svn: 322121
Diffstat (limited to 'llvm/tools/obj2yaml/wasm2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/wasm2yaml.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index 1bf8149..476fb6c 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -186,6 +186,7 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
auto GlobalSec = make_unique<WasmYAML::GlobalSection>();
for (auto &Global : Obj.globals()) {
WasmYAML::Global G;
+ G.Index = Global.Index;
G.Type = Global.Type;
G.Mutable = Global.Mutable;
G.InitExpr = Global.InitExpr;
@@ -230,6 +231,7 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
auto CodeSec = make_unique<WasmYAML::CodeSection>();
for (auto &Func : Obj.functions()) {
WasmYAML::Function Function;
+ Function.Index = Func.Index;
for (auto &Local : Func.Locals) {
WasmYAML::LocalDecl LocalDecl;
LocalDecl.Type = Local.Type;