diff options
author | Carol Eidt <carol.eidt@microsoft.com> | 2018-07-17 08:54:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-17 08:54:42 -0700 |
commit | d25bcb8e27c5e583d6abfe6d59d3f32316ac7733 (patch) | |
tree | e801804355b9621d4cdf0a222f04b31804a77b34 /src/jit/gentree.h | |
parent | 2b50bba8131acca2ab535e144796941ad93487b7 (diff) | |
parent | 8a6fe594c1f85c762ad94c3dd9b9828d3ae0459c (diff) | |
download | coreclr-d25bcb8e27c5e583d6abfe6d59d3f32316ac7733.tar.gz coreclr-d25bcb8e27c5e583d6abfe6d59d3f32316ac7733.tar.bz2 coreclr-d25bcb8e27c5e583d6abfe6d59d3f32316ac7733.zip |
Merge pull request #18891 from CarolEidt/Fix18153
Ensure BuildUse uses the correct reg number
Diffstat (limited to 'src/jit/gentree.h')
-rw-r--r-- | src/jit/gentree.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/jit/gentree.h b/src/jit/gentree.h index 3bddf61077..83f07d3213 100644 --- a/src/jit/gentree.h +++ b/src/jit/gentree.h @@ -1721,6 +1721,9 @@ public: // Returns true if it is a node returning its value in more than one register inline bool IsMultiRegNode() const; + // Returns the regIndex'th register defined by a possibly-multireg node. + regNumber GetRegByIndex(int regIndex); + // Returns true if it is a GT_COPY or GT_RELOAD node inline bool IsCopyOrReload() const; @@ -6006,6 +6009,47 @@ inline bool GenTree::IsMultiRegNode() const return false; } +//----------------------------------------------------------------------------------- +// GetRegByIndex: Get a specific register, based on regIndex, that is produced +// by this node. +// +// Arguments: +// regIndex - which register to return (must be 0 for non-multireg nodes) +// +// Return Value: +// The register, if any, assigned to this index for this node. +// +inline regNumber GenTree::GetRegByIndex(int regIndex) +{ + if (regIndex == 0) + { + return gtRegNum; + } + if (IsMultiRegCall()) + { + return AsCall()->GetRegNumByIdx(regIndex); + } + +#if FEATURE_ARG_SPLIT + if (OperIsPutArgSplit()) + { + return AsPutArgSplit()->GetRegNumByIdx(regIndex); + } +#endif +#if defined(_TARGET_ARM_) + if (OperIsMultiRegOp()) + { + return AsMultiRegOp()->GetRegNumByIdx(regIndex); + } + if (OperIs(GT_COPY, GT_RELOAD)) + { + return AsCopyOrReload()->GetRegNumByIdx(regIndex); + } +#endif + assert(!"Invalid regIndex for GetRegFromMultiRegNode"); + return REG_NA; +} + //------------------------------------------------------------------------- // IsCopyOrReload: whether this is a GT_COPY or GT_RELOAD node. // |