MCPcopy Create free account
hub / github.com/ReadyTalk/avian / pickTarget

Function pickTarget

src/codegen/compiler/regalloc.cpp:178–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178Target pickTarget(Context* c,
179 Value* value,
180 const SiteMask& mask,
181 unsigned registerPenalty,
182 Target best,
183 CostCalculator* costCalculator)
184{
185 if (mask.typeMask & lir::Operand::RegisterPairMask) {
186 Target mine
187 = pickRegisterTarget(c, value, mask.registerMask, costCalculator);
188
189 mine.cost += registerPenalty;
190 if (mine.cost == Target::MinimumRegisterCost) {
191 return mine;
192 } else if (mine.cost < best.cost) {
193 best = mine;
194 }
195 }
196
197 if (mask.typeMask & lir::Operand::MemoryMask) {
198 if (mask.frameIndex >= 0) {
199 Target mine(mask.frameIndex,
200 lir::Operand::Type::Memory,
201 frameCost(c, value, mask.frameIndex, costCalculator));
202 if (mine.cost == Target::MinimumFrameCost) {
203 return mine;
204 } else if (mine.cost < best.cost) {
205 best = mine;
206 }
207 } else if (mask.frameIndex == AnyFrameIndex) {
208 Target mine = pickFrameTarget(c, value, costCalculator);
209 if (mine.cost == Target::MinimumFrameCost) {
210 return mine;
211 } else if (mine.cost < best.cost) {
212 best = mine;
213 }
214 }
215 }
216
217 return best;
218}
219
220Target pickTarget(Context* c,
221 Read* read,

Callers 1

pickTargetSiteFunction · 0.85

Calls 9

pickRegisterTargetFunction · 0.85
frameCostFunction · 0.85
pickFrameTargetFunction · 0.85
isFloatValueFunction · 0.85
pickAnyFrameTargetFunction · 0.85
assertTFunction · 0.85
abortFunction · 0.50
intersectMethod · 0.45
successorMethod · 0.45

Tested by

no test coverage detected