X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FWritingAnLLVMPass.html;h=1f53f050bae6af4de36213b356c4aa9c8761fcec;hb=715c90ba524e736190a6380695ab337eeb5148be;hp=7d81c81c0afd826ba08c3564e1aa77480e0d713b;hpb=ed2e7a9ce43f5db51224530197f17f90ef218525;p=oota-llvm.git diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index 7d81c81c0af..1f53f050bae 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -1,139 +1,161 @@ - -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. What PassManager does +
  31. The releaseMemory method
  32. +
  33. Using GDB with dynamically loaded passes +
  34. Setting a breakpoint in your pass
  35. +
  36. Miscellaneous Problems
  37. +
  38. Future extensions planned - -

    Written by Chris Lattner

    -

- +

  • Multithreaded LLVM
  • +
  • A new ModuleSource interface
  • +
  • Passes 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(Module &) method


    The runOnFunction method


    The doFinalization(Module &) method

    -
       - -The BasicBlockPass class -


    The -doInitialization(Function &) method


    The runOnBasicBlock method


    The doFinalization(Function -&) 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

    -
    -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 Sep 16 17:37:27 CDT 2002 - -
    +
    +
    + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
    + The LLVM Compiler Infrastructure
    + Last modified: $Date$ +
    + + +