Skip to content

Commit

Permalink
Start generating LCL_FLDs in LocalAddressVisitor (dotnet#737)
Browse files Browse the repository at this point in the history
* Start generating LCL_FLDs in LocalAddressVisitor

* Fix broken vararg offset computation

Since it's subtracted the local field offset also need to be subtracted so it actually ends up being added as needed.

* Introduce array/index temps for LCL_FLDs

Previously fgMorphArrayIndex was always creating temporaries for array/index FIELD trees. Since now LCL_FLDs are created before fgMorphArrayIndex this preserves the existing behavior.

* CR feedback

* Fix incorrect field sequence type check

* Fix GetTail formatting
  • Loading branch information
mikedn authored and Sergey Andreenko committed Dec 16, 2019
1 parent c2d89a8 commit 4fa1638
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 59 deletions.
1 change: 1 addition & 0 deletions src/coreclr/src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7955,6 +7955,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

void setLclRelatedToSIMDIntrinsic(GenTree* tree);
bool areFieldsContiguous(GenTree* op1, GenTree* op2);
bool areLocalFieldsContiguous(GenTreeLclFld* first, GenTreeLclFld* second);
bool areArrayElementsContiguous(GenTree* op1, GenTree* op2);
bool areArgumentsContiguous(GenTree* op1, GenTree* op2);
GenTree* createAddressNodeForSIMDInit(GenTree* tree, unsigned simdSize);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18009,7 +18009,7 @@ bool FieldSeqNode::IsConstantIndexFieldSeq()
return m_fieldHnd == FieldSeqStore::ConstantIndexPseudoField;
}

bool FieldSeqNode::IsPseudoField()
bool FieldSeqNode::IsPseudoField() const
{
return m_fieldHnd == FieldSeqStore::FirstElemPseudoField || m_fieldHnd == FieldSeqStore::ConstantIndexPseudoField;
}
Expand Down
49 changes: 36 additions & 13 deletions src/coreclr/src/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,23 @@ struct FieldSeqNode
bool IsConstantIndexFieldSeq();

// returns true when this is the the pseudo #FirstElem field sequence or the pseudo #ConstantIndex field sequence
bool IsPseudoField();
bool IsPseudoField() const;

CORINFO_FIELD_HANDLE GetFieldHandle() const
{
assert(!IsPseudoField() && (m_fieldHnd != nullptr));
return m_fieldHnd;
}

FieldSeqNode* GetTail()
{
FieldSeqNode* tail = this;
while (tail->m_next != nullptr)
{
tail = tail->m_next;
}
return tail;
}

// Make sure this provides methods that allow it to be used as a KeyFuncs type in SimplerHash.
static int GetHashCode(FieldSeqNode fsn)
Expand Down Expand Up @@ -3244,6 +3260,13 @@ struct GenTreeField : public GenTree
gtFieldLookup.addr = nullptr;
#endif
}

// True if this field is a volatile memory operation.
bool IsVolatile() const
{
return (gtFlags & GTF_FLD_VOLATILE) != 0;
}

#if DEBUGGABLE_GENTREE
GenTreeField() : GenTree()
{
Expand Down Expand Up @@ -5038,6 +5061,18 @@ struct GenTreeIndir : public GenTreeOp
{
}

// True if this indirection is a volatile memory operation.
bool IsVolatile() const
{
return (gtFlags & GTF_IND_VOLATILE) != 0;
}

// True if this indirection is an unaligned memory operation.
bool IsUnaligned() const
{
return (gtFlags & GTF_IND_UNALIGNED) != 0;
}

#if DEBUGGABLE_GENTREE
protected:
friend GenTree;
Expand Down Expand Up @@ -5089,18 +5124,6 @@ struct GenTreeBlk : public GenTreeIndir
return (m_layout != nullptr) ? m_layout->GetSize() : 0;
}

// True if this BlkOpNode is a volatile memory operation.
bool IsVolatile() const
{
return (gtFlags & GTF_BLK_VOLATILE) != 0;
}

// True if this BlkOpNode is an unaligned memory operation.
bool IsUnaligned() const
{
return (gtFlags & GTF_BLK_UNALIGNED) != 0;
}

// Instruction selection: during codegen time, what code sequence we will be using
// to encode this operation.
enum
Expand Down
Loading

0 comments on commit 4fa1638

Please sign in to comment.