diff options
author | Keith Winstein <keithw@cs.stanford.edu> | 2022-08-15 13:51:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-15 20:51:34 +0000 |
commit | 3bf73a83b909f43b8e4530562d5763721c49e4a7 (patch) | |
tree | e199873f8a5d437a99d9c2fd0979014985af84dd /src/binary-reader-ir.cc | |
parent | 7f51b5a04b69b1663ebff30412a98ffe28342094 (diff) | |
download | wabt-3bf73a83b909f43b8e4530562d5763721c49e4a7.tar.gz wabt-3bf73a83b909f43b8e4530562d5763721c49e4a7.tar.bz2 wabt-3bf73a83b909f43b8e4530562d5763721c49e4a7.zip |
Track locations of Vars in BinaryReaderIR and BinaryReaderInterp (#1963)
- Rebase test output to match new location tracking on Vars
- Eliminate single-argument Var() constructor.
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r-- | src/binary-reader-ir.cc | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc index ff3eafab..44e93782 100644 --- a/src/binary-reader-ir.cc +++ b/src/binary-reader-ir.cc @@ -454,7 +454,7 @@ void BinaryReaderIR::SetBlockDeclaration(BlockDeclaration* decl, Type sig_type) { if (sig_type.IsIndex()) { Index type_index = sig_type.GetIndex(); - SetFuncDeclaration(decl, Var(type_index)); + SetFuncDeclaration(decl, Var(type_index, GetLocation())); } else { decl->has_func_type = false; decl->sig.param_types.clear(); @@ -796,33 +796,33 @@ Result BinaryReaderIR::OnBlockExpr(Type sig_type) { } Result BinaryReaderIR::OnBrExpr(Index depth) { - return AppendExpr(MakeUnique<BrExpr>(Var(depth))); + return AppendExpr(MakeUnique<BrExpr>(Var(depth, GetLocation()))); } Result BinaryReaderIR::OnBrIfExpr(Index depth) { - return AppendExpr(MakeUnique<BrIfExpr>(Var(depth))); + return AppendExpr(MakeUnique<BrIfExpr>(Var(depth, GetLocation()))); } Result BinaryReaderIR::OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) { auto expr = MakeUnique<BrTableExpr>(); - expr->default_target = Var(default_target_depth); + expr->default_target = Var(default_target_depth, GetLocation()); expr->targets.resize(num_targets); for (Index i = 0; i < num_targets; ++i) { - expr->targets[i] = Var(target_depths[i]); + expr->targets[i] = Var(target_depths[i], GetLocation()); } return AppendExpr(std::move(expr)); } Result BinaryReaderIR::OnCallExpr(Index func_index) { - return AppendExpr(MakeUnique<CallExpr>(Var(func_index))); + return AppendExpr(MakeUnique<CallExpr>(Var(func_index, GetLocation()))); } Result BinaryReaderIR::OnCallIndirectExpr(Index sig_index, Index table_index) { auto expr = MakeUnique<CallIndirectExpr>(); SetFuncDeclaration(&expr->decl, Var(sig_index, GetLocation())); - expr->table = Var(table_index); + expr->table = Var(table_index, GetLocation()); return AppendExpr(std::move(expr)); } @@ -831,14 +831,14 @@ Result BinaryReaderIR::OnCallRefExpr() { } Result BinaryReaderIR::OnReturnCallExpr(Index func_index) { - return AppendExpr(MakeUnique<ReturnCallExpr>(Var(func_index))); + return AppendExpr(MakeUnique<ReturnCallExpr>(Var(func_index, GetLocation()))); } Result BinaryReaderIR::OnReturnCallIndirectExpr(Index sig_index, Index table_index) { auto expr = MakeUnique<ReturnCallIndirectExpr>(); SetFuncDeclaration(&expr->decl, Var(sig_index, GetLocation())); - expr->table = Var(table_index); + expr->table = Var(table_index, GetLocation()); return AppendExpr(std::move(expr)); } @@ -949,8 +949,8 @@ Result BinaryReaderIR::OnLoadExpr(Opcode opcode, Index memidx, Address alignment_log2, Address offset) { - return AppendExpr( - MakeUnique<LoadExpr>(opcode, Var(memidx), 1 << alignment_log2, offset)); + return AppendExpr(MakeUnique<LoadExpr>(opcode, Var(memidx, GetLocation()), + 1 << alignment_log2, offset)); } Result BinaryReaderIR::OnLoopExpr(Type sig_type) { @@ -963,64 +963,67 @@ Result BinaryReaderIR::OnLoopExpr(Type sig_type) { } Result BinaryReaderIR::OnMemoryCopyExpr(Index srcmemidx, Index destmemidx) { - return AppendExpr( - MakeUnique<MemoryCopyExpr>(Var(srcmemidx), Var(destmemidx))); + return AppendExpr(MakeUnique<MemoryCopyExpr>(Var(srcmemidx, GetLocation()), + Var(destmemidx, GetLocation()))); } Result BinaryReaderIR::OnDataDropExpr(Index segment) { - return AppendExpr(MakeUnique<DataDropExpr>(Var(segment))); + return AppendExpr(MakeUnique<DataDropExpr>(Var(segment, GetLocation()))); } Result BinaryReaderIR::OnMemoryFillExpr(Index memidx) { - return AppendExpr(MakeUnique<MemoryFillExpr>(Var(memidx))); + return AppendExpr(MakeUnique<MemoryFillExpr>(Var(memidx, GetLocation()))); } Result BinaryReaderIR::OnMemoryGrowExpr(Index memidx) { - return AppendExpr(MakeUnique<MemoryGrowExpr>(Var(memidx))); + return AppendExpr(MakeUnique<MemoryGrowExpr>(Var(memidx, GetLocation()))); } Result BinaryReaderIR::OnMemoryInitExpr(Index segment, Index memidx) { - return AppendExpr(MakeUnique<MemoryInitExpr>(Var(segment), Var(memidx))); + return AppendExpr(MakeUnique<MemoryInitExpr>(Var(segment, GetLocation()), + Var(memidx, GetLocation()))); } Result BinaryReaderIR::OnMemorySizeExpr(Index memidx) { - return AppendExpr(MakeUnique<MemorySizeExpr>(Var(memidx))); + return AppendExpr(MakeUnique<MemorySizeExpr>(Var(memidx, GetLocation()))); } Result BinaryReaderIR::OnTableCopyExpr(Index dst_index, Index src_index) { - return AppendExpr(MakeUnique<TableCopyExpr>(Var(dst_index), Var(src_index))); + return AppendExpr(MakeUnique<TableCopyExpr>(Var(dst_index, GetLocation()), + Var(src_index, GetLocation()))); } Result BinaryReaderIR::OnElemDropExpr(Index segment) { - return AppendExpr(MakeUnique<ElemDropExpr>(Var(segment))); + return AppendExpr(MakeUnique<ElemDropExpr>(Var(segment, GetLocation()))); } Result BinaryReaderIR::OnTableInitExpr(Index segment, Index table_index) { - return AppendExpr(MakeUnique<TableInitExpr>(Var(segment), Var(table_index))); + return AppendExpr(MakeUnique<TableInitExpr>(Var(segment, GetLocation()), + Var(table_index, GetLocation()))); } Result BinaryReaderIR::OnTableGetExpr(Index table_index) { - return AppendExpr(MakeUnique<TableGetExpr>(Var(table_index))); + return AppendExpr(MakeUnique<TableGetExpr>(Var(table_index, GetLocation()))); } Result BinaryReaderIR::OnTableSetExpr(Index table_index) { - return AppendExpr(MakeUnique<TableSetExpr>(Var(table_index))); + return AppendExpr(MakeUnique<TableSetExpr>(Var(table_index, GetLocation()))); } Result BinaryReaderIR::OnTableGrowExpr(Index table_index) { - return AppendExpr(MakeUnique<TableGrowExpr>(Var(table_index))); + return AppendExpr(MakeUnique<TableGrowExpr>(Var(table_index, GetLocation()))); } Result BinaryReaderIR::OnTableSizeExpr(Index table_index) { - return AppendExpr(MakeUnique<TableSizeExpr>(Var(table_index))); + return AppendExpr(MakeUnique<TableSizeExpr>(Var(table_index, GetLocation()))); } Result BinaryReaderIR::OnTableFillExpr(Index table_index) { - return AppendExpr(MakeUnique<TableFillExpr>(Var(table_index))); + return AppendExpr(MakeUnique<TableFillExpr>(Var(table_index, GetLocation()))); } Result BinaryReaderIR::OnRefFuncExpr(Index func_index) { - return AppendExpr(MakeUnique<RefFuncExpr>(Var(func_index))); + return AppendExpr(MakeUnique<RefFuncExpr>(Var(func_index, GetLocation()))); } Result BinaryReaderIR::OnRefNullExpr(Type type) { @@ -1062,8 +1065,8 @@ Result BinaryReaderIR::OnStoreExpr(Opcode opcode, Index memidx, Address alignment_log2, Address offset) { - return AppendExpr( - MakeUnique<StoreExpr>(opcode, Var(memidx), 1 << alignment_log2, offset)); + return AppendExpr(MakeUnique<StoreExpr>(opcode, Var(memidx, GetLocation()), + 1 << alignment_log2, offset)); } Result BinaryReaderIR::OnThrowExpr(Index tag_index) { @@ -1173,7 +1176,7 @@ Result BinaryReaderIR::OnSimdLoadLaneExpr(Opcode opcode, Address offset, uint64_t value) { return AppendExpr(MakeUnique<SimdLoadLaneExpr>( - opcode, Var(memidx), 1 << alignment_log2, offset, value)); + opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset, value)); } Result BinaryReaderIR::OnSimdStoreLaneExpr(Opcode opcode, @@ -1182,7 +1185,7 @@ Result BinaryReaderIR::OnSimdStoreLaneExpr(Opcode opcode, Address offset, uint64_t value) { return AppendExpr(MakeUnique<SimdStoreLaneExpr>( - opcode, Var(memidx), 1 << alignment_log2, offset, value)); + opcode, Var(memidx, GetLocation()), 1 << alignment_log2, offset, value)); } Result BinaryReaderIR::OnSimdShuffleOpExpr(Opcode opcode, v128 value) { |