Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 2206c1b

Browse files
committed
Decompose GT_IND for x86
1 parent 1383b55 commit 2206c1b

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/jit/decomposelongs.cpp

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void DecomposeLongs::DecomposeNode(GenTree** ppTree, Compiler::fgWalkData* data)
211211
break;
212212

213213
case GT_IND:
214-
NYI("GT_IND of TYP_LONG");
214+
DecomposeInd(ppTree, data);
215215
break;
216216

217217
case GT_NOT:
@@ -865,6 +865,39 @@ void DecomposeLongs::DecomposeStoreInd(GenTree** ppTree, Compiler::fgWalkData* d
865865
}
866866

867867

868+
//------------------------------------------------------------------------
869+
// DecomposeInd: Decompose GT_IND.
870+
//
871+
// Arguments:
872+
// tree - the tree to decompose
873+
//
874+
// Return Value:
875+
// None.
876+
//
877+
void DecomposeLongs::DecomposeInd(GenTree** ppTree, Compiler::fgWalkData* data)
878+
{
879+
GenTreePtr indLow = *ppTree;
880+
GenTreeStmt* addrStmt = CreateTemporary(&indLow->gtOp.gtOp1);
881+
JITDUMP("[DecomposeInd]: Saving addr tree to a temp var:\n");
882+
DISPTREE(addrStmt);
883+
884+
// Change the type of lower ind.
885+
indLow->gtType = TYP_INT;
886+
887+
// Create tree of ind(addr+4)
888+
GenTreePtr addrBase = indLow->gtGetOp1();
889+
GenTreePtr addrBaseHigh = new(m_compiler, GT_LCL_VAR) GenTreeLclVar(GT_LCL_VAR,
890+
addrBase->TypeGet(), addrBase->AsLclVarCommon()->GetLclNum(), BAD_IL_OFFSET);
891+
GenTreePtr addrHigh = new(m_compiler, GT_LEA) GenTreeAddrMode(TYP_REF, addrBaseHigh, nullptr, 0, genTypeSize(TYP_INT));
892+
GenTreePtr indHigh = new (m_compiler, GT_IND) GenTreeIndir(GT_IND, TYP_INT, addrHigh, nullptr);
893+
894+
// Connect linear links
895+
SimpleLinkNodeAfter(addrBaseHigh, addrHigh);
896+
SimpleLinkNodeAfter(addrHigh, indHigh);
897+
898+
FinalizeDecomposition(ppTree, data, indLow, indHigh);
899+
}
900+
868901
//------------------------------------------------------------------------
869902
// DecomposeNot: Decompose GT_NOT.
870903
//

src/jit/decomposelongs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class DecomposeLongs
4242
void DecomposeCast(GenTree** ppTree, Compiler::fgWalkData* data);
4343
void DecomposeCnsLng(GenTree** ppTree, Compiler::fgWalkData* data);
4444
void DecomposeCall(GenTree** ppTree, Compiler::fgWalkData* data);
45+
void DecomposeInd(GenTree** ppTree, Compiler::fgWalkData* data);
4546
void DecomposeStoreInd(GenTree** ppTree, Compiler::fgWalkData* data);
4647
void DecomposeNot(GenTree** ppTree, Compiler::fgWalkData* data);
4748
void DecomposeNeg(GenTree** ppTree, Compiler::fgWalkData* data);

0 commit comments

Comments
 (0)