void StackmapValue::append(const ConstrainedValue& constrainedValue) { if (constrainedValue.rep() == ValueRep(ValueRep::Any)) { children().append(constrainedValue.value()); return; } while (m_reps.size() < numChildren()) m_reps.append(ValueRep::Any); children().append(constrainedValue.value()); m_reps.append(constrainedValue.rep()); }
void StackmapSpecial::forEachArgImpl( unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, Inst& inst, Arg::Role role, const ScopedLambda<Inst::EachArgCallback>& callback) { StackmapValue* value = inst.origin->as<StackmapValue>(); ASSERT(value); // Check that insane things have not happened. ASSERT(inst.args.size() >= numIgnoredAirArgs); ASSERT(value->children().size() >= numIgnoredB3Args); ASSERT(inst.args.size() - numIgnoredAirArgs == value->children().size() - numIgnoredB3Args); for (unsigned i = 0; i < inst.args.size() - numIgnoredAirArgs; ++i) { Arg& arg = inst.args[i + numIgnoredAirArgs]; ConstrainedValue child = value->constrainedChild(i + numIgnoredB3Args); Arg::Role thisRole = role; // Cool down the role if the use is cold. if (child.rep().kind() == ValueRep::Any && thisRole == Arg::Use) thisRole = Arg::ColdUse; callback(arg, role, Arg::typeForB3Type(child.value()->type())); } }
void StackmapSpecial::forEachArgImpl( unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, Inst& inst, RoleMode roleMode, Optional<unsigned> firstRecoverableIndex, const ScopedLambda<Inst::EachArgCallback>& callback) { StackmapValue* value = inst.origin->as<StackmapValue>(); ASSERT(value); // Check that insane things have not happened. ASSERT(inst.args.size() >= numIgnoredAirArgs); ASSERT(value->children().size() >= numIgnoredB3Args); ASSERT(inst.args.size() - numIgnoredAirArgs >= value->children().size() - numIgnoredB3Args); for (unsigned i = 0; i < value->children().size() - numIgnoredB3Args; ++i) { Arg& arg = inst.args[i + numIgnoredAirArgs]; ConstrainedValue child = value->constrainedChild(i + numIgnoredB3Args); Arg::Role role; switch (roleMode) { case ForceLateUseUnlessRecoverable: ASSERT(firstRecoverableIndex); if (arg != inst.args[*firstRecoverableIndex] && arg != inst.args[*firstRecoverableIndex + 1]) { role = Arg::LateColdUse; break; } FALLTHROUGH; case SameAsRep: switch (child.rep().kind()) { case ValueRep::WarmAny: case ValueRep::SomeRegister: case ValueRep::Register: case ValueRep::Stack: case ValueRep::StackArgument: case ValueRep::Constant: role = Arg::Use; break; case ValueRep::LateRegister: role = Arg::LateUse; break; case ValueRep::ColdAny: role = Arg::ColdUse; break; case ValueRep::LateColdAny: role = Arg::LateColdUse; break; default: RELEASE_ASSERT_NOT_REACHED(); break; } break; case ForceLateUse: role = Arg::LateColdUse; break; } Type type = child.value()->type(); callback(arg, role, Arg::typeForB3Type(type), Arg::widthForB3Type(type)); } }
void StackmapSpecial::forEachArgImpl( unsigned numIgnoredB3Args, unsigned numIgnoredAirArgs, Inst& inst, RoleMode roleMode, const ScopedLambda<Inst::EachArgCallback>& callback) { StackmapValue* value = inst.origin->as<StackmapValue>(); ASSERT(value); // Check that insane things have not happened. ASSERT(inst.args.size() >= numIgnoredAirArgs); ASSERT(value->children().size() >= numIgnoredB3Args); ASSERT(inst.args.size() - numIgnoredAirArgs == value->children().size() - numIgnoredB3Args); for (unsigned i = 0; i < inst.args.size() - numIgnoredAirArgs; ++i) { Arg& arg = inst.args[i + numIgnoredAirArgs]; ConstrainedValue child = value->constrainedChild(i + numIgnoredB3Args); Arg::Role role; switch (roleMode) { case SameAsRep: switch (child.rep().kind()) { case ValueRep::WarmAny: case ValueRep::SomeRegister: case ValueRep::Register: case ValueRep::Stack: case ValueRep::StackArgument: case ValueRep::Constant: role = Arg::Use; break; case ValueRep::ColdAny: role = Arg::ColdUse; break; case ValueRep::LateColdAny: role = Arg::LateUse; break; } break; case ForceLateUse: role = Arg::LateUse; break; } callback(arg, role, Arg::typeForB3Type(child.value()->type())); } }
void StackmapValue::setConstrainedChild(unsigned index, const ConstrainedValue& constrainedValue) { child(index) = constrainedValue.value(); setConstraint(index, constrainedValue.rep()); }