Skip to content

Commit

Permalink
Merge pull request #3595 from alyssarosenzweig/ir/before
Browse files Browse the repository at this point in the history
Factor out SetWriteCursorBefore
  • Loading branch information
Sonicadvance1 authored Apr 23, 2024
2 parents 7b88b0f + 2372c94 commit a0bf6a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions FEXCore/Source/Interface/IR/IREmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ class IREmitter {
CurrentWriteCursor = Node;
}

// Set cursor to write before Node
void SetWriteCursorBefore(OrderedNode* Node) {
auto IR = ViewIR();
auto Before = IR.at(Node);
--Before;

SetWriteCursor(std::get<0>(*Before));
}

OrderedNode* GetWriteCursor() {
return CurrentWriteCursor;
}
Expand Down
5 changes: 1 addition & 4 deletions FEXCore/Source/Interface/IR/Passes/ConstProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,7 @@ bool ConstProp::ConstantPropagation(IREmitter* IREmit, const IRListView& Current
IROp->Op = OP_ADDWITHFLAGS;
}

// Set the write cursor to just before this operation.
auto CodeIter = CurrentIR.at(CodeNode);
--CodeIter;
IREmit->SetWriteCursor(std::get<0>(*CodeIter));
IREmit->SetWriteCursorBefore(CodeNode);

// Negate the constant.
auto NegConstant = IREmit->_Constant(-Constant2);
Expand Down

0 comments on commit a0bf6a4

Please sign in to comment.