From a5e2d9e5baf869ae961fbb5820447290d6d9c7c8 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 26 Apr 2011 21:55:48 -0700 Subject: volk: reorganization of generation sources and generated files All generation sources have been moved to the gen/ subdirectory. Bootstrap and volk_register.py generate the files into to gen/ subdirectory in an effort to cleanly separate the static/generated parts of the build tree. Define top_gendir in Makefile.common, all generated sources listed in Makefile.ams are prefixed with $(top_gendir) to differentiate them from static in-tree sources. --- volk/gen/make_machines_h.py | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 volk/gen/make_machines_h.py (limited to 'volk/gen/make_machines_h.py') diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py new file mode 100644 index 000000000..674ee12cd --- /dev/null +++ b/volk/gen/make_machines_h.py @@ -0,0 +1,50 @@ +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This program 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 3 of the License, or +# (at your option) any later version. +# +# This program 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, see . +# + +from volk_regexp import * + +def make_machines_h(functions, machines): + tempstring = r""" +// This file is automatically generated by make_machines_h.py. +// Do not edit this file. + +#ifndef INCLUDED_LIBVOLK_MACHINES_H +#define INCLUDED_LIBVOLK_MACHINES_H + +#include +#include + +struct volk_machine { + const unsigned int caps; //capabilities (i.e., archs compiled into this machine, in the volk_get_lvarch format) + const char *name; +""" + for function in functions: + tempstring += "\n const struct volk_func_desc " + function + "_desc;\n" + tempstring += " const " + replace_volk.sub("p", function) + " *" + function + "_archs;\n" + + tempstring += r"""}; + +""" + for machine in machines: + tempstring += """#if LV_MACHINE_""" + machine.swapcase() + "\n" + tempstring += "extern const struct volk_machine volk_machine_" + machine + ";\n" + tempstring += """#endif\n""" + + tempstring += r""" +#endif //INCLUDED_LIBVOLK_MACHINES_H""" + + return tempstring -- cgit From 701b1c520865388a4287c6a3f63afb3ce2626cf1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 5 May 2011 19:02:03 -0700 Subject: volk: make volk_machines.cc c-safe Initialize the list of machine structs w/ pointers, this does not rely on C++ initialization and is smaller. In addition, rename the file extension to .c so we know its C only. Interesting note, this also fixes a bug when compiling under MSVC, the machines list initialization seemed to have problems prior to this change. --- volk/gen/make_machines_h.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'volk/gen/make_machines_h.py') diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py index 674ee12cd..082ca1488 100644 --- a/volk/gen/make_machines_h.py +++ b/volk/gen/make_machines_h.py @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2011 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ struct volk_machine { """ for machine in machines: tempstring += """#if LV_MACHINE_""" + machine.swapcase() + "\n" - tempstring += "extern const struct volk_machine volk_machine_" + machine + ";\n" + tempstring += "extern struct volk_machine volk_machine_" + machine + ";\n" tempstring += """#endif\n""" tempstring += r""" -- cgit From f9f3509dabe429953afc30ca7672b167dc4b5523 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 6 May 2011 11:01:57 -0700 Subject: volk: make volk_machine_xxx.cc c-safe Initialize each machine struct using C constants, (rather than relying on C++ to copy objects). Each machine file is far simpler, because we know what archs are in a machine, we can generate exactly the right code. In addition, rename the file extensions to .c so we know its C only. --- volk/gen/make_machines_h.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'volk/gen/make_machines_h.py') diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py index 082ca1488..aa6daa6cc 100644 --- a/volk/gen/make_machines_h.py +++ b/volk/gen/make_machines_h.py @@ -17,7 +17,7 @@ from volk_regexp import * -def make_machines_h(functions, machines): +def make_machines_h(functions, machines, archs): tempstring = r""" // This file is automatically generated by make_machines_h.py. // Do not edit this file. @@ -33,8 +33,10 @@ struct volk_machine { const char *name; """ for function in functions: - tempstring += "\n const struct volk_func_desc " + function + "_desc;\n" - tempstring += " const " + replace_volk.sub("p", function) + " *" + function + "_archs;\n" + tempstring += " const char *%s_indices[%d];\n"%(function, len(archs)) + tempstring += " const int %s_arch_defs[%d];\n"%(function, len(archs)) + tempstring += " const %s %s_archs[%d];\n"%(replace_volk.sub("p", function), function, len(archs)) + tempstring += " const int %s_n_archs;\n"%function tempstring += r"""}; -- cgit From 5b4c7d27e9d49ab58df1f1d9350dcaf64c60a1ce Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 6 May 2011 12:41:16 -0700 Subject: volk: top-level common header cleanup Since we already have a volk_common.h, moved the attributes, API declaration, and c-linkage macros into volk_common.h This change removes volk_attributes.h, in favor of one common include header. The implementation headers that require attributes now include volk_common.h This change removes the emit_omnilog.py script, in favor of pre-processor macros in volk_common.h In addition, extern C is only defined when in C++ and in GCC because non-GCC does not have complex.h --- volk/gen/make_machines_h.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'volk/gen/make_machines_h.py') diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py index aa6daa6cc..09ada3e0d 100644 --- a/volk/gen/make_machines_h.py +++ b/volk/gen/make_machines_h.py @@ -28,6 +28,8 @@ def make_machines_h(functions, machines, archs): #include #include +__VOLK_DECL_BEGIN + struct volk_machine { const unsigned int caps; //capabilities (i.e., archs compiled into this machine, in the volk_get_lvarch format) const char *name; @@ -47,6 +49,9 @@ struct volk_machine { tempstring += """#endif\n""" tempstring += r""" + +__VOLK_DECL_END + #endif //INCLUDED_LIBVOLK_MACHINES_H""" return tempstring -- cgit From b50dbc4498842fecd7f0c6adc22f25726f8d27d3 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Wed, 11 May 2011 21:45:03 -0700 Subject: Volk: Profiler is in apps/ now. Added name to function info. Going to C++-ify the whole thing. --- volk/gen/make_machines_h.py | 1 + 1 file changed, 1 insertion(+) (limited to 'volk/gen/make_machines_h.py') diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py index 09ada3e0d..563de18a6 100644 --- a/volk/gen/make_machines_h.py +++ b/volk/gen/make_machines_h.py @@ -35,6 +35,7 @@ struct volk_machine { const char *name; """ for function in functions: + tempstring += " const char *%s_name;\n"%function tempstring += " const char *%s_indices[%d];\n"%(function, len(archs)) tempstring += " const int %s_arch_defs[%d];\n"%(function, len(archs)) tempstring += " const %s %s_archs[%d];\n"%(replace_volk.sub("p", function), function, len(archs)) -- cgit From 3a41b3208e222965e908c6a04e3ab05379c782c4 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Wed, 18 May 2011 18:03:26 -0700 Subject: Volk: added alignment prop to each machine. call volk_get_alignment() to get your machine's reqd alignment for malloc. --- volk/gen/make_machines_h.py | 1 + 1 file changed, 1 insertion(+) (limited to 'volk/gen/make_machines_h.py') diff --git a/volk/gen/make_machines_h.py b/volk/gen/make_machines_h.py index 563de18a6..a48caa89c 100644 --- a/volk/gen/make_machines_h.py +++ b/volk/gen/make_machines_h.py @@ -33,6 +33,7 @@ __VOLK_DECL_BEGIN struct volk_machine { const unsigned int caps; //capabilities (i.e., archs compiled into this machine, in the volk_get_lvarch format) const char *name; + const unsigned int alignment; //the maximum byte alignment required for functions in this library """ for function in functions: tempstring += " const char *%s_name;\n"%function -- cgit