Fix reading Time zone rules using Julian days (#17672)
[platform/upstream/coreclr.git] / src / jit / nodeinfo.h
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 #ifndef _NODEINFO_H_
6 #define _NODEINFO_H_
7
8 struct GenTree;
9
10 class LinearScan;
11 typedef unsigned int LsraLocation;
12
13 class TreeNodeInfo
14 {
15 public:
16     TreeNodeInfo()
17     {
18         _dstCount           = 0;
19         _srcCount           = 0;
20         _internalIntCount   = 0;
21         _internalFloatCount = 0;
22
23         srcCandsIndex          = 0;
24         dstCandsIndex          = 0;
25         internalCandsIndex     = 0;
26         isLocalDefUse          = false;
27         isDelayFree            = false;
28         hasDelayFreeSrc        = false;
29         isTgtPref              = false;
30         isInternalRegDelayFree = false;
31 #ifdef DEBUG
32         isInitialized = false;
33 #endif
34     }
35
36     // dst
37     __declspec(property(put = setDstCount, get = getDstCount)) int dstCount;
38     void setDstCount(int count)
39     {
40         assert(count <= MAX_RET_REG_COUNT);
41         _dstCount = (char)count;
42     }
43     int getDstCount()
44     {
45         return _dstCount;
46     }
47
48     // src
49     __declspec(property(put = setSrcCount, get = getSrcCount)) int srcCount;
50     void setSrcCount(int count)
51     {
52         _srcCount = (char)count;
53         assert(_srcCount == count);
54     }
55     int getSrcCount()
56     {
57         return _srcCount;
58     }
59
60     // internalInt
61     __declspec(property(put = setInternalIntCount, get = getInternalIntCount)) int internalIntCount;
62     void setInternalIntCount(int count)
63     {
64         _internalIntCount = (char)count;
65         assert(_internalIntCount == count);
66     }
67     int getInternalIntCount()
68     {
69         return _internalIntCount;
70     }
71
72     // internalFloat
73     __declspec(property(put = setInternalFloatCount, get = getInternalFloatCount)) int internalFloatCount;
74     void setInternalFloatCount(int count)
75     {
76         _internalFloatCount = (char)count;
77         assert(_internalFloatCount == count);
78     }
79     int getInternalFloatCount()
80     {
81         return _internalFloatCount;
82     }
83
84     // SrcCandidates are constraints of the consuming (parent) operation applied to this node
85     // (i.e. what registers it is constrained to consume).
86     regMaskTP getSrcCandidates(LinearScan* lsra);
87     void setSrcCandidates(LinearScan* lsra, regMaskTP mask);
88     // DstCandidates are constraints of this node (i.e. what registers it is constrained to produce).
89     regMaskTP getDstCandidates(LinearScan* lsra);
90     void setDstCandidates(LinearScan* lsra, regMaskTP mask);
91     // InternalCandidates are constraints of the registers used as temps in the evaluation of this node.
92     regMaskTP getInternalCandidates(LinearScan* lsra);
93     void setInternalCandidates(LinearScan* lsra, regMaskTP mask);
94     void addInternalCandidates(LinearScan* lsra, regMaskTP mask);
95
96 public:
97     unsigned char srcCandsIndex;
98     unsigned char dstCandsIndex;
99     unsigned char internalCandsIndex;
100
101 private:
102     unsigned char _srcCount : 5;
103     unsigned char _dstCount : 3;
104     unsigned char _internalIntCount : 3;
105     unsigned char _internalFloatCount : 3;
106
107 public:
108     // isLocalDefUse identifies trees that produce a value that is not consumed elsewhere.
109     // Examples include stack arguments to a call (they are immediately stored), lhs of comma
110     // nodes, or top-level nodes that are non-void.
111     unsigned char isLocalDefUse : 1;
112
113     // isDelayFree is set when the register defined by this node will interfere with the destination
114     // of the consuming node, and therefore it must not be freed immediately after use.
115     unsigned char isDelayFree : 1;
116
117     // hasDelayFreeSrc is set when this node has sources that are marked "isDelayFree".  This is because,
118     // we may eventually "contain" this node, in which case we don't want it's children (which have
119     // already been marked "isDelayFree" to be handled that way when allocating.
120     unsigned char hasDelayFreeSrc : 1;
121
122     // isTgtPref is set to true when we have a rmw op, where we would like the result to be allocated
123     // in the same register as op1.
124     unsigned char isTgtPref : 1;
125
126     // Whether internal register needs to be different from targetReg
127     // in which result is produced.
128     unsigned char isInternalRegDelayFree : 1;
129
130 #ifdef DEBUG
131     // isInitialized is set when the tree node is handled.
132     unsigned char isInitialized : 1;
133 #endif
134
135 public:
136     // Initializes the TreeNodeInfo value with the given values.
137     void Initialize(LinearScan* lsra, GenTree* node);
138
139 #ifdef DEBUG
140     void dump(LinearScan* lsra);
141
142     // This method checks to see whether the information has been initialized,
143     // and is in a consistent state
144     bool IsValid(LinearScan* lsra)
145     {
146         return (isInitialized &&
147                 ((getSrcCandidates(lsra) | getInternalCandidates(lsra) | getDstCandidates(lsra)) &
148                  ~(RBM_ALLFLOAT | RBM_ALLINT)) == 0);
149     }
150 #endif // DEBUG
151 };
152
153 #endif // _NODEINFO_H_