Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ void CodeGen::WasmProduceReg(GenTree* node)
//
// If the operand is a candidate, we use that candidate's current register.
// Otherwise it must have been allocated into a temporary register initialized
// in 'WasmProduceReg'. To do this, call treeNode->SetMultiplyUsed() during
// in 'WasmProduceReg'. To do this, call SetMultiplyUsed(treeNode) during
// lowering and ensure that regalloc is updated to call 'ConsumeTemporaryRegForOperand'
// on the node(s) that need to be used multiple times.
//
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1228,11 +1228,6 @@ struct GenTree
// LIR flags
// These helper methods, along with the flag values they manipulate, are defined in lir.h
//
#ifdef TARGET_WASM
// Asks the register allocator to allocate a dedicated register for this node so we can use its value multiple
// times.
inline void SetMultiplyUsed();
#endif
// UnusedValue indicates that, although this node produces a value, it is unused.
inline void SetUnusedValue();
inline void ClearUnusedValue();
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/jit/lir.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,6 @@ class LIR final
static GenTree* FirstNode(GenTree* node1, GenTree* node2);
};

#ifdef TARGET_WASM
inline void GenTree::SetMultiplyUsed()
{
assert(gtType != TYP_STRUCT);
gtLIRFlags |= LIR::Flags::MultiplyUsed;
}
#endif

inline void GenTree::SetUnusedValue()
{
gtLIRFlags |= LIR::Flags::UnusedValue;
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/jit/lower.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,12 @@ class Lowering final : public Phase

#ifdef TARGET_WASM
ArrayStack<GenTree*> m_stackificationStack;

static void SetMultiplyUsed(GenTree* node)
{
assert(node->gtType != TYP_STRUCT);
node->gtLIRFlags |= LIR::Flags::MultiplyUsed;
}
#endif
};

Expand Down
22 changes: 13 additions & 9 deletions src/coreclr/jit/lowerwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ GenTree* Lowering::LowerBinaryArithmetic(GenTreeOp* binOp)

if (binOp->gtOverflow())
{
binOp->gtGetOp1()->SetMultiplyUsed();
binOp->gtGetOp2()->SetMultiplyUsed();
SetMultiplyUsed(binOp->gtGetOp1());
SetMultiplyUsed(binOp->gtGetOp2());
}

return binOp->gtNext;
Expand All @@ -189,12 +189,12 @@ void Lowering::LowerDivOrMod(GenTreeOp* divMod)
ExceptionSetFlags exSetFlags = divMod->OperExceptions(m_compiler);
if ((exSetFlags & ExceptionSetFlags::ArithmeticException) != ExceptionSetFlags::None)
{
divMod->gtGetOp1()->SetMultiplyUsed();
divMod->gtGetOp2()->SetMultiplyUsed();
SetMultiplyUsed(divMod->gtGetOp1());
SetMultiplyUsed(divMod->gtGetOp2());
}
else if ((exSetFlags & ExceptionSetFlags::DivideByZeroException) != ExceptionSetFlags::None)
{
divMod->gtGetOp2()->SetMultiplyUsed();
SetMultiplyUsed(divMod->gtGetOp2());
}

ContainCheckDivOrMod(divMod);
Expand Down Expand Up @@ -248,7 +248,9 @@ void Lowering::LowerBlockStore(GenTreeBlk* blkNode)
// If copying to the stack instead of the heap, we should treat it as a raw memcpy for
// smaller generated code and potentially better performance.
if (blkNode->IsAddressNotOnHeap(m_compiler))
{
doCpObj = false;
}

// CopyObj or CopyBlk
if (doCpObj)
Expand All @@ -260,9 +262,11 @@ void Lowering::LowerBlockStore(GenTreeBlk* blkNode)
}

blkNode->gtBlkOpKind = GenTreeBlk::BlkOpKindCpObjUnroll;
dstAddr->SetMultiplyUsed();
SetMultiplyUsed(dstAddr);
if (src->OperIs(GT_IND))
src->gtGetOp1()->SetMultiplyUsed();
{
SetMultiplyUsed(src->gtGetOp1());
}
}
else
{
Expand Down Expand Up @@ -299,7 +303,7 @@ void Lowering::LowerCast(GenTree* tree)

if (tree->gtOverflow())
{
tree->gtGetOp1()->SetMultiplyUsed();
SetMultiplyUsed(tree->gtGetOp1());
}
ContainCheckCast(tree->AsCast());
}
Expand Down Expand Up @@ -585,6 +589,6 @@ void Lowering::AfterLowerArgsForCall(GenTreeCall* call)
{
// Prepare for explicit null check
CallArg* thisArg = call->gtArgs.GetThisArg();
thisArg->GetNode()->SetMultiplyUsed();
SetMultiplyUsed(thisArg->GetNode());
}
}
2 changes: 2 additions & 0 deletions src/coreclr/jit/regallocwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ void WasmRegAlloc::CollectReferencesForBlockStore(GenTreeBlk* node)
{
GenTree* src = node->Data();
if (src->OperIs(GT_IND))
{
src = src->gtGetOp1();
}

ConsumeTemporaryRegForOperand(src DEBUGARG("block store source"));
ConsumeTemporaryRegForOperand(node->Addr() DEBUGARG("block store destination"));
Expand Down
Loading