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
1 change: 1 addition & 0 deletions src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ class CodeGen final : public CodeGenInterface
void genCodeForShiftRMW(GenTreeStoreInd* storeInd);
#endif // TARGET_XARCH

void genCodeForCatchArg(GenTree* tree);
void genCodeForCast(GenTreeOp* tree);
void genCodeForLclAddr(GenTreeLclFld* lclAddrNode);
void genCodeForIndexAddr(GenTreeIndexAddr* tree);
Expand Down
9 changes: 1 addition & 8 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
break;

case GT_CATCH_ARG:

noway_assert(handlerGetsXcptnObj(m_compiler->compCurBB->GetCatchType()));

/* Catch arguments get passed in a register. genCodeForBBlist()
would have marked it as holding a GC object, but not used. */

noway_assert(gcInfo.gcRegGCrefSetCur & RBM_EXCEPTION_OBJECT);
genConsumeReg(treeNode);
genCodeForCatchArg(treeNode);
break;

case GT_ASYNC_CONTINUATION:
Expand Down
26 changes: 25 additions & 1 deletion src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ void CodeGen::genCheckConsumeNode(GenTree* const node)
}
}

assert(node->OperIs(GT_CATCH_ARG) || ((node->gtDebugFlags & GTF_DEBUG_NODE_CG_CONSUMED) == 0));
assert((node->gtDebugFlags & GTF_DEBUG_NODE_CG_CONSUMED) == 0);
assert((lastConsumedNode == nullptr) || (node->gtUseNum == -1) || (node->gtUseNum > lastConsumedNode->gtUseNum));

node->gtDebugFlags |= GTF_DEBUG_NODE_CG_CONSUMED;
Expand Down Expand Up @@ -2338,6 +2338,30 @@ void CodeGen::genTransferRegGCState(regNumber dst, regNumber src)
}
#endif

//------------------------------------------------------------------------
// genCodeForCatchArg:
// Generates code for GT_CATCH_ARG.
//
// Arguments:
// tree - the GT_CATCH_ARG node.
//
void CodeGen::genCodeForCatchArg(GenTree* tree)
{
noway_assert(handlerGetsXcptnObj(m_compiler->compCurBB->GetCatchType()));

// Catch arguments get passed in a register. genCodeForBBlist()
// would have marked it as holding a GC object, but not used.

noway_assert(gcInfo.gcRegGCrefSetCur & RBM_EXCEPTION_OBJECT);
inst_Mov(TYP_REF, tree->GetRegNum(), REG_EXCEPTION_OBJECT, /* canSkip */ true);

if (tree->GetRegNum() != REG_EXCEPTION_OBJECT)
{
gcInfo.gcMarkRegSetNpt(RBM_EXCEPTION_OBJECT);
}
genProduceReg(tree);
}

//------------------------------------------------------------------------
// genCodeForCast: Generates the code for GT_CAST.
//
Expand Down
9 changes: 1 addition & 8 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4375,14 +4375,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
break;

case GT_CATCH_ARG:

noway_assert(handlerGetsXcptnObj(m_compiler->compCurBB->GetCatchType()));

/* Catch arguments get passed in a register. genCodeForBBlist()
would have marked it as holding a GC object, but not used. */

noway_assert(gcInfo.gcRegGCrefSetCur & RBM_EXCEPTION_OBJECT);
genConsumeReg(treeNode);
genCodeForCatchArg(treeNode);
break;

case GT_LABEL:
Expand Down
9 changes: 1 addition & 8 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4161,14 +4161,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
break;

case GT_CATCH_ARG:

noway_assert(handlerGetsXcptnObj(m_compiler->compCurBB->GetCatchType()));

/* Catch arguments get passed in a register. genCodeForBBlist()
would have marked it as holding a GC object, but not used. */

noway_assert(gcInfo.gcRegGCrefSetCur & RBM_EXCEPTION_OBJECT);
genConsumeReg(treeNode);
genCodeForCatchArg(treeNode);
break;

case GT_LABEL:
Expand Down
15 changes: 3 additions & 12 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ void CodeGen::genCodeForMulHi(GenTreeOp* treeNode)
// Move the result to the desired register, if necessary
if (treeNode->OperIs(GT_MULHI))
{
assert(targetReg == REG_RDX);
inst_Mov(targetType, targetReg, REG_RDX, /* canSkip */ true);
}
}
Expand Down Expand Up @@ -2104,14 +2103,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
break;

case GT_CATCH_ARG:

noway_assert(handlerGetsXcptnObj(m_compiler->compCurBB->GetCatchType()));

/* Catch arguments get passed in a register. genCodeForBBlist()
would have marked it as holding a GC object, but not used. */

noway_assert(gcInfo.gcRegGCrefSetCur & RBM_EXCEPTION_OBJECT);
genConsumeReg(treeNode);
genCodeForCatchArg(treeNode);
break;

case GT_ASYNC_CONTINUATION:
Expand Down Expand Up @@ -4384,9 +4376,6 @@ void CodeGen::genLockedInstructions(GenTreeOp* node)
// When value is used (it's the original value of the memory location)
// we fallback to cmpxchg-loop idiom.

