]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codeinfo.h
Fixed more E_MCONST issues
[cc65] / src / cc65 / codeinfo.h
index b4fa4ce038ba8be81cbcce7cab4ce80fc6b56080..b9f2a08c0b40324beaaf3a239b05bd60f1d757b5 100644 (file)
@@ -2,7 +2,7 @@
 /*                                                                           */
 /*                               codeinfo.h                                 */
 /*                                                                           */
-/*             Additional information about code instructions               */
+/*                 Additional information about 6502 code                   */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
 
 
 /*****************************************************************************/
-/*                                  Data                                    */
+/*                                Forwards                                  */
 /*****************************************************************************/
 
 
 
-/* Flags that tell what a specific instruction does with a register.
- * Please note that *changing* a register must not necessarily mean that the
- * value currently in the register is used. A prominent example is a load
- * instruction: It changes the register contents and does not use the old
- * value. On the flip side, a shift or something similar would use the
- * current value and change it.
- */
-#define CI_USE_NONE    0x0000U         /* Use nothing */
-#define CI_USE_A       0x0001U         /* Use the A register */
-#define CI_USE_X       0x0002U         /* Use the X register */
-#define CI_USE_Y       0x0004U         /* Use the Y register */
-#define CI_USE_ALL     0x0007U         /* Use all registers */
-#define CI_MASK_USE            0x000FU         /* Extract usage info */
+struct CodeSeg;
+
+
+
+/*****************************************************************************/
+/*                                  Data                                    */
+/*****************************************************************************/
 
-#define CI_CHG_NONE    0x0000U         /* Change nothing */
-#define CI_CHG_A       0x0010U         /* Change the A register */
-#define CI_CHG_X       0x0020U         /* Change the X register */
-#define CI_CHG_Y       0x0040U         /* Change the Y register */
-#define CI_CHG_ALL     0x0070U         /* Change all registers */
-#define CI_MASK_CHG    0x00F0U         /* Extract change info */
 
-#define CI_BRA         0x0100U         /* Instruction is a branch */
-#define CI_MASK_BRA    0x0100U         /* Extract branch info */
 
-#define CI_NONE                0x0000U         /* Nothing used/changed */
+/* Defines for registers. */
+#define REG_NONE       0x00U
+#define REG_A          0x01U
+#define REG_X          0x02U
+#define REG_Y          0x04U
+#define REG_SREG_LO    0x08U
+#define REG_SREG_HI    0x10U
+#define REG_TMP1       0x20U
+#define REG_PTR1_LO    0x40U
+#define REG_PTR1_HI    0x80U
+#define        REG_AX          (REG_A | REG_X)
+#define REG_XY         (REG_X | REG_Y)
+#define REG_AXY                (REG_A | REG_X | REG_Y)
 
 
 
 
 
 
+void GetFuncInfo (const char* Name, unsigned char* Use, unsigned char* Chg);
+/* For the given function, lookup register information and store it into
+ * the given variables. If the function is unknown, assume it will use and
+ * load all registers.
+ */
+
+int IsZPName (const char* Name);
+/* Return true if the given name is a zero page symbol */
+
+unsigned char GetRegInfo (struct CodeSeg* S, unsigned Index);
+/* Determine register usage information for the instructions starting at the
+ * given index.
+ */
+
+int RegAUsed (struct CodeSeg* S, unsigned Index);
+/* Check if the value in A is used. */
+
+int RegXUsed (struct CodeSeg* S, unsigned Index);
+/* Check if the value in X is used. */
+
+int RegYUsed (struct CodeSeg* S, unsigned Index);
+/* Check if the value in Y is used. */
+
+
+
 /* End of codeinfo.h */
 #endif
 
 
 
+