X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FWritingAnLLVMPass.html;h=dc70d036c8aeb98edb2fb2cc32673918b458a2e4;hb=fed0b2995ecaad811a3e66c8cbe8d3920dda8b29;hp=4e754cb1a361194c36eb3e39c426805b3ac11afb;hpb=fd214762cb32fd827ebc7a0d5cb29b7ba0ad9599;p=oota-llvm.git diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index 4e754cb1a36..dc70d036c8a 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -19,6 +19,7 @@
  • Pass classes and requirements
  • Pass Registration +
       + +The ImmutablePass class +
    @@ -408,7 +436,7 @@ In contrast to direct Pass subclasses, direct FunctionPass subclasses do have a predictable, local behavior that can be expected by the system. All FunctionPass execute on each function in the program -independant of all of the other functions in the program. +independent of all of the other functions in the program. FunctionPass's do not require that they are executed in a particular order, and FunctionPass's do not modify external functions.

    @@ -446,9 +474,9 @@ fast).

    A good example of how this method should be used is the LowerAllocations pass. This pass converts malloc and free instructions into -platform dependant malloc() and free() function calls. It +platform dependent malloc() and free() function calls. It uses the doInitialization method to get a reference to the malloc and -free functions that it needs, adding prototypes to the module if neccesary.

    +free functions that it needs, adding prototypes to the module if necessary.


    The runOnFunction method

    +
       + +The MachineFunctionPass class +


    The +runOnMachineFunction(MachineFunction &MF) method

    @@ -672,14 +747,14 @@ href="http://llvm.cs.uiuc.edu/doxygen/classAnalysisUsage.html">AnalysisUsage// setPreservesAll - Call this if the pass does not modify its input at allvoid AnalysisUsage::setPreservesAll(); - // preservesCFG - This function should be called by the pass, iff they do not: + // setPreservesCFG - This function should be called by the pass, iff they do not: // // 1. Add or remove basic blocks from the function // 2. Modify terminator instructions in any way. // // This is automatically implied for BasicBlockPass's // - void AnalysisUsage::preservesCFG(); + void AnalysisUsage::setPreservesCFG();

    Some examples of how to use these methods are:

    @@ -698,7 +773,7 @@ and:

       // This example modifies the program, but does not modify the CFG
       void LICM::getAnalysisUsage(AnalysisUsage &AU) const {
    -    AU.preservesCFG();
    +    AU.setPreservesCFG();
         AU.addRequired<LoopInfo>();
       }
     

    @@ -1084,9 +1159,8 @@ want:

     (gdb) break PassManager::run
     Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70.
    -(gdb) run test.bc -load /shared/lattner/cvs/llvm/lib/Debug/[libname].so -[passoption]
    -Starting program: /shared/lattner/cvs/llvm/tools/Debug/opt test.bc 
    -    -load /shared/lattner/cvs/llvm/lib/Debug/[libname].so -[passoption]
    +(gdb) run test.bc -load $(LLVMTOP)/llvm/lib/Debug/[libname].so -[passoption]
    +Starting program: opt test.bc -load $(LLVMTOP)/llvm/lib/Debug/[libname].so -[passoption]
     Breakpoint 1, PassManager::run (this=0xffbef174, M=@0x70b298) at Pass.cpp:70
     70      bool PassManager::run(Module &M) { return PM->run(M); }
     (gdb)
    @@ -1139,12 +1213,12 @@ where we are going:


    Multithreaded LLVM