diff options
-rw-r--r-- | volk/gen/make_c.py | 12 | ||||
-rw-r--r-- | volk/gen/make_machines_c.py | 24 | ||||
-rw-r--r-- | volk/gen/make_machines_h.py | 4 | ||||
-rw-r--r-- | volk/gen/make_makefile_am.py | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | volk/gen/volk_register.py | 2 |
5 files changed, 15 insertions, 31 deletions
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py index 591e8b64c..5bad910ae 100644 --- a/volk/gen/make_c.py +++ b/volk/gen/make_c.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 @@ -48,7 +48,7 @@ def make_c(machines, archs, functions, arched_arglist, my_arglist): #here do static fn get arch tempstring += r""" struct volk_machine *get_machine(void) { - extern struct volk_machine volk_machines[]; + extern struct volk_machine *volk_machines[]; extern unsigned int n_volk_machines; static struct volk_machine *machine = NULL; @@ -57,10 +57,10 @@ struct volk_machine *get_machine(void) { unsigned int max_score = 0; int i; for(i=0; i<n_volk_machines; i++) { - if(!(volk_machines[i].caps & (~volk_get_lvarch()))) { - if(volk_machines[i].caps > max_score) { - max_score = volk_machines[i].caps; - machine = &(volk_machines[i]); + if(!(volk_machines[i]->caps & (~volk_get_lvarch()))) { + if(volk_machines[i]->caps > max_score) { + max_score = volk_machines[i]->caps; + machine = volk_machines[i]; } } } diff --git a/volk/gen/make_machines_c.py b/volk/gen/make_machines_c.py index 9ad56fb62..ccac21131 100644 --- a/volk/gen/make_machines_c.py +++ b/volk/gen/make_machines_c.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 @@ -26,32 +26,16 @@ def make_machines_c(machines): #include <volk/volk_typedefs.h> #include <volk/volk_machines.h> -struct volk_machine volk_machines[] = { +struct volk_machine *volk_machines[] = { """ for machine in machines: tempstring += """#if LV_MACHINE_""" + machine.swapcase() + "\n" - tempstring += "volk_machine_" + machine + tempstring += "&volk_machine_" + machine tempstring += "," tempstring += "\n#endif\n" tempstring += r""" }; - -""" - - for machine in machines: - tempstring += "#if LV_MACHINE_" + machine.swapcase() + "\n" - tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 1\n" - tempstring += "#else\n" - tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 0\n" - tempstring += "#endif\n" - - tempstring += """unsigned int n_volk_machines = +unsigned int n_volk_machines = sizeof(volk_machines)/sizeof(*volk_machines); """ - for machine in machines: - tempstring += "(LV_MACHINE_" + machine.swapcase() + "_CNT) " - tempstring += "+ " - tempstring = tempstring[:-2] - tempstring += ";\n" - return tempstring 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""" diff --git a/volk/gen/make_makefile_am.py b/volk/gen/make_makefile_am.py index 0d746ca28..929b6075d 100644 --- a/volk/gen/make_makefile_am.py +++ b/volk/gen/make_makefile_am.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 @@ -46,7 +46,7 @@ libvolk_la_SOURCES = \ $(top_gendir)/lib/volk.cc \ $(top_gendir)/lib/volk_cpu.c \ volk_rank_archs.c \ - $(top_gendir)/lib/volk_machines.cc + $(top_gendir)/lib/volk_machines.c if LV_HAVE_ORC volk_orc_CFLAGS = -DLV_HAVE_ORC=1 diff --git a/volk/gen/volk_register.py b/volk/gen/volk_register.py index 19fc61c15..aae32c705 100755..100644 --- a/volk/gen/volk_register.py +++ b/volk/gen/volk_register.py @@ -50,7 +50,7 @@ outfile_environment_c = open(os.path.join(gendir, "lib/volk_environment_init.c") outfile_environment_h = open(os.path.join(gendir, "include/volk/volk_environment_init.h"), "w") outfile_makefile_am = open(os.path.join(gendir, "lib/Makefile.am"), "w") outfile_machines_h = open(os.path.join(gendir, "include/volk/volk_machines.h"), "w") -outfile_machines_c = open(os.path.join(gendir, "lib/volk_machines.cc"), "w") +outfile_machines_c = open(os.path.join(gendir, "lib/volk_machines.c"), "w") infile = open(os.path.join(srcdir, "include/volk/Makefile.am"), "r") |