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.
11 typedef unsigned int LsraLocation;
20 _internalIntCount = 0;
21 _internalFloatCount = 0;
25 internalCandsIndex = 0;
26 isLocalDefUse = false;
28 hasDelayFreeSrc = false;
30 isInternalRegDelayFree = false;
32 isInitialized = false;
37 __declspec(property(put = setDstCount, get = getDstCount)) int dstCount;
38 void setDstCount(int count)
40 assert(count <= MAX_RET_REG_COUNT);
41 _dstCount = (char)count;
49 __declspec(property(put = setSrcCount, get = getSrcCount)) int srcCount;
50 void setSrcCount(int count)
52 _srcCount = (char)count;
53 assert(_srcCount == count);
61 __declspec(property(put = setInternalIntCount, get = getInternalIntCount)) int internalIntCount;
62 void setInternalIntCount(int count)
64 _internalIntCount = (char)count;
65 assert(_internalIntCount == count);
67 int getInternalIntCount()
69 return _internalIntCount;
73 __declspec(property(put = setInternalFloatCount, get = getInternalFloatCount)) int internalFloatCount;
74 void setInternalFloatCount(int count)
76 _internalFloatCount = (char)count;
77 assert(_internalFloatCount == count);
79 int getInternalFloatCount()
81 return _internalFloatCount;
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);
97 unsigned char srcCandsIndex;
98 unsigned char dstCandsIndex;
99 unsigned char internalCandsIndex;
102 unsigned char _srcCount : 5;
103 unsigned char _dstCount : 3;
104 unsigned char _internalIntCount : 3;
105 unsigned char _internalFloatCount : 3;
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;
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;
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;
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;
126 // Whether internal register needs to be different from targetReg
127 // in which result is produced.
128 unsigned char isInternalRegDelayFree : 1;
131 // isInitialized is set when the tree node is handled.
132 unsigned char isInitialized : 1;
136 // Initializes the TreeNodeInfo value with the given values.
137 void Initialize(LinearScan* lsra, GenTree* node);
140 void dump(LinearScan* lsra);
142 // This method checks to see whether the information has been initialized,
143 // and is in a consistent state
144 bool IsValid(LinearScan* lsra)
146 return (isInitialized &&
147 ((getSrcCandidates(lsra) | getInternalCandidates(lsra) | getDstCandidates(lsra)) &
148 ~(RBM_ALLFLOAT | RBM_ALLINT)) == 0);
153 #endif // _NODEINFO_H_