[PATCH] D52041: [llvm-exegesis] Allow benchmarking arbitrary code snippets.

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 24 07:21:33 PDT 2018


gchatelet added inline comments.


================
Comment at: tools/llvm-exegesis/llvm-exegesis.cpp:254
+    return llvm::make_error<BenchmarkFailure>("cannot create asm parser");
+  AsmParser->setAssemblerDialect(0); // FIXME: allow changing the dialect.
+  AsmParser->getLexer().setCommentConsumer(&Streamer);
----------------
gchatelet wrote:
> Add a comment explaining what 0 is in this context.
Not done.


================
Comment at: tools/llvm-exegesis/llvm-exegesis.cpp:192
+      llvm::SmallVector<llvm::StringRef, 2> Parts;
+      CommentText.split(Parts, ' ', -1, false);
+      if (Parts.size() != 2 || !(RegVal.Register = findRegisterByName(Parts[0].trim()))) {
----------------
Add comments (or variables) to explain the arguments


================
Comment at: tools/llvm-exegesis/llvm-exegesis.cpp:194
+      if (Parts.size() != 2 || !(RegVal.Register = findRegisterByName(Parts[0].trim()))) {
+          llvm::errs() << "Ignoring invalid comment 'LLVM-EXEGESIS-DEFREG "  << CommentText << "\n";
+          return;
----------------
Maybe we want to crash here?


================
Comment at: tools/llvm-exegesis/llvm-exegesis.cpp:198
+      const llvm::StringRef Value = Parts[1].trim();
+      RegVal.Value = llvm::APInt(Value.size() * 4, Value, 16);
+      Result->RegisterInitialValues.push_back(std::move(RegVal));
----------------
explain `Value.size() * 4`


Repository:
  rL LLVM

https://reviews.llvm.org/D52041





More information about the llvm-commits mailing list