// for cmpxchg we need to keep the original value in RAX
assert(node->GetRegNum() == REG_RAX);
Comment thread
jakobbotsch marked this conversation as resolved.

// mov RAX, dword ptr [addrReg]
//.LOOP:
// mov tmp, RAX
Expand All @@ -4410,6 +4399,8 @@ void CodeGen::genLockedInstructions(GenTreeOp* node)
inst_JMP(EJ_jne, loop);

gcInfo.gcMarkRegSetNpt(genRegMask(addr->GetRegNum()));
inst_Mov(node->TypeGet(), node->GetRegNum(), REG_RAX, /* canSkip */ true);

genProduceReg(node);
}
return;
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -6436,14 +6436,14 @@ struct GenTreeJitIntrinsic : public GenTreeMultiOp
//
regNumber GetRegNumByIdx(unsigned idx) const
{
#ifdef TARGET_ARM64
assert(idx < MAX_MULTIREG_COUNT);

if (idx == 0)
{
return GetRegNum();
}

#ifdef TARGET_ARM64
assert(idx < MAX_MULTIREG_COUNT);

if (NeedsConsecutiveRegisters())
{
assert(IsMultiRegNode());
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/jit/hwintrinsiccodegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2546,6 +2546,9 @@ void CodeGen::genX86BaseIntrinsic(GenTreeHWIntrinsic* node, insOpts instOptions)
// emit the DIV/IDIV instruction
emit->emitInsBinary(ins, attr, node, op3);

assert(node->GetRegNumByIdx(0) == REG_EAX);
assert(node->GetRegNumByIdx(1) == REG_EDX);
Comment thread
jakobbotsch marked this conversation as resolved.

break;
}

Expand Down
26 changes: 8 additions & 18 deletions src/coreclr/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11052,29 +11052,20 @@ void LinearScan::dumpLsraAllocationEvent(LsraDumpEvent event,
printf("DUconflict ");
dumpRegRecords();
break;
case LSRA_EVENT_DEFUSE_CASE1:
printf(indentFormat, " Case #1 use defRegAssignment");
case LSRA_EVENT_DEFUSE_DEF_IN_FIXED_USE:
printf(indentFormat, " Define in fixed use reg");
dumpRegRecords();
break;
case LSRA_EVENT_DEFUSE_CASE2:
printf(indentFormat, " Case #2 use useRegAssignment");
case LSRA_EVENT_DEFUSE_DEF_IN_USE:
printf(indentFormat, " Define in candidate use reg");
dumpRegRecords();
break;
case LSRA_EVENT_DEFUSE_CASE3:
printf(indentFormat, " Case #3 use useRegAssignment");
dumpRegRecords();
dumpRegRecords();
break;
case LSRA_EVENT_DEFUSE_CASE4:
printf(indentFormat, " Case #4 use defRegAssignment");
dumpRegRecords();
break;
case LSRA_EVENT_DEFUSE_CASE5:
printf(indentFormat, " Case #5 set def to all regs");
case LSRA_EVENT_DEFUSE_ANY_DEF:
printf(indentFormat, " Define in any reg");
dumpRegRecords();
break;
case LSRA_EVENT_DEFUSE_CASE6:
printf(indentFormat, " Case #6 need a copy");
case LSRA_EVENT_DEFUSE_COPY:
printf(indentFormat, " Need a copy");
dumpRegRecords();
if (interval == nullptr)
{
Expand Down Expand Up @@ -11247,7 +11238,6 @@ void LinearScan::dumpLsraAllocationEvent(LsraDumpEvent event,
break;

// We currently don't dump anything for these events.
case LSRA_EVENT_DEFUSE_FIXED_DELAY_USE:
case LSRA_EVENT_SPILL_EXTENDED_LIFETIME:
case LSRA_EVENT_END_BB:
case LSRA_EVENT_FREE_REGS:
Expand Down
11 changes: 4 additions & 7 deletions src/coreclr/jit/lsra.h
Original file line number Diff line number Diff line change
Expand Up @@ -1523,13 +1523,10 @@ class LinearScan : public RegAllocInterface
{
// Conflicting def/use
LSRA_EVENT_DEFUSE_CONFLICT,
LSRA_EVENT_DEFUSE_FIXED_DELAY_USE,
LSRA_EVENT_DEFUSE_CASE1,
LSRA_EVENT_DEFUSE_CASE2,
LSRA_EVENT_DEFUSE_CASE3,
LSRA_EVENT_DEFUSE_CASE4,
LSRA_EVENT_DEFUSE_CASE5,
LSRA_EVENT_DEFUSE_CASE6,
LSRA_EVENT_DEFUSE_DEF_IN_FIXED_USE,
LSRA_EVENT_DEFUSE_DEF_IN_USE,
LSRA_EVENT_DEFUSE_ANY_DEF,
LSRA_EVENT_DEFUSE_COPY,

// Spilling
LSRA_EVENT_SPILL,
Expand Down
Loading
Loading