]> granicus.if.org Git - clang/commit
Add an option to save the backend-produced YAML optimization record to a file
authorHal Finkel <hfinkel@anl.gov>
Tue, 11 Oct 2016 00:26:09 +0000 (00:26 +0000)
committerHal Finkel <hfinkel@anl.gov>
Tue, 11 Oct 2016 00:26:09 +0000 (00:26 +0000)
commit81b0670dcd6ef91dcb91d0a8dcab786b17e36555
tree4aac136774b2552a2362ca107c91a07d445aa7ca
parent651a37d1e020f5a070e001c191185adc81066d40
Add an option to save the backend-produced YAML optimization record to a file

The backend now has the capability to save information from optimizations, the
same information that can be used to generate optimization diagnostics but in
machine-consumable form, into an output file. This can be enabled when using
opt (see r282539), and this change enables it when using clang. The idea is
that other tools will be able to consume these files, and perhaps in
combination with the original source code, produce various kinds of
optimization reports for users (and for compiler developers).

We now have at-least two tools that can consume these files:
  * tools/llvm-opt-report
  * utils/opt-viewer

Using the flag -fsave-optimization-record will cause the YAML file to be
generated; the file name will be based on the output file name (if we're using
-c or -S and have an output name), or the input file name. When we're using
CUDA, or some other offloading mechanism, separate files are generated for each
backend target. The output file name can be specified by the user using
-foptimization-record-file=filename.

Differential Revision: https://reviews.llvm.org/D25225

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283834 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Driver/CC1Options.td
include/clang/Driver/Options.td
include/clang/Frontend/CodeGenOptions.h
lib/CodeGen/CodeGenAction.cpp
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp
test/CodeGen/Inputs/opt-record.proftext [new file with mode: 0644]
test/CodeGen/opt-record.c [new file with mode: 0644]
test/Driver/opt-record.c [new file with mode: 0644]