From: Peter Johnson Date: Sun, 16 Sep 2001 21:39:58 +0000 (-0000) Subject: Add barebones optimizer module framework. X-Git-Tag: v0.1.0~343 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d758a063b2b558f47deba9de6bdb5cae3afbeb1d;p=yasm Add barebones optimizer module framework. svn path=/trunk/yasm/; revision=169 --- diff --git a/configure.ac b/configure.ac index 8af8f6c0..5a41f9fc 100644 --- a/configure.ac +++ b/configure.ac @@ -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/configure.in b/configure.in index 8af8f6c0..5a41f9fc 100644 --- a/configure.in +++ b/configure.in @@ -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 index 00000000..ff84f1e1 --- /dev/null +++ b/libyasm/optimizer.h @@ -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 index 00000000..c8286623 --- /dev/null +++ b/modules/optimizers/.cvsignore @@ -0,0 +1,3 @@ +.*.sw? +Makefile.in +Makefile diff --git a/modules/optimizers/Makefile.am b/modules/optimizers/Makefile.am new file mode 100644 index 00000000..e26d28c0 --- /dev/null +++ b/modules/optimizers/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = dbg diff --git a/modules/optimizers/basic/Makefile.am b/modules/optimizers/basic/Makefile.am new file mode 100644 index 00000000..e22223f9 --- /dev/null +++ b/modules/optimizers/basic/Makefile.am @@ -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 index 00000000..4e5ea719 --- /dev/null +++ b/modules/optimizers/basic/basic-optimizer.c @@ -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 index 00000000..13eacfe4 --- /dev/null +++ b/modules/optimizers/basic/optimizer.c @@ -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 index 00000000..a5bc4243 --- /dev/null +++ b/modules/optimizers/dbg/.cvsignore @@ -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 index 00000000..e22223f9 --- /dev/null +++ b/modules/optimizers/dbg/Makefile.am @@ -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 index 00000000..13eacfe4 --- /dev/null +++ b/modules/optimizers/dbg/optimizer.c @@ -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/Makefile.am b/src/Makefile.am index d648ac7f..a298f3d7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 index 00000000..ff84f1e1 --- /dev/null +++ b/src/optimizer.h @@ -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 index 00000000..c8286623 --- /dev/null +++ b/src/optimizers/.cvsignore @@ -0,0 +1,3 @@ +.*.sw? +Makefile.in +Makefile diff --git a/src/optimizers/Makefile.am b/src/optimizers/Makefile.am new file mode 100644 index 00000000..e26d28c0 --- /dev/null +++ b/src/optimizers/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = dbg diff --git a/src/optimizers/basic/Makefile.am b/src/optimizers/basic/Makefile.am new file mode 100644 index 00000000..e22223f9 --- /dev/null +++ b/src/optimizers/basic/Makefile.am @@ -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 index 00000000..4e5ea719 --- /dev/null +++ b/src/optimizers/basic/basic-optimizer.c @@ -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 index 00000000..13eacfe4 --- /dev/null +++ b/src/optimizers/basic/optimizer.c @@ -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 index 00000000..a5bc4243 --- /dev/null +++ b/src/optimizers/dbg/.cvsignore @@ -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 index 00000000..e22223f9 --- /dev/null +++ b/src/optimizers/dbg/Makefile.am @@ -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 index 00000000..13eacfe4 --- /dev/null +++ b/src/optimizers/dbg/optimizer.c @@ -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" +};