From d8cc7be0262092882d848a1c7d8a4cb6752cce6f Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 21 Jul 2010 23:07:00 +0000 Subject: Add INSTANTIATE_AG_PASS, which combines RegisterPass<> with RegisterAnalysisGroup<> for pass registration. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109058 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/WritingAnLLVMPass.html | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'docs') diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index f6360a19c3..3cef2c9344 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -1247,7 +1247,7 @@ between passes still apply.

Although Pass Registration is optional for normal passes, all analysis group implementations must be registered, and must use the -RegisterAnalysisGroup template to join the +INITIALIZE_AG_PASS template to join the implementation pool. Also, a default implementation of the interface must be registered with RegisterAnalysisGroup.

@@ -1283,8 +1283,10 @@ hypothetical example) instead.

The RegisterAnalysisGroup template is used to register the analysis -group itself as well as add pass implementations to the analysis group. First, -an analysis should be registered, with a human readable name provided for it. +group itself, while the INITIALIZE_AG_PASS is used to add pass +implementations to the analysis group. First, +an analysis group should be registered, with a human readable name +provided for it. Unlike registration of passes, there is no command line argument to be specified for the Analysis Group Interface itself, because it is "abstract":

@@ -1297,35 +1299,36 @@ implementations of the interface by using the following code:

 namespace {
-  // Analysis Group implementations must be registered normally...
-  RegisterPass<FancyAA>
-  B("somefancyaa", "A more complex alias analysis implementation");
-
   // Declare that we implement the AliasAnalysis interface
-  RegisterAnalysisGroup<AliasAnalysis> C(B);
+  INITIALIZE_AG_PASS(FancyAA, AliasAnalysis, "somefancyaa",
+                     "A more complex alias analysis implementation",
+                     false, // Is CFG Only?
+                     true,  // Is Analysis?
+                     false, // Is default Analysis Group implementation?
+                    );
 }
 
-

This just shows a class FancyAA that is registered normally, then -uses the RegisterAnalysisGroup template to "join" the AliasAnalysis +

This just shows a class FancyAA that +uses the INITIALIZE_AG_PASS macro both to register and +to "join" the AliasAnalysis analysis group. Every implementation of an analysis group should join using -this template. A single pass may join multiple different analysis groups with -no problem.

+this macro.

 namespace {
-  // Analysis Group implementations must be registered normally...
-  RegisterPass<BasicAliasAnalysis>
-  D("basicaa", "Basic Alias Analysis (default AA impl)");
-
   // Declare that we implement the AliasAnalysis interface
-  RegisterAnalysisGroup<AliasAnalysis, true> E(D);
+  INITIALIZE_AG_PASS(BasicAA, AliasAnalysis, "basicaa",
+                     "Basic Alias Analysis (default AA impl)",
+                     false, // Is CFG Only?
+                     true,  // Is Analysis?
+                     true, // Is default Analysis Group implementation?
+                    );
 }
 
-

Here we show how the default implementation is specified (using the extra -argument to the RegisterAnalysisGroup template). There must be exactly +

Here we show how the default implementation is specified (using the final +argument to the INITIALIZE_AG_PASS template). There must be exactly one default implementation available at all times for an Analysis Group to be used. Only default implementation can derive from ImmutablePass. Here we declare that the -- cgit v1.2.3