develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34457 - trunk/compilers/imcc

From:
petdance
Date:
December 27, 2008 15:59
Subject:
[svn:parrot] r34457 - trunk/compilers/imcc
Message ID:
20081227235916.DF8D9CBA12@x12.develooper.com
Author: petdance
Date: Sat Dec 27 15:59:16 2008
New Revision: 34457

Modified:
   trunk/compilers/imcc/optimizer.c
   trunk/compilers/imcc/optimizer.h

Log:
staticing and localizing

Modified: trunk/compilers/imcc/optimizer.c
==============================================================================
--- trunk/compilers/imcc/optimizer.c	(original)
+++ trunk/compilers/imcc/optimizer.c	Sat Dec 27 15:59:16 2008
@@ -179,6 +179,10 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
+PARROT_WARN_UNUSED_RESULT
+static int max_loop_depth(ARGIN(const IMC_Unit *unit))
+        __attribute__nonnull__(1);
+
 static int strength_reduce(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
@@ -956,19 +960,14 @@
     int found, branched;
 
     /* construct a FLOATVAL_FMT with needed precision */
-    switch (NUMVAL_SIZE) {
-        case 8:
-            fmt = "%0.16g";
-            break;
-        case 12:
-            fmt = "%0.18Lg";
-            break;
-        default:
-            IMCC_warning(interp, "subs_constants",
-                    "used default FLOATVAL_FMT\n");
-            fmt = FLOATVAL_FMT;
-            break;
-    }
+#if NUMVAL_SIZE == 8
+    fmt = "%0.16g";
+#elif NUMVAL_SIZE == 12
+    fmt = "%0.18Lg";
+#else
+    fmt = FLOATVAL_FMT;
+    IMCC_warning(interp, "subs_constants", "used default FLOATVAL_FMT\n");
+#endif
 
     tmp = NULL;
     found = 0;
@@ -1081,8 +1080,9 @@
                 break;
             case 'S':
             {
-                char *name = string_to_cstring(interp, REG_STR(interp, 0));
-                r[1]       = mk_const(interp, name, r[0]->set);
+                char * const name = string_to_cstring(interp, REG_STR(interp, 0));
+
+                r[1] = mk_const(interp, name, r[0]->set);
 
                 snprintf(b, sizeof (b), "%p", REG_STR(interp, 0));
                 string_cstring_free(name);
@@ -1445,14 +1445,14 @@
                 used = 1;
 #else
             else {
-                Instruction *ins2;
-                SymReg      *addr;
-                int          j;
-
+                int j;
                 for (j=0; unit->bb_list[j]; j++) {
                     /* a branch can be the first ins in a block
                      * (if prev ins was a label)
                      * or the last ins in a block */
+                    Instruction *ins2;
+                    SymReg      *addr;
+
                     ins2 = unit->bb_list[j]->start;
                     if ((ins2->type & ITBRANCH) &&
                             (addr = get_branch_reg(ins2)) != 0) {
@@ -1742,7 +1742,7 @@
 
 /*
 
-=item C<int max_loop_depth>
+=item C<static int max_loop_depth>
 
 RT #48260: Not yet documented!!!
 
@@ -1751,7 +1751,7 @@
 */
 
 PARROT_WARN_UNUSED_RESULT
-int
+static int
 max_loop_depth(ARGIN(const IMC_Unit *unit))
 {
     int i;

Modified: trunk/compilers/imcc/optimizer.h
==============================================================================
--- trunk/compilers/imcc/optimizer.h	(original)
+++ trunk/compilers/imcc/optimizer.h	Sat Dec 27 15:59:16 2008
@@ -63,10 +63,6 @@
         FUNC_MODIFIES(*unit)
         FUNC_MODIFIES(*r);
 
-PARROT_WARN_UNUSED_RESULT
-int max_loop_depth(ARGIN(const IMC_Unit *unit))
-        __attribute__nonnull__(1);
-
 int move_ins_out(PARROT_INTERP,
     ARGMOD(IMC_Unit *unit),
     ARGMOD(Instruction **ins),



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About