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
3 changes: 0 additions & 3 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,6 @@ void Compiler::optAssertionGen(GenTree* tree)
}
break;

case GT_OBJ:
case GT_BLK:
case GT_IND:
// R-value indirections create non-null assertions, but not all indirections are R-values.
Expand Down Expand Up @@ -4723,7 +4722,6 @@ GenTree* Compiler::optAssertionProp(ASSERT_VALARG_TP assertions, GenTree* tree,
case GT_RETURN:
return optAssertionProp_Return(assertions, tree->AsUnOp(), stmt);

case GT_OBJ:
case GT_BLK:
case GT_IND:
case GT_NULLCHECK:
Expand Down Expand Up @@ -5702,7 +5700,6 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Sta
case GT_ARR_LENGTH:
break;

case GT_OBJ:
case GT_BLK:
case GT_IND:
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
void genCodeForReturnTrap(GenTreeOp* tree);
void genCodeForStoreInd(GenTreeStoreInd* tree);
void genCodeForSwap(GenTreeOp* tree);
void genCodeForCpObj(GenTreeObj* cpObjNode);
void genCodeForCpObj(GenTreeBlk* cpObjNode);
void genCodeForCpBlkRepMovs(GenTreeBlk* cpBlkNode);
void genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode);
#ifndef TARGET_X86
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ void CodeGen::genCodeForNegNot(GenTree* tree)
// bl CORINFO_HELP_ASSIGN_BYREF
// ldr tempReg, [R13, #8]
// str tempReg, [R14, #8]
void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
void CodeGen::genCodeForCpObj(GenTreeBlk* cpObjNode)
{
GenTree* dstAddr = cpObjNode->Addr();
GenTree* source = cpObjNode->Data();
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3545,7 +3545,7 @@ void CodeGen::genCodeForDivMod(GenTreeOp* tree)
// bl CORINFO_HELP_ASSIGN_BYREF
// ldr tempReg, [R13, #8]
// str tempReg, [R14, #8]
void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
void CodeGen::genCodeForCpObj(GenTreeBlk* cpObjNode)
{
GenTree* dstAddr = cpObjNode->Addr();
GenTree* source = cpObjNode->Data();
Expand Down
98 changes: 10 additions & 88 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
}
else
{
noway_assert(source->OperIsLocalRead() || source->OperIs(GT_OBJ));
noway_assert(source->OperIsLocalRead() || source->OperIs(GT_BLK));

var_types targetType = source->TypeGet();
noway_assert(varTypeIsStruct(targetType));
Expand Down Expand Up @@ -914,10 +914,10 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
// This struct must live on the stack frame.
assert(varDsc->lvOnFrame && !varDsc->lvRegister);
}
else // we must have a GT_OBJ
else // we must have a GT_BLK
{
layout = source->AsObj()->GetLayout();
addrReg = genConsumeReg(source->AsObj()->Addr());
layout = source->AsBlk()->GetLayout();
addrReg = genConsumeReg(source->AsBlk()->Addr());

#ifdef TARGET_ARM64
// If addrReg equal to loReg, swap(loReg, hiReg)
Expand Down Expand Up @@ -1244,11 +1244,11 @@ void CodeGen::genPutArgSplit(GenTreePutArgSplit* treeNode)
firstRegToPlace = 0;
valueReg = treeNode->GetRegNumByIdx(0);
}
else // we must have a GT_OBJ
else // we must have a GT_BLK
{
layout = source->AsObj()->GetLayout();
addrReg = genConsumeReg(source->AsObj()->Addr());
addrType = source->AsObj()->Addr()->TypeGet();
layout = source->AsBlk()->GetLayout();
addrReg = genConsumeReg(source->AsBlk()->Addr());
addrType = source->AsBlk()->Addr()->TypeGet();

regNumber allocatedValueReg = REG_NA;
if (treeNode->gtNumRegs == 1)
Expand Down Expand Up @@ -4472,8 +4472,8 @@ void CodeGen::genCodeForStoreBlk(GenTreeBlk* blkOp)
{
assert(!blkOp->gtBlkOpGcUnsafe);
assert(blkOp->OperIsCopyBlkOp());
assert(blkOp->AsObj()->GetLayout()->HasGCPtr());
genCodeForCpObj(blkOp->AsObj());
assert(blkOp->AsBlk()->GetLayout()->HasGCPtr());
genCodeForCpObj(blkOp->AsBlk());
return;
}

Expand Down Expand Up @@ -5639,82 +5639,4 @@ void CodeGen::genFnEpilog(BasicBlock* block)

compiler->unwindEndEpilog();
}

// return size
// alignmentWB is out param
unsigned CodeGenInterface::InferOpSizeAlign(GenTree* op, unsigned* alignmentWB)
{
unsigned alignment = 0;
unsigned opSize = 0;

if (op->gtType == TYP_STRUCT || op->OperIsCopyBlkOp())
{
opSize = InferStructOpSizeAlign(op, &alignment);
}
else
{
alignment = genTypeAlignments[op->TypeGet()];
opSize = genTypeSizes[op->TypeGet()];
}

assert(opSize != 0);
assert(alignment != 0);

(*alignmentWB) = alignment;
return opSize;
}

// return size
// alignmentWB is out param
unsigned CodeGenInterface::InferStructOpSizeAlign(GenTree* op, unsigned* alignmentWB)
{
unsigned alignment = 0;
unsigned opSize = 0;

while (op->gtOper == GT_COMMA)
{
op = op->AsOp()->gtOp2;
}

if (op->gtOper == GT_OBJ)
{
CORINFO_CLASS_HANDLE clsHnd = op->AsObj()->GetLayout()->GetClassHandle();
opSize = op->AsObj()->GetLayout()->GetSize();
alignment = roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd), TARGET_POINTER_SIZE);
}
else if (op->gtOper == GT_LCL_VAR)
{
const LclVarDsc* varDsc = compiler->lvaGetDesc(op->AsLclVarCommon());
assert(varDsc->lvType == TYP_STRUCT);
opSize = varDsc->lvSize();
#ifndef TARGET_64BIT
if (varDsc->lvStructDoubleAlign)
{
alignment = TARGET_POINTER_SIZE * 2;
}
else
#endif // !TARGET_64BIT
{
alignment = TARGET_POINTER_SIZE;
}
}
else if (op->gtOper == GT_MKREFANY)
{
opSize = TARGET_POINTER_SIZE * 2;
alignment = TARGET_POINTER_SIZE;
}
else
{
assert(!"Unhandled gtOper");
opSize = TARGET_POINTER_SIZE;
alignment = TARGET_POINTER_SIZE;
}

