diff options
author | 2020-02-10 17:28:06 +0000 | |
---|---|---|
committer | 2020-07-22 14:37:34 +0000 | |
commit | 52d5354a399b4581222d0f02f2677927b48985f7 (patch) | |
tree | c6e9beb18d514c0d586fe8b578a15ddfd9ce532e /compiler/optimizing/optimizing_compiler.cc | |
parent | 40b0614be3296e163654c4e293793d00bcf36a5a (diff) |
Dump instruction set features in .cfg
This commit adds a compilation block at the beginning of the .cfg
dumped by the optimizing compiler when --dump-cfg is enabled.
The compilation block appears in the following form:
begin_compilation
name "isa_features:feature1,-feature2"
method "isa_features:feature1,-feature2"
date 1580721972
end_compilation
This compilation block dump is passed to checker script (see
https://android-review.googlesource.com/c/platform/art/+/1290997)
for checking if a certain instruction set feature was used at compile
time.
Author: Fabio Rinaldi
Committer: Artem Serov
Bug: 147876827
Test: ./art/tools/checker/run_unit_tests.py
Test: test.py --target --optimizing
Change-Id: If4309af4bab892f715aad1d3bd338f8ee11e497c
Diffstat (limited to 'compiler/optimizing/optimizing_compiler.cc')
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index bae402e596..de86c44246 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -400,6 +400,9 @@ class OptimizingCompiler final : public Compiler { std::vector<uint8_t> GenerateJitDebugInfo(const debug::MethodDebugInfo& method_debug_info); + // This must be called before any other function that dumps data to the cfg + void DumpInstructionSetFeaturesToCfg() const; + std::unique_ptr<OptimizingCompilerStats> compilation_stats_; std::unique_ptr<std::ostream> visualizer_output_; @@ -421,6 +424,7 @@ OptimizingCompiler::OptimizingCompiler(const CompilerOptions& compiler_options, std::ios_base::openmode cfg_file_mode = compiler_options.GetDumpCfgAppend() ? std::ofstream::app : std::ofstream::out; visualizer_output_.reset(new std::ofstream(cfg_file_name, cfg_file_mode)); + DumpInstructionSetFeaturesToCfg(); } if (compiler_options.GetDumpStats()) { compilation_stats_.reset(new OptimizingCompilerStats()); @@ -433,6 +437,16 @@ OptimizingCompiler::~OptimizingCompiler() { } } +void OptimizingCompiler::DumpInstructionSetFeaturesToCfg() const { + const CompilerOptions& compiler_options = GetCompilerOptions(); + const InstructionSetFeatures* features = compiler_options.GetInstructionSetFeatures(); + std::string features_string = "isa_features:" + features->GetFeatureString(); + // It is assumed that visualizer_output_ is empty when calling this function, hence the fake + // compilation block containing the ISA features will be printed at the beginning of the .cfg + // file. + *visualizer_output_ << HGraphVisualizer::InsertMetaDataAsCompilationBlock(features_string); +} + bool OptimizingCompiler::CanCompileMethod(uint32_t method_idx ATTRIBUTE_UNUSED, const DexFile& dex_file ATTRIBUTE_UNUSED) const { return true; |