From 7267a57b5ee37af31538e2141d21ff557d54dd00 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Fri, 6 Apr 2018 15:30:37 -0700 Subject: Mutate the global heap valuenumber for any HW intrinsic that performs a memory store operation Use fgMutateGcHeap to record memory write operations by HW Intrinsics Set flags for the HW Intrinsic nodes that access Memory Added support for HWIntrinsic nodes to OperMayThrow Added support for GT_HWIntrinsic to GenTree::OperRequiresAsgFlag() and GenTree::OperIsImplicitIndir() Refactored GenTreeHWIntrinsic::OperIsMemoryLoad() and GenTreeHWIntrinsic::OperIsMemoryStore() Added GenTreeHWIntrinsic::OperIsMemoryLoadOrStore() Deleted the static version of OperIsImplicitIndir(gtOper) --- src/jit/liveness.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/jit/liveness.cpp') diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp index 7ae9487ecd..a4ef055782 100644 --- a/src/jit/liveness.cpp +++ b/src/jit/liveness.cpp @@ -329,6 +329,27 @@ void Compiler::fgPerNodeLocalVarLiveness(GenTree* tree) fgCurMemoryDef |= memoryKindSet(GcHeap, ByrefExposed); break; +#ifdef FEATURE_HW_INTRINSICS + case GT_HWIntrinsic: + { + GenTreeHWIntrinsic* hwIntrinsicNode = tree->AsHWIntrinsic(); + + // We can't call fgMutateGcHeap unless the block has recorded a MemoryDef + // + if (hwIntrinsicNode->OperIsMemoryStore()) + { + // We currently handle this like a Volatile store, so it counts as a definition of GcHeap/ByrefExposed + fgCurMemoryDef |= memoryKindSet(GcHeap, ByrefExposed); + } + if (hwIntrinsicNode->OperIsMemoryLoad()) + { + // This instruction loads from memory and we need to record this information + fgCurMemoryUse |= memoryKindSet(GcHeap, ByrefExposed); + } + break; + } +#endif + // For now, all calls read/write GcHeap/ByrefExposed, writes in their entirety. Might tighten this case later. case GT_CALL: { -- cgit v1.2.3