assert(opSize != 0);
assert(alignment != 0);

(*alignmentWB) = alignment;
return opSize;
}

#endif // TARGET_ARMARCH
3 changes: 0 additions & 3 deletions src/coreclr/jit/codegeninterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ class CodeGenInterface
#endif

public:
unsigned InferStructOpSizeAlign(GenTree* op, unsigned* alignmentWB);
unsigned InferOpSizeAlign(GenTree* op, unsigned* alignmentWB);

// Methods to abstract target information

bool validImmForInstr(instruction ins, target_ssize_t val, insFlags flags = INS_FLAGS_DONT_CARE);
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ void CodeGen::genConsumeMultiOpOperands(GenTreeMultiOp* tree)
// Notes:
// sizeReg can be REG_NA when this function is used to consume the dstReg and srcReg
// for copying on the stack a struct with references.
// The source address/offset is determined from the address on the GT_OBJ node, while
// The source address/offset is determined from the address on the GT_BLK node, while
// the destination address is the address contained in 'm_stkArgVarNum' plus the offset
// provided in the 'putArgNode'.
// m_stkArgVarNum must be set to the varnum for the local used for placing the "by-value" args on the stack.
Expand All @@ -1763,7 +1763,7 @@ void CodeGen::genConsumePutStructArgStk(GenTreePutArgStk* putArgNode,
GenTree* src = putArgNode->Data();
regNumber srcAddrReg = REG_NA;
assert(varTypeIsStruct(src));
assert(src->OperIs(GT_OBJ) || src->OperIsLocalRead() || (src->OperIs(GT_IND) && varTypeIsSIMD(src)));
assert(src->OperIs(GT_BLK) || src->OperIsLocalRead() || (src->OperIs(GT_IND) && varTypeIsSIMD(src)));

assert(dstReg != REG_NA);
assert(srcReg != REG_NA);
Expand Down
110 changes: 17 additions & 93 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2901,7 +2901,7 @@ void CodeGen::genCodeForInitBlkUnroll(GenTreeBlk* node)
// bl CORINFO_HELP_ASSIGN_BYREF
// ld tempReg, 8(A5)
// sd tempReg, 8(A6)
void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
void CodeGen::genCodeForCpObj(GenTreeBlk* cpObjNode)
{
GenTree* dstAddr = cpObjNode->Addr();
GenTree* source = cpObjNode->Data();
Expand Down Expand Up @@ -5477,9 +5477,9 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
{
genPutArgStkFieldList(treeNode, varNumOut);
}
else // We must have a GT_OBJ or a GT_LCL_VAR
else // We must have a GT_BLK or a GT_LCL_VAR
{
noway_assert((source->OperGet() == GT_LCL_VAR) || (source->OperGet() == GT_OBJ));
noway_assert((source->OperGet() == GT_LCL_VAR) || (source->OperGet() == GT_BLK));

var_types targetType = source->TypeGet();
noway_assert(varTypeIsStruct(targetType));
Expand All @@ -5496,17 +5496,17 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
{
varNode = source->AsLclVarCommon();
}
else // we must have a GT_OBJ
else // we must have a GT_BLK
{
assert(source->OperGet() == GT_OBJ);
assert(source->OperGet() == GT_BLK);

addrNode = source->AsOp()->gtOp1;

// addrNode can either be a GT_LCL_ADDR<0> or an address expression
//
if (addrNode->IsLclVarAddr())
{
// We have a GT_OBJ(GT_LCL_ADDR<0>)
// We have a GT_BLK(GT_LCL_ADDR<0>)
//
// We will treat this case the same as above
// (i.e if we just had this GT_LCL_VAR directly as the source)
Expand Down Expand Up @@ -5549,18 +5549,16 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
// as that is how much stack is allocated for this LclVar
layout = varDsc->GetLayout();
}
else // we must have a GT_OBJ
else // we must have a GT_BLK
{
assert(source->OperGet() == GT_OBJ);
assert(source->OperGet() == GT_BLK);

// If the source is an OBJ node then we need to use the type information
// If the source is an BLK node then we need to use the type information
// it provides (size and GC layout) even if the node wraps a lclvar. Due
// to struct reinterpretation (e.g. Unsafe.As<X, Y>) it is possible that
// the OBJ node has a different type than the lclvar.
CORINFO_CLASS_HANDLE objClass = source->AsObj()->GetLayout()->GetClassHandle();

srcSize = compiler->info.compCompHnd->getClassSize(objClass);
layout = source->AsObj()->GetLayout();
// the BLK node has a different type than the lclvar.
layout = source->AsBlk()->GetLayout();
srcSize = layout->GetSize();
}

unsigned structSize;
Expand Down Expand Up @@ -5766,7 +5764,7 @@ void CodeGen::genPutArgSplit(GenTreePutArgSplit* treeNode)
else
{
var_types targetType = source->TypeGet();
assert(source->OperGet() == GT_OBJ);
assert(source->OperGet() == GT_BLK);
assert(varTypeIsStruct(targetType));

regNumber baseReg = treeNode->ExtractTempReg();
Expand All @@ -5781,7 +5779,7 @@ void CodeGen::genPutArgSplit(GenTreePutArgSplit* treeNode)
//
if (addrNode->IsLclVarAddr())
{
// We have a GT_OBJ(GT_LCL_ADDR<0>)
// We have a GT_BLK(GT_LCL_ADDR<0>)
//
// We will treat this case the same as above
// (i.e if we just had this GT_LCL_VAR directly as the source)
Expand Down Expand Up @@ -5818,12 +5816,9 @@ void CodeGen::genPutArgSplit(GenTreePutArgSplit* treeNode)
// Because the candidate mask for the internal baseReg does not include any of the target register,
// we can ensure that baseReg, addrReg, and the last target register are not all same.
assert(baseReg != addrReg);

// We don't split HFA struct
assert(!compiler->IsHfa(source->AsObj()->GetLayout()->GetClassHandle()));
}

ClassLayout* layout = source->AsObj()->GetLayout();
ClassLayout* layout = source->AsBlk()->GetLayout();

// Put on stack first
unsigned structOffset = treeNode->gtNumRegs * TARGET_POINTER_SIZE;
Expand Down Expand Up @@ -7562,8 +7557,8 @@ void CodeGen::genCodeForStoreBlk(GenTreeBlk* blkOp)
{
assert(!blkOp->gtBlkOpGcUnsafe);
assert(blkOp->OperIsCopyBlkOp());
assert(blkOp->AsObj()->GetLayout()->HasGCPtr());
genCodeForCpObj(blkOp->AsObj());
assert(blkOp->AsBlk()->GetLayout()->HasGCPtr());
genCodeForCpObj(blkOp->AsBlk());
return;
}
if (blkOp->gtBlkOpGcUnsafe)
Expand Down Expand Up @@ -9112,75 +9107,4 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed)
return;
}
}

// return size
// alignmentWB is out param
unsigned CodeGenInterface::InferOpSizeAlign(GenTree* op, unsigned* alignmentWB)
{
unsigned alignment = 0;
unsigned opSize = 0;

if (op->gtType == TYP_STRUCT || op->OperIsCopyBlkOp())
{
opSize = InferStructOpSizeAlign(op, &alignment);
}
else
{
alignment = genTypeAlignments[op->TypeGet()];
opSize = genTypeSizes[op->TypeGet()];
}

assert(opSize != 0);
assert(alignment != 0);

(*alignmentWB) = alignment;
return opSize;
}

// return size
// alignmentWB is out param
unsigned CodeGenInterface::InferStructOpSizeAlign(GenTree* op, unsigned* alignmentWB)
{
unsigned alignment = 0;
unsigned opSize = 0;

while (op->gtOper == GT_COMMA)
{
op = op->AsOp()->gtOp2;
}

if (op->gtOper == GT_OBJ)
{
CORINFO_CLASS_HANDLE clsHnd = op->AsObj()->GetLayout()->GetClassHandle();
opSize = op->AsObj()->GetLayout()->GetSize();
alignment = roundUp(compiler->info.compCompHnd->getClassAlignmentRequirement(clsHnd), TARGET_POINTER_SIZE);
}
else if (op->gtOper == GT_LCL_VAR)
{
const LclVarDsc* varDsc = compiler->lvaGetDesc(op->AsLclVarCommon());
assert(varDsc->lvType == TYP_STRUCT);
opSize = varDsc->lvSize();
{
alignment = TARGET_POINTER_SIZE;
}
}
else if (op->gtOper == GT_MKREFANY)
{
opSize = TARGET_POINTER_SIZE * 2;
alignment = TARGET_POINTER_SIZE;
}
else
{
assert(!"Unhandled gtOper");
opSize = TARGET_POINTER_SIZE;
alignment = TARGET_POINTER_SIZE;
}

assert(opSize != 0);
assert(alignment != 0);

(*alignmentWB) = alignment;
return opSize;
}

#endif // TARGET_LOONGARCH64
Loading