]> git.sur5r.net Git - cc65/blobdiff - src/cc65/coptind.c
Added the lineinfo module. Changed the complete code generation to use the
[cc65] / src / cc65 / coptind.c
index 2f8951ec25dcc9149d941f64efd0f888c27d3143..035a4852ea9c08f06231e798ddefdfc54b949067 100644 (file)
@@ -67,12 +67,13 @@ unsigned OptRTSJumps (CodeSeg* S)
            E->JumpTo != 0                      &&
            E->JumpTo->Owner->OPC == OPC_RTS) {
 
+           /* Insert an RTS instruction */
+           CodeEntry* X = NewCodeEntry (OPC_RTS, AM_IMP, 0, 0, E->LI);
+           InsertCodeEntry (S, X, I+1);
+
            /* Delete the jump */
            DelCodeEntry (S, I);
 
-           /* Insert an RTS instruction instead */
-           InsertCodeEntry (S, NewCodeEntry (OPC_RTS, AM_IMP, 0, 0), I);
-
            /* Remember, we had changes */
            ++Changes;
 
@@ -248,7 +249,7 @@ unsigned OptJumpCascades (CodeSeg* S)
                /* This is a jump cascade and we may jump to the final target.
                 * Insert a new instruction, then remove the old one
                 */
-               CodeEntry* X = NewCodeEntry (E->OPC, E->AM, N->Arg, N->JumpTo);
+               CodeEntry* X = NewCodeEntry (E->OPC, E->AM, N->Arg, N->JumpTo, E->LI);
 
                /* Insert it behind E */
                InsertCodeEntry (S, X, I+1);
@@ -284,8 +285,8 @@ unsigned OptJumpCascades (CodeSeg* S)
                    goto NextEntry;
                }
 
-               /* We may jump behind this conditional branch. Get the 
-                * pointer to the next instruction 
+               /* We may jump behind this conditional branch. Get the
+                * pointer to the next instruction
                 */
                if ((X = GetNextCodeEntry (S, GetCodeEntryIndex (S, N))) == 0) {
                    /* N is the last entry, bail out */