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_h.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 volk/gen/make_h.py (limited to 'volk/gen/make_h.py') diff --git a/volk/gen/make_h.py b/volk/gen/make_h.py new file mode 100644 index 000000000..07e62939b --- /dev/null +++ b/volk/gen/make_h.py @@ -0,0 +1,39 @@ +from xml.dom import minidom +from emit_omnilog import * +from volk_regexp import * + +# http://gcc.gnu.org/wiki/Visibility +volk_api_defines = """ +#ifdef volk_EXPORTS +# define VOLK_API __VOLK_ATTR_EXPORT +#else +# define VOLK_API __VOLK_ATTR_IMPORT +#endif +""" + +def make_h(funclist, arched_arglist) : + tempstring = ""; + tempstring = tempstring + '/*this file is auto generated by make_h.py*/\n'; + + tempstring = tempstring + '\n#ifndef INCLUDED_VOLK_RUNTIME'; + tempstring = tempstring + '\n#define INCLUDED_VOLK_RUNTIME'; + tempstring = tempstring + '\n\n#include\n'; + tempstring = tempstring + '#include\n'; + tempstring = tempstring + '#include\n'; + tempstring = tempstring + '#include\n'; + tempstring = tempstring + volk_api_defines + tempstring = tempstring + emit_prolog(); + + tempstring = tempstring + '\n'; + + for i in range(len(funclist)): + tempstring += "extern " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n" + tempstring += "extern VOLK_API void %s_manual%s;\n" % (funclist[i], arched_arglist[i]) + tempstring = strip_trailing(tempstring, " {") + tempstring += "extern VOLK_API struct volk_func_desc %s_get_func_desc(void);\n" % (funclist[i]) + + tempstring = tempstring + emit_epilog(); + tempstring = tempstring + "#endif /*INCLUDED_VOLK_RUNTIME*/\n"; + + return tempstring; + -- 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_h.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'volk/gen/make_h.py') diff --git a/volk/gen/make_h.py b/volk/gen/make_h.py index 07e62939b..3d5790de4 100644 --- a/volk/gen/make_h.py +++ b/volk/gen/make_h.py @@ -1,16 +1,6 @@ from xml.dom import minidom -from emit_omnilog import * from volk_regexp import * -# http://gcc.gnu.org/wiki/Visibility -volk_api_defines = """ -#ifdef volk_EXPORTS -# define VOLK_API __VOLK_ATTR_EXPORT -#else -# define VOLK_API __VOLK_ATTR_IMPORT -#endif -""" - def make_h(funclist, arched_arglist) : tempstring = ""; tempstring = tempstring + '/*this file is auto generated by make_h.py*/\n'; @@ -19,20 +9,26 @@ def make_h(funclist, arched_arglist) : tempstring = tempstring + '\n#define INCLUDED_VOLK_RUNTIME'; tempstring = tempstring + '\n\n#include\n'; tempstring = tempstring + '#include\n'; - tempstring = tempstring + '#include\n'; + tempstring = tempstring + '#include\n'; tempstring = tempstring + '#include\n'; - tempstring = tempstring + volk_api_defines - tempstring = tempstring + emit_prolog(); + tempstring = tempstring + '__VOLK_DECL_BEGIN\n'; tempstring = tempstring + '\n'; + tempstring += """ +struct volk_func_desc { + const char **indices; + const int *arch_defs; + const int n_archs; +}; +""" for i in range(len(funclist)): tempstring += "extern " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n" tempstring += "extern VOLK_API void %s_manual%s;\n" % (funclist[i], arched_arglist[i]) tempstring = strip_trailing(tempstring, " {") tempstring += "extern VOLK_API struct volk_func_desc %s_get_func_desc(void);\n" % (funclist[i]) - tempstring = tempstring + emit_epilog(); + tempstring = tempstring + '__VOLK_DECL_END\n'; tempstring = tempstring + "#endif /*INCLUDED_VOLK_RUNTIME*/\n"; return tempstring; -- 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_h.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'volk/gen/make_h.py') diff --git a/volk/gen/make_h.py b/volk/gen/make_h.py index 3d5790de4..76f5f8c69 100644 --- a/volk/gen/make_h.py +++ b/volk/gen/make_h.py @@ -21,6 +21,9 @@ struct volk_func_desc { const int *arch_defs; const int n_archs; }; + +VOLK_API unsigned int volk_get_alignment(void); + """ for i in range(len(funclist)): tempstring += "extern " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n" -- cgit From 85a8b62ff4b4382e216ea88661fc32c6f30b724f Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Mon, 30 May 2011 23:25:15 -0700 Subject: volk: make fptrs in volk.h visible --- volk/gen/make_h.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'volk/gen/make_h.py') diff --git a/volk/gen/make_h.py b/volk/gen/make_h.py index 76f5f8c69..354e57258 100644 --- a/volk/gen/make_h.py +++ b/volk/gen/make_h.py @@ -26,7 +26,7 @@ VOLK_API unsigned int volk_get_alignment(void); """ for i in range(len(funclist)): - tempstring += "extern " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n" + tempstring += "extern VOLK_API " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n" tempstring += "extern VOLK_API void %s_manual%s;\n" % (funclist[i], arched_arglist[i]) tempstring = strip_trailing(tempstring, " {") tempstring += "extern VOLK_API struct volk_func_desc %s_get_func_desc(void);\n" % (funclist[i]) -- cgit