1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5#pragma once
6
7#include "compiler.h"
8
9//------------------------------------------------------------------------
10// TreeLifeUpdater: class that handles changes in variable liveness from a given tree.
11// Keeps set of temporary VARSET_TP during its lifetime to avoid unnecessary memory allocations.
12template <bool ForCodeGen>
13class TreeLifeUpdater
14{
15public:
16 TreeLifeUpdater(Compiler* compiler);
17 void UpdateLife(GenTree* tree);
18
19private:
20 void UpdateLifeVar(GenTree* tree);
21
22private:
23 Compiler* compiler;
24 VARSET_TP newLife; // a live set after processing an argument tree.
25 VARSET_TP stackVarDeltaSet; // a live set of tracked stack ptr lcls.
26 VARSET_TP varDeltaSet; // a set of variables that changed their liveness.
27 VARSET_TP gcTrkStkDeltaSet; // // a set of gc tracked stack variables that changed their liveness..
28#ifdef DEBUG
29 VARSET_TP gcVarPtrSetNew; // a set to print changes to live part of tracked stack ptr lcls (gcVarPtrSetCur).
30 unsigned epoch; // VarSets epoch when the class was created, must stay the same during its using.
31#endif // DEBUG
32};
33