/* cc65 */
#include "codeent.h"
+#include "coptind.h"
#include "codeinfo.h"
#include "codeopt.h"
#include "error.h"
-#include "coptind.h"
/* Jump target insn, old and new */
CodeEntry* T;
CodeEntry* N;
-
+
/* New jump label */
CodeLabel* L;
/* If we have a replacement store, change the code */
if (X) {
- /* Insert before the xfer insn */
- CS_InsertEntry (S, X, Xfer);
+ /* Insert after the xfer insn */
+ CS_InsertEntry (S, X, Xfer+1);
/* Remove the xfer instead */
- CS_DelEntry (S, Xfer+1);
+ CS_DelEntry (S, Xfer);
/* Remove the final store */
CS_DelEntry (S, Store);
/* If we have a replacement load, change the code */
if (X) {
- /* Insert before the xfer insn */
- CS_InsertEntry (S, X, Xfer);
+ /* Insert after the xfer insn */
+ CS_InsertEntry (S, X, Xfer+1);
/* Remove the xfer instead */
- CS_DelEntry (S, Xfer+1);
+ CS_DelEntry (S, Xfer);
/* Remove the initial load */
CS_DelEntry (S, Load);
!RegAUsed (S, I+1) &&
!MemAccess (S, Push+1, Pop-1, E->Arg)) {
- /* Insert a STA before the PHA */
+ /* Insert a STA after the PHA */
X = NewCodeEntry (E->OPC, E->AM, E->Arg, E->JumpTo, E->LI);
- CS_InsertEntry (S, X, Push);
+ CS_InsertEntry (S, X, Push+1);
/* Remove the PHA instead */
- CS_DelEntry (S, Push+1);
+ CS_DelEntry (S, Push);
/* Remove the PLA/STA sequence */
CS_DelEntries (S, Pop, 2);