summaryrefslogtreecommitdiff
path: root/gcc/compare-elim.c
diff options
context:
space:
mode:
authorGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-12 16:30:07 -0300
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-20 16:36:42 -0300
commitaf74ab0ea4ec53adcc27c334acce8a75782307e7 (patch)
tree929a32597d2db4261d26c823d23cdaff90edb498 /gcc/compare-elim.c
parentfcbca3c166d91dac355ff6e917a9c39c7c62bb56 (diff)
downloadgcc-af74ab0ea4ec53adcc27c334acce8a75782307e7.tar.gz
Modify gcc driver for parallel compilation
Update the driver for parallel compilation. This process work as follows: When calling gcc, the driver will check if the flag "-fparallel-jobs" was provided by the user. If yes, then we will check what is the desired output, and if it can be parallelized. There are the following cases, which is described: 1. -S or -E was provided: We can't run in parallel, as the output can not be easily merged together into one file. 2. -c was provided: When cc1* forks into multiple processes, it must tell the driver where it stored its generated assembler files. Therefore we pass a hidden "-fsplit-outputs=filename" to the compiler, and we check if "filename" was created by it. If yes, we open it, call assembler for each generated asm file (this file must not be empty), and link them together with partial linking to a single .o file. This process is done for each object file in the argument list. 3. -c was not provided, and the final product will be an binary: Here we proceed exactly as 2., but we avoid doing the partial linking, feeding the generated object files directly into the final link. For that to work, we had to heavily modify how the "execute" function works, extracting common code which is used multiple times, and also detecting when the command is a call to a compiler or an assembler, as can be seen in append_split_outputs. Finally, we added some tests which reflects all cases found when bootstrapping the compiler, so development of further features to the driver get faster for now on. gcc/ChangeLog 2020-08-20 Giuliano Belinassi <giuliano.belinassi@usp.br> * common.opt (fsplit-outputs): New flag. (fparallel-jobs): New flag. * gcc.c (extra_arg_storer): New class. (have_S): New variable. (struct command): Move from execute. (is_compiler): New function. (is_assembler): New function. (get_number_of_args): New function. (get_file_by_lines): New function. (identify_asm_file): New function. (struct infile): New attribute temp_additional_asm. (current_infile): New variable. (get_path_to_ld): New function. (has_hidden_E): New function. (sort_asm_files): New function. (append_split_outputs): New function. (print_command): New function. (print_commands): New function. (print_argbuf): New function. (handle_verbose): Extracted from execute. (append_valgrind): Same as above. (async_launch_commands): Same as above. (await_commands_to_finish): Same as above. (split_commands): Same as above. (parse_argbuf): Same as above. (execute): Refator. (fsplit_arg): New function. (alloc_infile): Initialize infiles with 0. (process_command): Remember when -S was passed. (do_spec_on_infiles): Remember current infile being processed. (maybe_run_linker): Replace object files when -o is a executable. (finalize): Deinitialize temp_object_files. gcc/testsuite/ChangeLog: 20-08-2020 Giuliano Belinassi <giuliano.belinassi@usp.br> * driver/driver.exp: New test. * driver/a.c: New file. * driver/b.c: New file. * driver/empty.c: New file. * driver/foo.c: New file.
Diffstat (limited to 'gcc/compare-elim.c')
0 files changed, 0 insertions, 0 deletions