From: Bill Wendling Date: Sun, 8 Apr 2012 11:52:52 +0000 (+0000) Subject: Formatting changes. Don't put spaces in front of some code, which only makes it look... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=084cd7fa68377ee6795d3695c9e97b7a45ccda68;p=oota-llvm.git Formatting changes. Don't put spaces in front of some code, which only makes it look 'off'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154282 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index 66b98b681ab..c7cad4bed6d 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -417,17 +417,17 @@ USAGE: opt [options] <input bitcode> OPTIONS: Optimizations available: ... - -funcresolve - Resolve Functions - -gcse - Global Common Subexpression Elimination - -globaldce - Dead Global Elimination - -hello - Hello World Pass - -indvars - Canonicalize Induction Variables - -inline - Function Integration/Inlining - -instcombine - Combine redundant instructions + -globalopt - Global Variable Optimizer + -globalsmodref-aa - Simple mod/ref analysis for globals + -gvn - Global Value Numbering + -hello - Hello World Pass + -indvars - Induction Variable Simplification + -inline - Function Integration/Inlining + -insert-edge-profiling - Insert instrumentation for edge profiling ... -

The pass name get added as the information string for your pass, giving some +

The pass name gets added as the information string for your pass, giving some documentation to users of opt. Now that you have a working pass, you would go ahead and make it do the cool transformations you want. Once you get it all working and tested, it may become useful to find out how fast your pass @@ -545,7 +545,7 @@ following signature:

-  virtual bool runOnModule(Module &M) = 0;
+virtual bool runOnModule(Module &M) = 0;
 

The runOnModule method performs the interesting work of the pass. @@ -612,7 +612,7 @@ false if they didn't.

-  virtual bool doInitialization(CallGraph &CG);
+virtual bool doInitialization(CallGraph &CG);
 

The doIninitialize method is allowed to do most of the things that @@ -633,7 +633,7 @@ fast).

-  virtual bool runOnSCC(CallGraphSCC &SCC) = 0;
+virtual bool runOnSCC(CallGraphSCC &SCC) = 0;
 

The runOnSCC method performs the interesting work of the pass, and @@ -652,7 +652,7 @@ otherwise.

-  virtual bool doFinalization(CallGraph &CG);
+virtual bool doFinalization(CallGraph &CG);
 

The doFinalization method is an infrequently used method that is @@ -704,7 +704,7 @@ should return true if they modified the program, or false if they didn't.

-  virtual bool doInitialization(Module &M);
+virtual bool doInitialization(Module &M);
 

The doIninitialize method is allowed to do most of the things that @@ -732,7 +732,7 @@ free functions that it needs, adding prototypes to the module if necessary.

-  virtual bool runOnFunction(Function &F) = 0;
+virtual bool runOnFunction(Function &F) = 0;
 

The runOnFunction method must be implemented by your subclass to do @@ -751,7 +751,7 @@ be returned if the function is modified.

-  virtual bool doFinalization(Module &M);
+virtual bool doFinalization(Module &M);
 

The doFinalization method is an infrequently used method that is @@ -790,7 +790,7 @@ program, or false if they didn't.

-  virtual bool doInitialization(Loop *, LPPassManager &LPM);
+virtual bool doInitialization(Loop *, LPPassManager &LPM);
 

The doInitialization method is designed to do simple initialization @@ -811,7 +811,7 @@ information.

-  virtual bool runOnLoop(Loop *, LPPassManager &LPM) = 0;
+virtual bool runOnLoop(Loop *, LPPassManager &LPM) = 0;
 

The runOnLoop method must be implemented by your subclass to do @@ -829,7 +829,7 @@ should be used to update loop nest.

-  virtual bool doFinalization();
+virtual bool doFinalization();
 

The doFinalization method is an infrequently used method that is @@ -869,7 +869,7 @@ methods should return true if they modified the program, or false if they didn n

-  virtual bool doInitialization(Region *, RGPassManager &RGM);
+virtual bool doInitialization(Region *, RGPassManager &RGM);
 

The doInitialization method is designed to do simple initialization @@ -890,7 +890,7 @@ information.

-  virtual bool runOnRegion(Region *, RGPassManager &RGM) = 0;
+virtual bool runOnRegion(Region *, RGPassManager &RGM) = 0;
 

The runOnRegion method must be implemented by your subclass to do @@ -908,7 +908,7 @@ should be used to update region tree.

-  virtual bool doFinalization();
+virtual bool doFinalization();
 

The doFinalization method is an infrequently used method that is @@ -957,7 +957,7 @@ href="#FunctionPass">FunctionPass's have, but also have the followi

-  virtual bool doInitialization(Function &F);
+virtual bool doInitialization(Function &F);
 

The doIninitialize method is allowed to do most of the things that @@ -978,7 +978,7 @@ fast).

-  virtual bool runOnBasicBlock(BasicBlock &BB) = 0;
+virtual bool runOnBasicBlock(BasicBlock &BB) = 0;
 

Override this function to do the work of the BasicBlockPass. This @@ -998,7 +998,7 @@ if the basic block is modified.

-  virtual bool doFinalization(Function &F);
+virtual bool doFinalization(Function &F);
 

The doFinalization method is an infrequently used method that is @@ -1051,7 +1051,7 @@ data)

-  virtual bool runOnMachineFunction(MachineFunction &MF) = 0;
+virtual bool runOnMachineFunction(MachineFunction &MF) = 0;
 

runOnMachineFunction can be considered the main entry point of a @@ -1104,7 +1104,7 @@ implement the virtual print method:

