Merge "Add suffix parameter to DumpCFG"
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc
index 79edb87..b1c0b28 100644
--- a/compiler/dex/mir_graph.cc
+++ b/compiler/dex/mir_graph.cc
@@ -707,12 +707,13 @@
// TODO: use a configurable base prefix, and adjust callers to supply pass name.
/* Dump the CFG into a DOT graph */
-void MIRGraph::DumpCFG(const char* dir_prefix, bool all_blocks) {
+void MIRGraph::DumpCFG(const char* dir_prefix, bool all_blocks, const char *suffix) {
FILE* file;
std::string fname(PrettyMethod(cu_->method_idx, *cu_->dex_file));
ReplaceSpecialChars(fname);
- fname = StringPrintf("%s%s%x.dot", dir_prefix, fname.c_str(),
- GetBasicBlock(GetEntryBlock()->fall_through)->start_offset);
+ fname = StringPrintf("%s%s%x%s.dot", dir_prefix, fname.c_str(),
+ GetBasicBlock(GetEntryBlock()->fall_through)->start_offset,
+ suffix == nullptr ? "" : suffix);
file = fopen(fname.c_str(), "w");
if (file == NULL) {
return;
diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h
index a80c32d..010de20 100644
--- a/compiler/dex/mir_graph.h
+++ b/compiler/dex/mir_graph.h
@@ -452,7 +452,13 @@
return m_units_[current_method_];
}
- void DumpCFG(const char* dir_prefix, bool all_blocks);
+ /**
+ * @brief Dump a CFG into a dot file format.
+ * @param dir_prefix the directory the file will be created in.
+ * @param all_blocks does the dumper use all the basic blocks or use the reachable blocks.
+ * @param suffix does the filename require a suffix or not (default = nullptr).
+ */
+ void DumpCFG(const char* dir_prefix, bool all_blocks, const char* suffix = nullptr);
void InitRegLocations();