Skip to content

Commit 5a3761d

Browse files
committed
[WebAssembly] Use 64-bit table when targeting wasm64
See WebAssembly/memory64#51
1 parent 55e5908 commit 5a3761d

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

lld/test/wasm/shared64.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ get_local_func_address:
154154
# CHECK-NEXT: Index: 0
155155
# CHECK-NEXT: ElemType: FUNCREF
156156
# CHECK-NEXT: Limits:
157+
# CHECK-NEXT: Flags: [ IS_64 ]
157158
# CHECK-NEXT: Minimum: 0x2
158159
# CHECK-NEXT: - Module: env
159160
# CHECK-NEXT: Field: __stack_pointer

lld/wasm/Writer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,8 @@ static void finalizeIndirectFunctionTable() {
939939
limits.Flags |= WASM_LIMITS_FLAG_HAS_MAX;
940940
limits.Maximum = limits.Minimum;
941941
}
942+
if (config->is64.value_or(false))
943+
limits.Flags |= WASM_LIMITS_FLAG_IS_64;
942944
WasmSym::indirectFunctionTable->setLimits(limits);
943945
}
944946

llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -885,18 +885,6 @@ bool WebAssemblyFastISel::selectCall(const Instruction *I) {
885885
Table->setNoStrip();
886886
MIB.addImm(0);
887887
}
888-
// See if we must truncate the function pointer.
889-
// CALL_INDIRECT takes an i32, but in wasm64 we represent function pointers
890-
// as 64-bit for uniformity with other pointer types.
891-
// See also: WebAssemblyISelLowering.cpp: LowerCallResults
892-
if (Subtarget->hasAddr64()) {
893-
auto Wrap = BuildMI(*FuncInfo.MBB, std::prev(FuncInfo.InsertPt), MIMD,
894-
TII.get(WebAssembly::I32_WRAP_I64));
895-
Register Reg32 = createResultReg(&WebAssembly::I32RegClass);
896-
Wrap.addReg(Reg32, RegState::Define);
897-
Wrap.addReg(CalleeReg);
898-
CalleeReg = Reg32;
899-
}
900888
}
901889

902890
for (unsigned ArgReg : Args)

0 commit comments

Comments
 (0)