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
diff --git a/compiler/optimizing/graph_visualizer.h b/compiler/optimizing/graph_visualizer.h
index 66588f6..e01d03c 100644
--- a/compiler/optimizing/graph_visualizer.h
+++ b/compiler/optimizing/graph_visualizer.h
@@ -107,6 +107,11 @@
void DumpGraph(const char* pass_name, bool is_after_pass, bool graph_in_bad_state) const;
void DumpGraphWithDisassembly() const;
+ // C1visualizer file format does not support inserting arbitrary metadata into a cfg
+ // file. As a workaround a fake compilation block with the metadata in the name and the
+ // method attributes is used. Such empty blocks don't break the c1visualizer parser.
+ static std::string InsertMetaDataAsCompilationBlock(const std::string& meta_data);
+
private:
std::ostream* const output_;
HGraph* const graph_;