]> granicus.if.org Git - yasm/commitdiff
Add barebones optimizer module framework.
authorPeter Johnson <peter@tortall.net>
Sun, 16 Sep 2001 21:39:58 +0000 (21:39 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 16 Sep 2001 21:39:58 +0000 (21:39 -0000)
svn path=/trunk/yasm/; revision=169

21 files changed:
configure.ac
configure.in
libyasm/optimizer.h [new file with mode: 0644]
modules/optimizers/.cvsignore [new file with mode: 0644]
modules/optimizers/Makefile.am [new file with mode: 0644]
modules/optimizers/basic/Makefile.am [new file with mode: 0644]
modules/optimizers/basic/basic-optimizer.c [new file with mode: 0644]
modules/optimizers/basic/optimizer.c [new file with mode: 0644]
modules/optimizers/dbg/.cvsignore [new file with mode: 0644]
modules/optimizers/dbg/Makefile.am [new file with mode: 0644]
modules/optimizers/dbg/optimizer.c [new file with mode: 0644]
src/Makefile.am
src/optimizer.h [new file with mode: 0644]
src/optimizers/.cvsignore [new file with mode: 0644]
src/optimizers/Makefile.am [new file with mode: 0644]
src/optimizers/basic/Makefile.am [new file with mode: 0644]
src/optimizers/basic/basic-optimizer.c [new file with mode: 0644]
src/optimizers/basic/optimizer.c [new file with mode: 0644]
src/optimizers/dbg/.cvsignore [new file with mode: 0644]
src/optimizers/dbg/Makefile.am [new file with mode: 0644]
src/optimizers/dbg/optimizer.c [new file with mode: 0644]

index 8af8f6c0830482fc4dbbae764393e5db8ff69234..5a41f9fc0a58d922422ad052261e1cea162a5937 100644 (file)
@@ -55,4 +55,4 @@ case "$host" in
        ;;
 esac
 
-AC_OUTPUT(Makefile intl/Makefile po/Makefile.in src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/objfmts/Makefile src/objfmts/dbg/Makefile)
+AC_OUTPUT(Makefile intl/Makefile po/Makefile.in src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/objfmts/Makefile src/objfmts/dbg/Makefile src/optimizers/Makefile src/optimizers/dbg/Makefile)
index 8af8f6c0830482fc4dbbae764393e5db8ff69234..5a41f9fc0a58d922422ad052261e1cea162a5937 100644 (file)
@@ -55,4 +55,4 @@ case "$host" in
        ;;
 esac
 
-AC_OUTPUT(Makefile intl/Makefile po/Makefile.in src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/objfmts/Makefile src/objfmts/dbg/Makefile)
+AC_OUTPUT(Makefile intl/Makefile po/Makefile.in src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/objfmts/Makefile src/objfmts/dbg/Makefile src/optimizers/Makefile src/optimizers/dbg/Makefile)
diff --git a/libyasm/optimizer.h b/libyasm/optimizer.h
new file mode 100644 (file)
index 0000000..ff84f1e
--- /dev/null
@@ -0,0 +1,43 @@
+/* $Id: optimizer.h,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Optimizer module interface header file
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef YASM_OPTIMIZER_H
+#define YASM_OPTIMIZER_H
+
+/* Interface to the optimizer module(s) */
+typedef struct optimizer_s {
+    /* one-line description of the optimizer */
+    char *name;
+
+    /* keyword used to select optimizer on the command line */
+    char *keyword;
+
+    /* Main entrance point for the optimizer.
+     *
+     * This function takes the unoptimized linked list of sections and returns
+     * an optimized linked list of sections ready for output to an object file.
+     */
+} optimizer;
+
+/* Available optimizers */
+extern optimizer dbg_optimizer;
+
+#endif
diff --git a/modules/optimizers/.cvsignore b/modules/optimizers/.cvsignore
new file mode 100644 (file)
index 0000000..c828662
--- /dev/null
@@ -0,0 +1,3 @@
+.*.sw?
+Makefile.in
+Makefile
diff --git a/modules/optimizers/Makefile.am b/modules/optimizers/Makefile.am
new file mode 100644 (file)
index 0000000..e26d28c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = dbg
diff --git a/modules/optimizers/basic/Makefile.am b/modules/optimizers/basic/Makefile.am
new file mode 100644 (file)
index 0000000..e22223f
--- /dev/null
@@ -0,0 +1,12 @@
+noinst_LIBRARIES = liboptimizer.a
+
+liboptimizer_a_SOURCES = \
+       optimizer.c
+
+INCLUDES = \
+       -I$(top_srcdir)/src     \
+       -I$(top_srcdir)/intl
+
+if DEV
+CFLAGS = -ansi -pedantic -Wall -g
+endif
diff --git a/modules/optimizers/basic/basic-optimizer.c b/modules/optimizers/basic/basic-optimizer.c
new file mode 100644 (file)
index 0000000..4e5ea71
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id: basic-optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Debugging optimizer (used to debug optimizer module interface)
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "util.h"
+
+#include "optimizer.h"
+
+RCSID("$Id: basic-optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $");
+
+/* Define optimizer structure -- see optimizer.h for details */
+optimizer dbg_optimizer = {
+    "Trace of all info passed to optimizer module",
+    "dbg"
+};
diff --git a/modules/optimizers/basic/optimizer.c b/modules/optimizers/basic/optimizer.c
new file mode 100644 (file)
index 0000000..13eacfe
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Debugging optimizer (used to debug optimizer module interface)
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "util.h"
+
+#include "optimizer.h"
+
+RCSID("$Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $");
+
+/* Define optimizer structure -- see optimizer.h for details */
+optimizer dbg_optimizer = {
+    "Trace of all info passed to optimizer module",
+    "dbg"
+};
diff --git a/modules/optimizers/dbg/.cvsignore b/modules/optimizers/dbg/.cvsignore
new file mode 100644 (file)
index 0000000..a5bc424
--- /dev/null
@@ -0,0 +1,5 @@
+.*.sw?
+Makefile.in
+Makefile
+.deps
+liboptimizer.a
diff --git a/modules/optimizers/dbg/Makefile.am b/modules/optimizers/dbg/Makefile.am
new file mode 100644 (file)
index 0000000..e22223f
--- /dev/null
@@ -0,0 +1,12 @@
+noinst_LIBRARIES = liboptimizer.a
+
+liboptimizer_a_SOURCES = \
+       optimizer.c
+
+INCLUDES = \
+       -I$(top_srcdir)/src     \
+       -I$(top_srcdir)/intl
+
+if DEV
+CFLAGS = -ansi -pedantic -Wall -g
+endif
diff --git a/modules/optimizers/dbg/optimizer.c b/modules/optimizers/dbg/optimizer.c
new file mode 100644 (file)
index 0000000..13eacfe
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Debugging optimizer (used to debug optimizer module interface)
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "util.h"
+
+#include "optimizer.h"
+
+RCSID("$Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $");
+
+/* Define optimizer structure -- see optimizer.h for details */
+optimizer dbg_optimizer = {
+    "Trace of all info passed to optimizer module",
+    "dbg"
+};
index d648ac7fad8777a5e619817492ede3d73836b0de..a298f3d7edde1a36f997ddab33b28a9aa14c6329 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = parsers preprocs objfmts
+SUBDIRS = parsers preprocs optimizers objfmts
 
 INCLUDES = -I$(top_srcdir)/intl
 
@@ -26,6 +26,7 @@ yasm_SOURCES = \
 yasm_LDADD = \
        parsers/nasm/libparser.a        \
        preprocs/raw/libpreproc.a       \
+       optimizers/dbg/liboptimizer.a   \
        objfmts/dbg/libobjfmt.a         \
        $(INTLLIBS)
 
diff --git a/src/optimizer.h b/src/optimizer.h
new file mode 100644 (file)
index 0000000..ff84f1e
--- /dev/null
@@ -0,0 +1,43 @@
+/* $Id: optimizer.h,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Optimizer module interface header file
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef YASM_OPTIMIZER_H
+#define YASM_OPTIMIZER_H
+
+/* Interface to the optimizer module(s) */
+typedef struct optimizer_s {
+    /* one-line description of the optimizer */
+    char *name;
+
+    /* keyword used to select optimizer on the command line */
+    char *keyword;
+
+    /* Main entrance point for the optimizer.
+     *
+     * This function takes the unoptimized linked list of sections and returns
+     * an optimized linked list of sections ready for output to an object file.
+     */
+} optimizer;
+
+/* Available optimizers */
+extern optimizer dbg_optimizer;
+
+#endif
diff --git a/src/optimizers/.cvsignore b/src/optimizers/.cvsignore
new file mode 100644 (file)
index 0000000..c828662
--- /dev/null
@@ -0,0 +1,3 @@
+.*.sw?
+Makefile.in
+Makefile
diff --git a/src/optimizers/Makefile.am b/src/optimizers/Makefile.am
new file mode 100644 (file)
index 0000000..e26d28c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = dbg
diff --git a/src/optimizers/basic/Makefile.am b/src/optimizers/basic/Makefile.am
new file mode 100644 (file)
index 0000000..e22223f
--- /dev/null
@@ -0,0 +1,12 @@
+noinst_LIBRARIES = liboptimizer.a
+
+liboptimizer_a_SOURCES = \
+       optimizer.c
+
+INCLUDES = \
+       -I$(top_srcdir)/src     \
+       -I$(top_srcdir)/intl
+
+if DEV
+CFLAGS = -ansi -pedantic -Wall -g
+endif
diff --git a/src/optimizers/basic/basic-optimizer.c b/src/optimizers/basic/basic-optimizer.c
new file mode 100644 (file)
index 0000000..4e5ea71
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id: basic-optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Debugging optimizer (used to debug optimizer module interface)
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "util.h"
+
+#include "optimizer.h"
+
+RCSID("$Id: basic-optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $");
+
+/* Define optimizer structure -- see optimizer.h for details */
+optimizer dbg_optimizer = {
+    "Trace of all info passed to optimizer module",
+    "dbg"
+};
diff --git a/src/optimizers/basic/optimizer.c b/src/optimizers/basic/optimizer.c
new file mode 100644 (file)
index 0000000..13eacfe
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Debugging optimizer (used to debug optimizer module interface)
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "util.h"
+
+#include "optimizer.h"
+
+RCSID("$Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $");
+
+/* Define optimizer structure -- see optimizer.h for details */
+optimizer dbg_optimizer = {
+    "Trace of all info passed to optimizer module",
+    "dbg"
+};
diff --git a/src/optimizers/dbg/.cvsignore b/src/optimizers/dbg/.cvsignore
new file mode 100644 (file)
index 0000000..a5bc424
--- /dev/null
@@ -0,0 +1,5 @@
+.*.sw?
+Makefile.in
+Makefile
+.deps
+liboptimizer.a
diff --git a/src/optimizers/dbg/Makefile.am b/src/optimizers/dbg/Makefile.am
new file mode 100644 (file)
index 0000000..e22223f
--- /dev/null
@@ -0,0 +1,12 @@
+noinst_LIBRARIES = liboptimizer.a
+
+liboptimizer_a_SOURCES = \
+       optimizer.c
+
+INCLUDES = \
+       -I$(top_srcdir)/src     \
+       -I$(top_srcdir)/intl
+
+if DEV
+CFLAGS = -ansi -pedantic -Wall -g
+endif
diff --git a/src/optimizers/dbg/optimizer.c b/src/optimizers/dbg/optimizer.c
new file mode 100644 (file)
index 0000000..13eacfe
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $
+ * Debugging optimizer (used to debug optimizer module interface)
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  YASM is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "util.h"
+
+#include "optimizer.h"
+
+RCSID("$Id: optimizer.c,v 1.1 2001/09/16 21:39:58 peter Exp $");
+
+/* Define optimizer structure -- see optimizer.h for details */
+optimizer dbg_optimizer = {
+    "Trace of all info passed to optimizer module",
+    "dbg"
+};