# file to save ctags - current it isn't used file_ctags = 'tags.txt' # dir to save the downloadeds files dir_src = 'src/' # dir to save the generated files dir_output = 'output/' # url to repository repo_url = 'https://raw.githubusercontent.com/gcc-mirror/gcc/master/libgomp/' # files to download from repository and save in dir_src files = [ 'atomic.c', 'barrier.c', 'critical.c', 'loop.c', 'loop_ull.c', 'ordered.c', 'parallel.c', 'sections.c', 'single.c', 'task.c', 'target.c', 'taskloop.c', 'oacc-parallel.c' ] """ EXECUTE """ verify_paths([dir_src, dir_output]) generate_tags(file_ctags, file) dw.download(dir_src, repo_url, files) tags = parse_tag.parse(dir_src, dir_output, files) print('\n') # generate the nexts files ghh.gen_hookomp_h(tags, dir_output + 'hookomp.h') ghc.gen_hookomp_c(tags, dir_output + 'hookomp.c') gppd.gen_prepostdef(tags, dir_output + 'prepostdef.h') gppf.gen_prepostfunctions(tags, dir_output + 'prepostfunctions.c') glho.gen_libhookomp(dir_output)
import parse_tag tags = parse_tag.parse() print('#include <stdio.h>') print('#include <stdlib.h>') print('#include "debug.h"') print('typedef unsigned long long gomp_ull;') print('typedef _Bool bool;') print('typedef long TYPE;') print('#define NUM_FUNCTIONS %d' % len(tags)) print('// Keep the partial counters.') print('unsigned long int partial_count[NUM_FUNCTIONS];') print('unsigned long int accum_count[NUM_FUNCTIONS];') print('enum omp_idx_function {' + ','.join(['idx_' + tag.name for tag in tags]) + '} omp_idx_function;') print('\n') print('void print_results_csv_partial(void) {') print( '\tprintf("' + ', '.join(['Number of ' + tag.name for tag in tags]) + '");') print('\tprintf("' + ', '.join(['%lu'] * len(tags)) + '", ', end='') print(', '.join('partial_count[idx_%s]' % tag.name for tag in tags), end='') print(');') print('}') print('\n') print('void print_results_csv_accum(void) {')
import parse_tag tags = parse_tag.parse() visited_files = [] for tag in tags: if tag.file not in visited_files: print('\n/* %s */\n' % tag.file) visited_files.append(tag.file) print('%s (*lib_%s) %s;' % (tag.return_type, tag.name, tag.signature)) print('\n\n// -------------------- END OF PART 1\n\n') visited_files.clear() for tag in tags: if tag.file not in visited_files: print('\n/* %s */\n' % tag.file) visited_files.append(tag.file) print('%s %s %s;' % (tag.return_type, tag.name, tag.signature)) print('\n\n///GENERATED %d FUNCTIONS' % len(tags))