]> git.sur5r.net Git - cc65/commitdiff
Added a forgotten header file.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 11 Jun 2012 07:06:24 +0000 (07:06 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 11 Jun 2012 07:06:24 +0000 (07:06 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5711 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/coptptrstore.h [new file with mode: 0644]

diff --git a/src/cc65/coptptrstore.h b/src/cc65/coptptrstore.h
new file mode 100644 (file)
index 0000000..76d283c
--- /dev/null
@@ -0,0 +1,198 @@
+/*****************************************************************************/
+/*                                                                           */
+/*                               coptptrstore.h                              */
+/*                                                                           */
+/*                      Optimize stores through pointers                     */
+/*                                                                           */
+/*                                                                           */
+/*                                                                           */
+/* (C) 2012,      Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
+/*                                                                           */
+/*                                                                           */
+/* This software is provided 'as-is', without any expressed or implied       */
+/* warranty.  In no event will the authors be held liable for any damages    */
+/* arising from the use of this software.                                    */
+/*                                                                           */
+/* Permission is granted to anyone to use this software for any purpose,     */
+/* including commercial applications, and to alter it and redistribute it    */
+/* freely, subject to the following restrictions:                            */
+/*                                                                           */
+/* 1. The origin of this software must not be misrepresented; you must not   */
+/*    claim that you wrote the original software. If you use this software   */
+/*    in a product, an acknowledgment in the product documentation would be  */
+/*    appreciated but is not required.                                       */
+/* 2. Altered source versions must be plainly marked as such, and must not   */
+/*    be misrepresented as being the original software.                      */
+/* 3. This notice may not be removed or altered from any source              */
+/*    distribution.                                                          */
+/*                                                                           */
+/*****************************************************************************/
+
+
+
+#ifndef COPTPTRSTORE_H
+#define COPTPTRSTORE_H
+
+
+
+/* cc65 */
+#include "codeseg.h"
+
+
+
+/*****************************************************************************/
+/*                                  Code                                    */
+/*****************************************************************************/
+
+
+
+unsigned OptPtrStore1 (CodeSeg* S);
+/* Search for the sequence:
+ *
+ *      lda     #<(label+0)
+ *      ldx     #>(label+0)
+ *      clc
+ *      adc     xxx
+ *      bcc     L
+ *      inx
+ * L:   jsr    pushax
+ *     ldx     #$00
+ *     lda     yyy
+ *     ldy     #$00
+ *      jsr     staspidx
+ *
+ * and replace it by:
+ *
+ *      ldy     xxx
+ *     ldx     #$00
+ *     lda     yyy
+ *      sta    label,y
+ */
+
+unsigned OptPtrStore2 (CodeSeg* S);
+/* Search for the sequence:
+ *
+ *      lda     #<(label+0)
+ *      ldx     #>(label+0)
+ *      ldy     aaa
+ *      clc
+ *      adc     (sp),y
+ *      bcc     L
+ *      inx
+ * L:   jsr    pushax
+ *     ldx     #$00
+ *     lda     yyy
+ *     ldy     #$00
+ *      jsr     staspidx
+ *
+ * and replace it by:
+ *
+ *      ldy     aaa
+ *     ldx     #$00
+ *     lda     (sp),y
+ *      tay
+ *      lda     yyy
+ *      sta    label,y
+ */
+
+unsigned OptPtrStore3 (CodeSeg* S);
+/* Search for the sequence:
+ *
+ *      lda     #<(label+0)
+ *      ldx     #>(label+0)
+ *      ldy     aaa
+ *      clc
+ *      adc     (sp),y
+ *      bcc     L
+ *      inx
+ * L:   jsr    pushax
+ *      ldy     #bbb
+ *     ldx     #$00
+ *     lda     (sp),y
+ *     ldy     #$00
+ *      jsr     staspidx
+ *
+ * and replace it by:
+ *
+ *      ldy     aaa
+ *     lda     (sp),y
+ *      tax
+ *      ldy     #bbb-2
+ *      lda     (sp),y
+ *      sta    label,x
+ *     ldx     #$00
+ */
+
+unsigned OptPtrStore4 (CodeSeg* S);
+/* Search for the sequence:
+ *
+ *      ldy     #offs1
+ *      clc
+ *      adc     (sp),y
+ *      bcc     L
+ *      inx
+ * L:   jsr     pushax
+ *     ldy     #offs2
+ *      ldx     #$00
+ *      lda     (sp),y
+ *      ldy     #$00
+ *      jsr     staspidx
+ *
+ * and replace it by:
+ *
+ *      sta     ptr1
+ *      stx     ptr1+1
+ *      ldx     #$00
+ *      ldy     #offs2-2
+ *      lda     (sp),y
+ *      ldy     #offs1
+ *      sta     (ptr1),y
+ */
+
+unsigned OptPtrStore5 (CodeSeg* S);
+/* Search for the sequence:
+ *
+ *     jsr     pushax
+ *      ldy     xxx
+ *      jsr     ldauidx
+ *      subop
+ *      ldy     yyy
+ *     jsr     staspidx
+ *
+ * and replace it by:
+ *
+ *      sta     ptr1
+ *      stx     ptr1+1
+ *      ldy     xxx
+ *      ldx     #$00
+ *      lda     (ptr1),y
+ *     subop
+ *      ldy     yyy
+ *      sta     (ptr1),y
+ *
+ * In case a/x is loaded from the register bank before the pushax, we can even
+ * use the register bank instead of ptr1.
+ *
+ *
+ *     jsr     pushax
+ *      ldy     xxx
+ *      jsr     ldauidx
+ *      ldx     #$00
+ *      lda     (zp),y
+ *      subop
+ *      ldy     yyy
+ *      sta     (zp),y
+ *     jsr     staspidx
+ */
+
+
+
+/* End of coptptrstore.h */
+#endif
+
+
+
+