Patchwork GNU Superopt patches 2/6

login
register
mail settings
Submitter Joe Seymour
Date Sept. 7, 2010, 9:58 a.m.
Message ID <201009070958.o879wpKg023802@brsbs01.icerasemi.com>
Download mbox | patch
Permalink /patch/63979/
State New
Headers show

Comments

Joe Seymour - Sept. 7, 2010, 9:58 a.m.
This one moves Aux Stuff into a seperate file:

Tues Aug 31 2010  Joseph Seymour  <Seymour@IceraSemi.com>

	* aux.c: New file containing 'Aux Stuff' previously after main in
	superopt.c.
	* superopt.c: Removed 'Aux stuff'.
	* superopt.h: Added check to superopt.h so only parsed by cpp
	once.
	* Makefile: Added aux.c


--  
Joe Seymour

Patch

diff -Nup /home/seymour/testpatch/aux.c ./aux.c
--- /home/seymour/testpatch/aux.c	1970-01-01 01:00:00.000000000 +0100
+++ ./aux.c	2010-08-27 14:52:58.955603000 +0100
@@ -0,0 +1,93 @@ 
+/* Aux stuff that should go into a separate file.  */
+
+#include "superopt.h"
+#include <stdlib.h>
+#include <string.h>
+
+int
+ffs_internal(x)
+     word x;
+{
+  int co, ci = -1;
+  word d;
+  PERFORM_FFS(d, co, x, ci);
+  return d;
+}
+
+int
+floor_log2 (x)
+     word x;
+{
+  register int log = -1;
+  while (x != 0)
+    log++,
+    x >>= 1;
+  return log;
+}
+
+int
+ceil_log2 (x)
+     word x;
+{
+  return floor_log2 (x - 1) + 1;
+}
+
+const char clz_tab[] =
+{
+  32,31,30,30,29,29,29,29,28,28,28,28,28,28,28,28,
+  27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,
+  26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+  26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
+  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
+};
+
+const char ctz_tab[] =
+{
+  8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+};
+
+const char ff1_tab[] =
+{
+  32,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
+  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+  5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+  5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+};
diff -Nup /home/seymour/testpatch/Makefile ./Makefile
--- /home/seymour/testpatch/Makefile	2010-08-27 15:07:48.586203000 +0100
+++ ./Makefile	2010-08-27 14:56:43.781357000 +0100
@@ -22,8 +22,8 @@  ALL_MACHINES =	superopt-sparc \
 		superopt-sh \
 		superopt-hppa
 
-OBJS	= superopt.o
-SRCS	= superopt.c
+OBJS	= superopt.o aux.o
+SRCS	= superopt.c aux.c
 HDRS	= run_program.def insn.def goal.def superopt.h version.h longlong.h
 BINDIR	= /usr/local/bin
 INSTALL	= install -c
diff -Nup /home/seymour/testpatch/superopt.c ./superopt.c
--- /home/seymour/testpatch/superopt.c	2010-08-27 15:08:13.113530000 +0100
+++ ./superopt.c	2010-08-27 14:51:19.480415000 +0100
@@ -2989,93 +2989,3 @@  main(int argc, char **argv)
   main_synth(maxmax_cost, allowed_extra_cost);
   exit (!success);
 }
-
-/* Aux stuff that should go into a separate file.  */
-
-int
-ffs_internal(x)
-     word x;
-{
-  int co, ci = -1;
-  word d;
-  PERFORM_FFS(d, co, x, ci);
-  return d;
-}
-
-int
-floor_log2 (x)
-     word x;
-{
-  register int log = -1;
-  while (x != 0)
-    log++,
-    x >>= 1;
-  return log;
-}
-
-int
-ceil_log2 (x)
-     word x;
-{
-  return floor_log2 (x - 1) + 1;
-}
-
-const char clz_tab[] =
-{
-  32,31,30,30,29,29,29,29,28,28,28,28,28,28,28,28,
-  27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,
-  26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
-  26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
-  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
-  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
-  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
-  25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-  24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
-};
-
-const char ctz_tab[] =
-{
-  8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-};
-
-const char ff1_tab[] =
-{
-  32,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
-  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-  5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-  5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-};
diff -Nup /home/seymour/testpatch/superopt.h ./superopt.h
--- /home/seymour/testpatch/superopt.h	2010-08-27 15:08:13.116530000 +0100
+++ ./superopt.h	2010-08-27 14:53:38.706951000 +0100
@@ -16,6 +16,9 @@ 
    with this program; see the file COPYING.  If not, write to the Free
    Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+#ifndef SUPEROPT_HEADERS
+#define SUPEROPT_HEADERS
+
 #if !(defined(SPARC) || defined(POWER) || defined(POWERPC) || defined(M88000) \
       || defined(AM29K) || defined(MC68000) || defined(MC68020) \
       || defined(I386) || defined(PYR) || defined(ALPHA) || defined(HPPA) \
@@ -151,7 +154,6 @@  typedef unsigned_word word;
 #define PSTR "0x%x"
 #endif
 
-
 #define TRUNC_CNT(cnt) ((unsigned) (cnt) % BITS_PER_WORD)
 
 #if defined(sparc) || defined(__GNUC__)
@@ -1480,3 +1482,5 @@  run_program(insn_t *sequence, int n_insn
 extern const char clz_tab[];
 extern const char ctz_tab[];
 extern const char ff1_tab[];
+
+#endif // ifdef SUPEROPT_HEADERS