X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FWritingAnLLVMPass.html;h=7b90db352bc10ef40e07ec181863d36d845ebebb;hb=079e945387edae3e38aa9259b4b537b5b09ce600;hp=f7cae6dd83e4d318f69d2215d200d465a29b3156;hpb=7ce83e576a99f5be6b06209ce463abbc1e25a3c7;p=oota-llvm.git diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index f7cae6dd83e..7b90db352bc 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -1,154 +1,169 @@ - -Writing an LLVM Pass - - - - - - - -
  Writing an LLVM Pass
- + + + + Writing an LLVM Pass + + + + +
+ Writing an LLVM Pass +
    -
  1. Introduction - What is a pass? +
  2. Introduction - What is a pass?
  3. Quick Start - Writing hello world + or analyze
  4. +
  5. Pass classes and requirements
  6. +
  7. The CallGraphSCCPass class +
  8. The FunctionPass class +
  9. The doInitialization(Module + &) method
  10. +
  11. The runOnFunction method
  12. +
  13. The doFinalization(Module + &) method
  14. +
  15. The BasicBlockPass class +
  16. The doInitialization(Function + &) method
  17. +
  18. The runOnBasicBlock + method
  19. +
  20. The doFinalization(Function + &) method
  21. + +
  22. The MachineFunctionPass + class +
  23. Pass Registration +
  24. The print method
  25. +
  26. Specifying interactions between passes +
  27. The getAnalysisUsage + method
  28. +
  29. The AnalysisUsage::addRequired<> and AnalysisUsage::addRequiredTransitive<> methods
  30. +
  31. The AnalysisUsage::addPreserved<> method
  32. +
  33. Example implementations of getAnalysisUsage
  34. +
  35. The getAnalysis<> and getAnalysisToUpdate<> methods
  36. + +
  37. Implementing Analysis Groups +
  38. +
  39. Pass Statistics
  40. What PassManager does +
  41. The releaseMemory method
  42. + +
  43. Using GDB with dynamically loaded passes +
  44. Future extensions planned - -

    Written by Chris Lattner

    -

- +

  • Multithreaded LLVM
  • +
  • ModulePasses requiring + FunctionPasses
  • + + +
    +

    Written by Chris Lattner

    +
    - -
    -Introduction - What is a pass? -
    -
    -Quick Start - Writing hello world -
    -
       - -Setting up the build environment -


    -
       - -Basic code required -
    -
       - -Running a pass with opt or analyze -
    -
    -Pass classes and requirements -
    -
       - -The Pass class -


    The run method

    -
       - -The FunctionPass class -


    The doInitialization -method


    The runOnFunction method


    The doFinalization method

    -
       - -The BasicBlockPass class -


    The runOnBasicBlock method

    -
    -Pass registration -
    + +

    Regardless of how you register your pass, you must specify at least two parameters. The first parameter is the name of the pass that is to be used on the command line to specify that the pass should be added to a program (for example opt or analyze). The second argument is the name of the pass, which is to be used for the --help output of programs, as -well as for debug output generated by the --debug-pass option.

    +well as for debug output generated by the --debug-pass option.

    -If you pass is constructed by its default constructor, you only ever have to -pass these two arguments. If, on the other hand, you require other information -(like target specific information), you must pass an additional argument. This -argument is a pointer to a function used to create the pass. For an example of -how this works, look at the LowerAllocations.cpp -file.

    +

    If a pass is registered to be used by the analyze utility, you +should implement the virtual print method:

    -If a pass is registered to be used by the analyze utility, you should -implement the virtual print method:

    + -


    The print method

    -
    -Specifying interactions between passes -


    The getAnalysisUsage method


    The getAnalysis<> method

    -
    -What PassManager does -


    The releaseMemory method

    -
    -Future extensions planned -


    Multithreaded LLVM


    A new ModuleSource interface


    Pass's requiring FunctionPass's

    - - -
    -
    Christopher Lattner
    - - -Last modified: Wed Aug 14 15:06:49 CDT 2002 - -
    +
    +
    + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
    + The LLVM Compiler Infrastructure
    + Last modified: $Date$ +
    + + +