-  virtual void print(std::ostream &O, const Module *M) const;
+virtual void print(std::ostream &O, const Module *M) const;
 

The print method must be implemented by "analyses" in order to print @@ -1154,7 +1154,7 @@ having any prerequisite passes, and invalidating all other passes.

-  virtual void getAnalysisUsage(AnalysisUsage &Info) const;
+virtual void getAnalysisUsage(AnalysisUsage &Info) const;
 

By implementing the getAnalysisUsage method, the required and @@ -1242,11 +1242,11 @@ the fact that it hacks on the CFG.

-  // This example modifies the program, but does not modify the CFG
-  void LICM::getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.setPreservesCFG();
-    AU.addRequired<LoopInfo>();
-  }
+// This example modifies the program, but does not modify the CFG
+void LICM::getAnalysisUsage(AnalysisUsage &AU) const {
+  AU.setPreservesCFG();
+  AU.addRequired<LoopInfo>();
+}
 
@@ -1268,10 +1268,10 @@ method. It takes a single template argument that specifies which pass class you want, and returns a reference to that pass. For example:

-   bool LICM::runOnFunction(Function &F) {
-     LoopInfo &LI = getAnalysis<LoopInfo>();
-     ...
-   }
+bool LICM::runOnFunction(Function &F) {
+  LoopInfo &LI = getAnalysis<LoopInfo>();
+  ...
+}
 

This method call returns a reference to the pass desired. You may get a @@ -1285,11 +1285,11 @@ A module level pass can use function level analysis info using this interface. For example:

-   bool ModuleLevelPass::runOnModule(Module &M) {
-     ...
-     DominatorTree &DT = getAnalysis<DominatorTree>(Func);
-     ...
-   }
+bool ModuleLevelPass::runOnModule(Module &M) {
+  ...
+  DominatorTree &DT = getAnalysis<DominatorTree>(Func);
+  ...
+}
 

In above example, runOnFunction for DominatorTree is called by pass manager @@ -1302,11 +1302,11 @@ If your pass is capable of updating analyses if they exist (e.g., if it is active. For example:

-  ...
-  if (DominatorSet *DS = getAnalysisIfAvailable<DominatorSet>()) {
-    // A DominatorSet is active.  This code will update it.
-  }
-  ...
+...
+if (DominatorSet *DS = getAnalysisIfAvailable<DominatorSet>()) {
+  // A DominatorSet is active.  This code will update it.
+}
+...
 
@@ -1405,7 +1405,7 @@ Unlike registration of passes, there is no command line argument to be specified for the Analysis Group Interface itself, because it is "abstract":

-  static RegisterAnalysisGroup<AliasAnalysis> A("Alias Analysis");
+static RegisterAnalysisGroup<AliasAnalysis> A("Alias Analysis");
 

Once the analysis is registered, passes can declare that they are valid @@ -1416,10 +1416,9 @@ implementations of the interface by using the following code:

// Declare that we implement the AliasAnalysis interface 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? - ); + false, // Is CFG Only? + true, // Is Analysis? + false); // Is default Analysis Group implementation? }
@@ -1436,8 +1435,7 @@ this macro.

"Basic Alias Analysis (default AA impl)", false, // Is CFG Only? true, // Is Analysis? - true, // Is default Analysis Group implementation? - ); + true); // Is default Analysis Group implementation? }
@@ -1606,10 +1604,10 @@ we need to add the following getAnalysisUsage method to our pass:

-    // We don't modify the program, so we preserve all analyses
-    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-      AU.setPreservesAll();
-    }
+// We don't modify the program, so we preserve all analyses
+virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+  AU.setPreservesAll();
+}
 

Now when we run our pass, we get this output:

@@ -1717,19 +1715,19 @@ machine passes. Here we will describe how to register a register allocator machine pass.

Implement your register allocator machine pass. In your register allocator -.cpp file add the following include;

+.cpp file add the following include;

-  #include "llvm/CodeGen/RegAllocRegistry.h"
+#include "llvm/CodeGen/RegAllocRegistry.h"
 

Also in your register allocator .cpp file, define a creator function in the form;

-  FunctionPass *createMyRegisterAllocator() {
-    return new MyRegisterAllocator();
-  }
+FunctionPass *createMyRegisterAllocator() {
+  return new MyRegisterAllocator();
+}
 

Note that the signature of this function should match the type of @@ -1737,9 +1735,9 @@ form;

"installing" declaration, in the form;

-  static RegisterRegAlloc myRegAlloc("myregalloc",
-    "  my register allocator help string",
-    createMyRegisterAllocator);
+static RegisterRegAlloc myRegAlloc("myregalloc",
+                                   "my register allocator help string",
+                                   createMyRegisterAllocator);
 

Note the two spaces prior to the help string produces a tidy result on the @@ -1790,11 +1788,11 @@ MachinePassRegistry RegisterMyPasses::Registry;

And finally, declare the command line option for your passes. Example:

-  cl::opt<RegisterMyPasses::FunctionPassCtor, false,
-          RegisterPassParser<RegisterMyPasses> >
-  MyPassOpt("mypass",
-            cl::init(&createDefaultMyPass),
-            cl::desc("my pass option help")); 
+cl::opt<RegisterMyPasses::FunctionPassCtor, false,
+        RegisterPassParser<RegisterMyPasses> >
+MyPassOpt("mypass",
+          cl::init(&createDefaultMyPass),
+          cl::desc("my pass option help")); 
 

Here the command option is "mypass", with createDefaultMyPass as the default