From 78f684550a617bf25574dc1811b4c2570471830a Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Mon, 11 Mar 2024 10:54:38 -0700 Subject: [PATCH] Add none annotator type (#67) This patch adds a none annotator type to convert_bhive_to_llvm_exegesis_input that doesn't run any annotator. This is useful for looking at the output assembly for debugging purposes. --- gematria/datasets/convert_bhive_to_llvm_exegesis_input.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gematria/datasets/convert_bhive_to_llvm_exegesis_input.cc b/gematria/datasets/convert_bhive_to_llvm_exegesis_input.cc index 630bdb7b34f53e..8879df6fc5d7b6 100644 --- a/gematria/datasets/convert_bhive_to_llvm_exegesis_input.cc +++ b/gematria/datasets/convert_bhive_to_llvm_exegesis_input.cc @@ -49,10 +49,12 @@ constexpr std::string_view kMemDefPrefix = "# LLVM-EXEGESIS-MEM-DEF "; constexpr std::string_view kMemMapPrefix = "# LLVM-EXEGESIS-MEM-MAP "; constexpr std::string_view kMemNamePrefix = "MEM"; -enum class AnnotatorType { kExegesis, kFast }; +enum class AnnotatorType { kExegesis, kFast, kNone }; constexpr std::pair kAnnotatorTypeNames[] = { - {AnnotatorType::kExegesis, "exegesis"}, {AnnotatorType::kFast, "fast"}}; + {AnnotatorType::kExegesis, "exegesis"}, + {AnnotatorType::kFast, "fast"}, + {AnnotatorType::kNone, "none"}}; bool AbslParseFlag(absl::string_view text, AnnotatorType* type, std::string* error) { @@ -104,6 +106,8 @@ absl::StatusOr GetAccessedAddrs( return gematria::LlvmExpectedToStatusOr( exegesis_annotator->findAccessedAddrs( llvm::ArrayRef(basic_block.begin(), basic_block.end()))); + case AnnotatorType::kNone: + return gematria::AccessedAddrs(); } return absl::InvalidArgumentError("unknown annotator type"); }