]> git.sur5r.net Git - cc65/blobdiff - src/cc65/datatype.h
Add code size factor for optimizer routines
[cc65] / src / cc65 / datatype.h
index 680428c128ebb5036e2da4f2e1ed5c57f260f1a7..beabf2bd86067c40d1bbb34f3a9e9830584de56b 100644 (file)
@@ -43,6 +43,9 @@
 /* common */
 #include "attrib.h"
 
+/* cc65 */
+#include "funcdesc.h"
+
 
 
 /*****************************************************************************/
 
 
 
-// Basic data types
+/* Basic data types */
 enum {
     T_END          = 0x0000,
 
-    // Basic types
+    /* Basic types */
     T_TYPE_NONE            = 0x0000,
     T_TYPE_CHAR            = 0x0001,
     T_TYPE_SHORT    = 0x0002,
@@ -74,7 +77,7 @@ enum {
     T_TYPE_FUNC     = 0x000E,
     T_MASK_TYPE            = 0x001F,
 
-    // Type classes
+    /* Type classes */
     T_CLASS_NONE    = 0x0000,
     T_CLASS_INT            = 0x0020,
     T_CLASS_FLOAT   = 0x0040,
@@ -83,26 +86,26 @@ enum {
     T_CLASS_FUNC    = 0x00A0,
     T_MASK_CLASS    = 0x00E0,
 
-    // Type signedness
+    /* Type signedness */
     T_SIGN_NONE            = 0x0000,
     T_SIGN_UNSIGNED = 0x0100,
     T_SIGN_SIGNED   = 0x0200,
     T_MASK_SIGN     = 0x0300,
 
-    // Type size modifiers
+    /* Type size modifiers */
     T_SIZE_NONE            = 0x0000,
     T_SIZE_SHORT    = 0x0400,
     T_SIZE_LONG     = 0x0800,
     T_SIZE_LONGLONG = 0x0C00,
     T_MASK_SIZE            = 0x0C00,
 
-    // Type qualifiers
+    /* Type qualifiers */
     T_QUAL_NONE     = 0x0000,
     T_QUAL_CONST    = 0x1000,
     T_QUAL_VOLATILE = 0x2000,
     T_MASK_QUAL            = 0x3000,
 
-    // Types
+    /* Types */
     T_CHAR             = T_TYPE_CHAR     | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_NONE,
     T_SCHAR            = T_TYPE_CHAR     | T_CLASS_INT    | T_SIGN_SIGNED   | T_SIZE_NONE,
     T_UCHAR            = T_TYPE_CHAR     | T_CLASS_INT    | T_SIGN_UNSIGNED | T_SIZE_NONE,
@@ -137,7 +140,7 @@ typedef unsigned short type;
 /* Maximum length of a type string */
 #define MAXTYPELEN     30
 
-/* type elements needed for Encode/Decode */
+/* Type elements needed for Encode/Decode */
 #define DECODE_SIZE            5
 
 /* Predefined type strings */
@@ -147,6 +150,7 @@ extern type type_uint [];
 extern type type_long [];
 extern type type_ulong [];
 extern type type_void [];
+extern type type_size_t [];
 
 
 
@@ -185,12 +189,20 @@ type* GetCharArrayType (unsigned Len);
 type* GetImplicitFuncType (void);
 /* Return a type string for an inplicitly declared function */
 
+type* PointerTo (const type* T);
+/* Return a type string that is "pointer to T". The type string is allocated
+ * on the heap and may be freed after use.
+ */
+
 void PrintType (FILE* F, const type* Type);
 /* Output translation of type array. */
 
 void PrintRawType (FILE* F, const type* Type);
 /* Print a type string in raw format (for debugging) */
 
+void PrintFuncSig (FILE* F, const char* Name, type* Type);
+/* Print a function signature. */
+
 void Encode (type* Type, unsigned long Val);
 /* Encode an unsigned long into a type array */
 
@@ -275,7 +287,14 @@ int IsQualVolatile (const type* T) attribute ((const));
 /* Return true if the given type has a volatile type qualifier */
 
 int IsFastCallFunc (const type* T) attribute ((const));
-/* Return true if this is a function type with __fastcall__ calling conventions */
+/* Return true if this is a function type or pointer to function with
+ * __fastcall__ calling conventions
+ */
+
+int IsVariadicFunc (const type* T) attribute ((const));
+/* Return true if this is a function type or pointer to function type with
+ * variable parameter list
+ */
 
 int IsTypeFuncPtr (const type* T) attribute ((const));
 /* Return true if this is a function pointer */
@@ -295,9 +314,12 @@ type GetSizeModifier (const type* T) attribute ((const));
 type GetQualifier (const type* T) attribute ((const));
 /* Get the qualifier from the given type string */
 
-struct FuncDesc* GetFuncDesc (const type* T) attribute ((const));
+FuncDesc* GetFuncDesc (const type* T) attribute ((const));
 /* Get the FuncDesc pointer from a function or pointer-to-function type */
 
+type* GetFuncReturn (type* T) attribute ((const));
+/* Return a pointer to the return type of a function or pointer-to-function type */
+
 
 
 /* End of datatype.h */