diff --git a/src/coreclr/jit/codegenwasm.cpp b/src/coreclr/jit/codegenwasm.cpp index d144605cfb4caf..f6338f846c6d06 100644 --- a/src/coreclr/jit/codegenwasm.cpp +++ b/src/coreclr/jit/codegenwasm.cpp @@ -115,16 +115,6 @@ void CodeGen::genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed) { JITDUMP("*************** In genHomeRegisterParams()\n"); - if (GetStackPointerReg() == REG_NA) - { - // We didn't see any local or argument references, so there's nothing to spill. - // TODO-WASM: debug codegen would likely spill all the user args anyways. - // - JITDUMP(" No local references -- skipping parameter homing\n"); - assert(!isFramePointerUsed()); - return; - } - auto spillParam = [this](unsigned lclNum, unsigned offset, unsigned paramLclNum, const ABIPassingSegment& segment) { assert(segment.IsPassedInRegister()); diff --git a/src/coreclr/jit/regallocwasm.cpp b/src/coreclr/jit/regallocwasm.cpp index 48bcd978abd25b..8c001fa77e7334 100644 --- a/src/coreclr/jit/regallocwasm.cpp +++ b/src/coreclr/jit/regallocwasm.cpp @@ -100,6 +100,10 @@ void WasmRegAlloc::IdentifyCandidates() { JITDUMP("RA candidate: V%02u", lclNum); } + else if ((m_fpReg == REG_NA) && (varDsc->lvRefCnt() != 0)) + { + m_fpReg = AllocateFreeRegister(TYP_I_IMPL); + } } } @@ -147,11 +151,6 @@ void WasmRegAlloc::AllocateAndResolveNode(GenTree* node) { RewriteLocalStackStore(node->AsLclVarCommon()); } - - if (m_fpReg == REG_NA) - { - m_fpReg = AllocateFreeRegister(TYP_I_IMPL); - } } } else if (node->OperIs(GT_LCLHEAP)) diff --git a/src/coreclr/jit/registeropswasm.cpp b/src/coreclr/jit/registeropswasm.cpp index 0386d477d1b3cd..170688faf4abc9 100644 --- a/src/coreclr/jit/registeropswasm.cpp +++ b/src/coreclr/jit/registeropswasm.cpp @@ -109,7 +109,10 @@ unsigned UnpackWasmReg(regNumber reg, WasmValueType* pType) // unsigned WasmRegToIndex(regNumber reg) { - return UnpackWasmReg(reg); + WasmValueType wasmType; + unsigned index = UnpackWasmReg(reg, &wasmType); + assert((WasmValueType::Invalid < wasmType) && (wasmType < WasmValueType::Count)); + return index; } bool genIsValidReg(regNumber reg)