X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FWritingAnLLVMPass.html;h=7b90db352bc10ef40e07ec181863d36d845ebebb;hb=079e945387edae3e38aa9259b4b537b5b09ce600;hp=414ed1226c7623bee4786b7b804473c916c76130;hpb=cab8b6f448aadbe66fe44bc570d07a8eaf96ab40;p=oota-llvm.git diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index 414ed1226c7..7b90db352bc 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -1,142 +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. The FunctionPass class + &) method
  7. +
  8. The BasicBlockPass class + &) method
  9. +
  10. The MachineFunctionPass class +
  11. Pass Registration +
  12. The print method
  13. +
  14. Specifying interactions between passes +
  15. The getAnalysisUsage + method
  16. +
  17. The AnalysisUsage::addRequired<> and AnalysisUsage::addRequiredTransitive<> methods
  18. +
  19. The AnalysisUsage::addPreserved<> method
  20. +
  21. Example implementations of getAnalysisUsage
  22. +
  23. The getAnalysis<> and getAnalysisToUpdate<> methods
  24. +
  25. Implementing Analysis Groups +
  26. Analysis Group Concepts
  27. +
  28. Using RegisterAnalysisGroup
  29. + +
  30. Pass Statistics
  31. What PassManager does +
  32. The releaseMemory method
  33. +
  34. Using GDB with dynamically loaded passes +
  35. Setting a breakpoint in your pass
  36. +
  37. Miscellaneous Problems
  38. +
  39. 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 ImmutablePass class -
    -
       - -The Pass class -


    The run method

    -
       - -The FunctionPass class -


    The -doInitialization(Module &) method


    The runOnFunction method


    The doFinalization(Module &) method

    -
       - -The BasicBlockPass class -


    The -doInitialization(Function &) method


    The runOnBasicBlock method


    The doFinalization(Function -&) method

    -
       - -The MachineFunctionPass class -
    -
    -Pass registration -
    -Regardless of how you register your pass, you must specify at least two +

    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

    -
    -Implementing Analysis Groups -


    Analysis Group Concepts


    Using RegisterAnalysisGroup

    -
    -What PassManager does -


    The releaseMemory method

    -
    -Using GDB with dynamically loaded passes -


    Setting a breakpoint in your pass


    Miscellaneous Problems

    -
    -Future extensions planned -


    Multithreaded LLVM


    A new ModuleSource interface


    Pass's requiring FunctionPass's

    - - -
    -
    Chris Lattner
    - - -Last modified: Mon Jul 14 12:12:53 CDT 2003 - -
    +
    +
    + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
    + The LLVM Compiler Infrastructure
    + Last modified: $Date$ +
    + + +