[svn:parrot] r43992 - trunk/compilers/pirc/src

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Feb 16 08:45:10 UTC 2010


Author: bacek
Date: Tue Feb 16 08:45:09 2010
New Revision: 43992
URL: https://trac.parrot.org/parrot/changeset/43992

Log:
Headerizer happiness work

Modified:
   trunk/compilers/pirc/src/pirregalloc.c

Modified: trunk/compilers/pirc/src/pirregalloc.c
==============================================================================
--- trunk/compilers/pirc/src/pirregalloc.c	Tue Feb 16 08:44:48 2010	(r43991)
+++ trunk/compilers/pirc/src/pirregalloc.c	Tue Feb 16 08:45:09 2010	(r43992)
@@ -47,8 +47,7 @@
 
 /*
 
-=item C<static void
-reset_register_count(lsr_allocator * const lsr)>
+=item C<static void reset_register_count(lsr_allocator * const lsr)>
 
 Reset the register counters; there's one counter for each register
 type (string, num, int, pmc).
@@ -57,7 +56,8 @@
 
 */
 static void
-reset_register_count(lsr_allocator * const lsr) {
+reset_register_count(ARGIN(lsr_allocator * const lsr))
+{
     int i;
     /* the "r" field keeps track of the number of registers that must be allocated by
      * parrot. In the original implementation, "r" is constant, and indicates the number
@@ -81,38 +81,74 @@
     pir_type type)
         __attribute__nonnull__(1);
 
+static void add_interval_to_active(
+    ARGIN(lsr_allocator *lsr),
+    ARGIN(live_interval * const i),
+    pir_type type)
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+static void add_live_interval(
+    ARGIN(lsr_allocator * const lsr),
+    ARGIN(live_interval * const i),
+    pir_type type)
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
 static void cache_interval_object(
-    ARGMOD(lsr_allocator * const lsr),
-    live_interval * interval)
+    ARGIN(lsr_allocator * const lsr),
+    ARGIN(live_interval * interval))
         __attribute__nonnull__(1)
-        FUNC_MODIFIES(* const lsr);
+        __attribute__nonnull__(2);
 
 static void expire_old_intervals(
-    ARGMOD(lsr_allocator * const lsr),
-    live_interval * const i,
+    ARGIN(lsr_allocator * const lsr),
+    ARGIN(live_interval * const i),
     pir_type type)
         __attribute__nonnull__(1)
-        FUNC_MODIFIES(* const lsr);
+        __attribute__nonnull__(2);
+
+static unsigned get_free_reg(
+    ARGIN(lsr_allocator * const lsr),
+    pir_type type)
+        __attribute__nonnull__(1);
 
+static unsigned lengthi(ARGIN_NULLOK(live_interval *list));
 static void remove_from_active(ARGMOD(live_interval *i))
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*i);
 
+static void reset_register_count(ARGIN(lsr_allocator * const lsr))
+        __attribute__nonnull__(1);
+
 #define ASSERT_ARGS_add_free_reg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(lsr))
+#define ASSERT_ARGS_add_interval_to_active __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lsr) \
+    , PARROT_ASSERT_ARG(i))
+#define ASSERT_ARGS_add_live_interval __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lsr) \
+    , PARROT_ASSERT_ARG(i))
 #define ASSERT_ARGS_cache_interval_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(lsr))
+       PARROT_ASSERT_ARG(lsr) \
+    , PARROT_ASSERT_ARG(interval))
 #define ASSERT_ARGS_expire_old_intervals __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lsr) \
+    , PARROT_ASSERT_ARG(i))
+#define ASSERT_ARGS_get_free_reg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(lsr))
+#define ASSERT_ARGS_lengthi __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
 #define ASSERT_ARGS_remove_from_active __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(i))
+#define ASSERT_ARGS_reset_register_count __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lsr))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
 /*
 
-=item C<lsr_allocator *
-new_linear_scan_register_allocator(struct lexer_state * lexer)>
+=item C<lsr_allocator * new_linear_scan_register_allocator(struct lexer_state
+*lexer)>
 
 Constructor for a linear scan register allocator.
 Initializes the allocator, and returns it.
@@ -120,8 +156,10 @@
 =cut
 
 */
+PARROT_CAN_RETURN_NULL
 lsr_allocator *
-new_linear_scan_register_allocator(struct lexer_state *lexer) {
+new_linear_scan_register_allocator(ARGIN_NULLOK(struct lexer_state *lexer))
+{
     lsr_allocator *lsr = (lsr_allocator *)mem_sys_allocate_zeroed(sizeof (lsr_allocator));
 
     lsr->lexer = lexer;
@@ -136,7 +174,8 @@
 */
 void print_list(char *msg, live_interval *i);
 void
-print_list(char *msg, live_interval *i) {
+print_list(ARGIN(char *msg), ARGIN(live_interval *i))
+{
     fprintf(stderr, "%s: ", msg);
     while (i) {
         fprintf(stderr, "[%d] ", i->endpoint);
@@ -156,7 +195,8 @@
 
 */
 void
-destroy_linear_scan_register_allocator(lsr_allocator *lsr) {
+destroy_linear_scan_register_allocator(ARGMOD(lsr_allocator *lsr))
+{
     pir_type type;
     live_interval *i;
 
@@ -186,7 +226,8 @@
 
 */
 static unsigned
-lengthi(live_interval *list) {
+lengthi(ARGIN_NULLOK(live_interval *list))
+{
     unsigned len = 0;
 
     while (list) {
@@ -198,8 +239,8 @@
 
 /*
 
-=item C<static void
-add_live_interval(lsr_allocator * const lsr, live_interval * const i, pir_type type)>
+=item C<static void add_live_interval(lsr_allocator * const lsr, live_interval *
+const i, pir_type type)>
 
 Add live_interval C<i> to the list; this list is sorted on increasing
 start point.
@@ -208,7 +249,9 @@
 
 */
 static void
-add_live_interval(lsr_allocator * const lsr, live_interval * const i, pir_type type) {
+add_live_interval(ARGIN(lsr_allocator * const lsr),
+    ARGIN(live_interval * const i), pir_type type)
+{
     live_interval *iter = lsr->intervals[type];
 
     /* if there's no interval for the specified type, insert i as the first one and return */
@@ -285,10 +328,13 @@
 =cut
 
 */
+PARROT_CAN_RETURN_NULL
 PARROT_MALLOC
 PARROT_WARN_UNUSED_RESULT
 live_interval *
-new_live_interval(lsr_allocator * const lsr, unsigned firstuse_location, pir_type type) {
+new_live_interval(ARGIN(lsr_allocator * const lsr),
+        unsigned firstuse_location, pir_type type)
+{
     live_interval *i;
     /* check whether there's an interval object that we can re-use, to prevent
      * memory malloc() and free()s.
@@ -321,8 +367,8 @@
 
 /*
 
-=item C<static void
-add_interval_to_active(lsr_allocator *lsr, live_interval * i, pir_type type)>
+=item C<static void add_interval_to_active(lsr_allocator *lsr, live_interval *
+const i, pir_type type)>
 
 Add interval C<i> to the list of active intervals; the list is sorted
 on increasing endpoint.
@@ -331,7 +377,9 @@
 
 */
 static void
-add_interval_to_active(lsr_allocator *lsr, live_interval * const i, pir_type type) {
+add_interval_to_active(ARGIN(lsr_allocator *lsr),
+        ARGIN(live_interval * const i), pir_type type)
+{
     live_interval *iter = lsr->active[type];
 
     /* if there's no active intervals, set i as first */
@@ -389,8 +437,7 @@
 
 /*
 
-=item C<static unsigned
-get_free_reg(lsr_allocator * const lsr, pir_type type)>
+=item C<static unsigned get_free_reg(lsr_allocator * const lsr, pir_type type)>
 
 Allocate a new register; if there's any old registers to be reused, return
 such a second-hand register; otherwise, allocate a brand new one.
@@ -399,7 +446,8 @@
 
 */
 static unsigned
-get_free_reg(lsr_allocator * const lsr, pir_type type) {
+get_free_reg(ARGIN(lsr_allocator * const lsr), pir_type type)
+{
     /* if there's any second hand register for the requested type, return that. */
     if (lsr->free_regs[type]) {
         free_reg *available  = lsr->free_regs[type];
@@ -435,7 +483,8 @@
 
 */
 static void
-add_free_reg(ARGIN(lsr_allocator * const lsr), unsigned regno, pir_type type) {
+add_free_reg(ARGIN(lsr_allocator * const lsr), unsigned regno, pir_type type)
+{
     ASSERT_ARGS(add_free_reg)
 
     free_reg *reg;
@@ -500,8 +549,8 @@
 
 */
 static void
-expire_old_intervals(ARGMOD(lsr_allocator * const lsr),
-        live_interval * const i, pir_type type)
+expire_old_intervals(ARGIN(lsr_allocator * const lsr),
+        ARGIN(live_interval * const i), pir_type type)
 {
     ASSERT_ARGS(expire_old_intervals)
 
@@ -534,7 +583,8 @@
 
 */
 static void
-cache_interval_object(ARGMOD(lsr_allocator * const lsr), live_interval * interval)
+cache_interval_object(ARGIN(lsr_allocator * const lsr),
+        ARGIN(live_interval * interval))
 {
     interval->nextc = lsr->cached_intervals;
     lsr->cached_intervals = interval;
@@ -552,7 +602,7 @@
 
 */
 void
-linear_scan_register_allocation(ARGMOD(lsr_allocator * const lsr))
+linear_scan_register_allocation(ARGIN(lsr_allocator * const lsr))
 {
     live_interval * i;
     pir_type type = 0; /* types run from 0 to 4; see pircompunit.h */


More information about the parrot-commits mailing list