return one;
}
+GenTreeLclVar* Compiler::gtNewStoreLclVar(unsigned dstLclNum, GenTree* src)
+{
+ GenTreeLclVar* store = new (this, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, src->TypeGet(), dstLclNum);
+ store->gtOp1 = src;
+ store->gtFlags = (src->gtFlags & GTF_COMMON_MASK);
+ store->gtFlags |= GTF_VAR_DEF | GTF_ASG;
+ return store;
+}
+
#ifdef FEATURE_SIMD
//---------------------------------------------------------------------
// gtNewSIMDVectorZero: create a GT_SIMD node for Vector<T>.Zero
unsigned lclNum = comp->lvaGrabTemp(true DEBUGARG("Lowering is creating a new local variable"));
comp->lvaTable[lclNum].lvType = rhs->TypeGet();
- GenTreeLclVar* store = new (comp, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, rhs->TypeGet(), lclNum);
- store->gtOp1 = rhs;
- store->gtFlags = (rhs->gtFlags & GTF_COMMON_MASK);
- store->gtFlags |= GTF_VAR_DEF;
+ GenTreeLclVar* store = comp->gtNewStoreLclVar(lclNum, rhs);
switchBBRange.InsertAfter(node, store);
switchBBRange.Remove(node);
comp->lvaTable[tmpLclNum].lvDoNotEnregister = comp->lvaTable[lcl->GetLclNum()].lvDoNotEnregister;
GenTree* value = comp->gtNewLclvNode(lclNum, tmpTyp);
- // TODO-1stClassStructs: This can be simplified with 1st class structs work.
if (tmpTyp == TYP_STRUCT)
{
comp->lvaSetStruct(tmpLclNum, comp->lvaGetStruct(lclNum), false);
- GenTree* loc = new (comp, GT_LCL_VAR_ADDR) GenTreeLclVar(GT_LCL_VAR_ADDR, TYP_STRUCT, tmpLclNum);
- loc->gtType = TYP_BYREF;
- GenTreeBlk* storeBlk = new (comp, GT_STORE_BLK)
- GenTreeBlk(GT_STORE_BLK, TYP_STRUCT, loc, value, comp->typGetBlkLayout(callerArgDsc->lvExactSize));
- storeBlk->gtFlags |= GTF_ASG;
- BlockRange().InsertBefore(insertTempBefore, LIR::SeqTree(comp, storeBlk));
- LowerNode(storeBlk);
- }
- else
- {
- GenTree* assignExpr = comp->gtNewTempAssign(tmpLclNum, value);
- ContainCheckRange(value, assignExpr);
- BlockRange().InsertBefore(insertTempBefore, LIR::SeqTree(comp, assignExpr));
}
+ GenTreeLclVar* storeLclVar = comp->gtNewStoreLclVar(tmpLclNum, value);
+ ContainCheckRange(value, storeLclVar);
+ BlockRange().InsertBefore(insertTempBefore, LIR::SeqTree(comp, storeLclVar));
+ LowerNode(storeLclVar);
}
lcl->SetLclNum(tmpLclNum);