21MoveOperandKind GetKind(
const InstructionOperand& move) {
37 size_t nmoves = moves->size();
38 for (
size_t i = 0;
i < nmoves;) {
40 if (move->IsRedundant()) {
42 if (
i < nmoves) (*moves)[
i] = (*moves)[nmoves];
46 source_kinds.
Add(GetKind(move->source()));
47 destination_kinds.
Add(GetKind(move->destination()));
49 if (nmoves != moves->size()) moves->resize(nmoves);
51 if ((source_kinds & destination_kinds).empty() || moves->size() < 2) {
59 for (
size_t i = 0;
i < moves->size(); ++
i) {
60 auto move = (*moves)[
i];
61 if (!move->IsEliminated())
PerformMove(moves, move);
84 if (cycle.size() == 2 &&
IsSwap(cycle.front(), cycle.back())) {
92 if (source->IsAnyStackSlot()) {
114 for (
size_t i = 0;
i < cycle.size() - 1; ++
i) {
120 for (
size_t i = 0;
i < cycle.size() - 1; ++
i) {
122 cycle[
i]->Eliminate();
137 std::vector<MoveOperands*> cycle;
142 for (
auto m : *moves) {
143 if (
m->source() == source) {
144 m->set_source(scratch);
153 std::vector<MoveOperands*>* cycle) {
167 DCHECK(!move->IsPending());
168 DCHECK(!move->IsRedundant());
173 DCHECK(!source.IsInvalid());
178 for (
size_t i = 0;
i < moves->size(); ++
i) {
179 auto other = (*moves)[
i];
180 if (other->IsEliminated())
continue;
181 if (other == move)
continue;
183 if (other->IsPending()) {
187 if (!cycle->empty()) {
188 blocking_move = cycle->front();
193 cycle->push_back(other);
195 std::vector<MoveOperands*> cycle_rec;
197 if (blocking_move)
break;
198 if (!cycle->empty() && !cycle_rec.empty()) {
199 blocking_move = cycle_rec.front();
202 if (cycle->empty() && !cycle_rec.empty()) {
203 *cycle = std::move(cycle_rec);
213 if (blocking_move !=
nullptr)
return blocking_move;
215 if (!cycle->empty()) {
216 if (cycle->front() == move) {
222 cycle->push_back(move);
constexpr void Add(E element)
virtual void SetPendingMove(MoveOperands *move)=0
virtual void MoveToTempLocation(InstructionOperand *src, MachineRepresentation rep)=0
virtual void AssembleMove(InstructionOperand *source, InstructionOperand *destination)=0
virtual void AssembleSwap(InstructionOperand *source, InstructionOperand *destination)=0
virtual AllocatedOperand Push(InstructionOperand *src)=0
virtual void PopTempStackSlots()=0
virtual void MoveTempLocationTo(InstructionOperand *dst, MachineRepresentation rep)=0
MoveOperands * PerformMoveHelper(ParallelMove *moves, MoveOperands *move, std::vector< MoveOperands * > *cycle)
void PerformCycle(const std::vector< MoveOperands * > &cycle)
Assembler *const assembler_
V8_EXPORT_PRIVATE void Resolve(ParallelMove *parallel_move)
void PerformMove(ParallelMove *moves, MoveOperands *move)
MachineRepresentation representation() const
static LocationOperand * cast(InstructionOperand *op)
const InstructionOperand & source() const
const InstructionOperand & destination() const
void set_destination(const InstructionOperand &operand)
InstructionOperand source
InstructionOperand destination
bool IsSwap(MoveOperands *move1, MoveOperands *move2)
constexpr bool IsFloatingPoint(MachineRepresentation rep)
#define DCHECK(condition)