[PATCH] D98591: [CodeGen] Add extension points for TargetPassConfig::addMachinePasses

Yuanfang Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 16:00:23 PDT 2021


ychen added a comment.

Could you add an example like `llvm/examples/Bye` and a test using `llc -load`?



================
Comment at: llvm/include/llvm/CodeGen/TargetPassConfig.h:370
+  /// use this is via the RegisterTargetExtension class defined below.
+  static ExtensionID addExtension(const Target *Target,
+                                  MachinePassExtensionPointTy MPEP,
----------------
Why is `Target` needed? A plugin could query TargetPassConfig about which target it wants to register itself.



================
Comment at: llvm/unittests/CodeGen/TargetExtensionTest.cpp:53
+
+  for (const Target &T : TargetRegistry::targets()) {
+    std::unique_ptr<Module> Mod(makeModule(Context, T));
----------------
I think testing the default target should be enough. Why we test all targets here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98591/new/

https://reviews.llvm.org/D98591



More information about the llvm-commits mailing list