From 261efe953b14da0446ba5bcafa7f01f247106e9f Mon Sep 17 00:00:00 2001
From: Chris Lattner Written by Chris Lattner,
- Dinakar Dhurjati, and
- Joel Stanley
+ Written by Chris Lattner,Dinakar Dhurjati, and Joel Stanley
-
-This document should get you oriented so that you can find your way in the
-continuously growing source code that makes up the LLVM infrastructure. Note
-that this manual is not intended to serve as a replacement for reading the
-source code, so if you think there should be a method in one of these classes to
-do something, but it's not listed, check the source. Links to the doxygen sources are provided to make this as easy as
-possible.
-
-The first section of this document describes general information that is useful
-to know when working in the LLVM infrastructure, and the second describes the
-Core LLVM classes. In the future this manual will be extended with information
-describing how to use extension libraries, such as dominator information, CFG
-traversal routines, and useful utilities like the InstVisitor template.
-
-
-
-
-
-
-
-
-
-Here are some useful links:
-
-
-
-You are also encouraged to take a look at the LLVM Coding Standards guide which focuses on how
-to write maintainable code more than where to put your curly braces.
-
-
-
-
-
-
+This document is meant to highlight some of the important classes and
+interfaces available in the LLVM source-base. This manual is not
+intended to explain what LLVM is, how it works, and what LLVM code looks
+like. It assumes that you know the basics of LLVM and are interested
+in writing transformations or otherwise analyzing or manipulating the
+code.
+ This document should get you oriented so that you can find your
+way in the continuously growing source code that makes up the LLVM
+infrastructure. Note that this manual is not intended to serve as a
+replacement for reading the source code, so if you think there should be
+a method in one of these classes to do something, but it's not listed,
+check the source. Links to the doxygen sources
+are provided to make this as easy as possible. The first section of this document describes general information
+that is useful to know when working in the LLVM infrastructure, and the
+second describes the Core LLVM classes. In the future this manual will
+be extended with information describing how to use extension libraries,
+such as dominator information, CFG traversal routines, and useful
+utilities like the InstVisitor
+template. Here are some useful links: You are also encouraged to take a look at the LLVM Coding Standards guide which
+focuses on how to write maintainable code more than where to put your
+curly braces.
-
-
-
-
-
-
-
-
-
-
-
-Note that you should not use an isa<> test followed by a
-cast<>, for that use the dyn_cast<> operator.
-
-
-
-
-
-
-This form of the if statement effectively combines together a call to
-isa<> and a call to cast<> into one statement,
-which is very convenient.
-
-Another common example is:
-
-
-
-Note that the dyn_cast<> operator, like C++'s
-dynamic_cast or Java's instanceof operator, can be abused. In
-particular you should not use big chained if/then/else blocks to check
-for lots of different variants of classes. If you find yourself wanting to do
-this, it is much cleaner and more efficient to use the InstVisitor class to
-dispatch over the instruction type directly.
-
-
-
-
-
-
-
-
-
-
-
-
-
-Naturally, because of this, you don't want to delete the debug printouts, but
-you don't want them to always be noisy. A standard compromise is to comment
-them out, allowing you to enable them if you need them in the future.
-
-The "Support/Debug.h" file
-provides a macro named DEBUG() that is a much nicer solution to this
-problem. Basically, you can put arbitrary code into the argument of the
-DEBUG macro, and it is only executed if 'opt' (or any other
-tool) is run with the '-debug' command line argument:
-
-
-
-Then you can run your pass like this:
-
-
-
-Using the DEBUG() macro instead of a home-brewed solution allows you to
-now have to create "yet another" command line option for the debug output for
-your pass. Note that DEBUG() macros are disabled for optimized builds,
-so they do not cause a performance impact at all (for the same reason, they
-should also not contain side-effects!).
-
-One additional nice thing about the DEBUG() macro is that you can
-enable or disable it directly in gdb. Just use "set DebugFlag=0" or
-"set DebugFlag=1" from the gdb if the program is running. If the
-program hasn't been started yet, you can always just run it with
--debug.
-
-
- Note that you should not use an isa<>
+test followed by a cast<>, for that use the dyn_cast<>
+operator. This form of the if statement effectively combines
+together a call to isa<> and a call to cast<>
+into one statement, which is very convenient. Another common example is: Note that the dyn_cast<> operator, like C++'s dynamic_cast
+or Java's instanceof operator, can be abused. In particular
+you should not use big chained if/then/else blocks to check for
+lots of different variants of classes. If you find yourself wanting to
+do this, it is much cleaner and more efficient to use the InstVisitor
+class to dispatch over the instruction type directly. Naturally, because of this, you don't want to delete the debug
+printouts, but you don't want them to always be noisy. A standard
+compromise is to comment them out, allowing you to enable them if you
+need them in the future. The "Support/Debug.h"
+file provides a macro named DEBUG() that is a much nicer
+solution to this problem. Basically, you can put arbitrary code into
+the argument of the DEBUG macro, and it is only executed if 'opt'
+(or any other tool) is run with the '-debug' command line
+argument: Then you can run your pass like this: Using the DEBUG() macro instead of a home-brewed solution
+allows you to now have to create "yet another" command line option for
+the debug output for your pass. Note that DEBUG() macros are
+disabled for optimized builds, so they do not cause a performance impact
+at all (for the same reason, they should also not contain
+side-effects!). One additional nice thing about the DEBUG() macro is that
+you can enable or disable it directly in gdb. Just use "set
+DebugFlag=0" or "set DebugFlag=1" from the gdb if the
+program is running. If the program hasn't been started yet, you can
+always just run it with -debug.
-
-
-
-Then you can run your pass like this:
-
-
-
-Of course, in practice, you should only set DEBUG_TYPE at the top of a
-file, to specify the debug type for the entire module (if you do this before you
-#include "Support/Debug.h", you don't have to insert the ugly
-#undef's). Also, you should use names more meaningful that "foo" and
-"bar", because there is no system in place to ensure that names do not conflict:
-if two different modules use the same string, they will all be turned on when
-the name is specified. This allows all, say, instruction scheduling, debug
-information to be enabled with -debug-type=InstrSched, even if the
-source lives in multiple files.
-
-
-
-
-
-Often you may run your pass on some big program, and you're interested to see
-how many times it makes a certain transformation. Although you can do this with
-hand inspection, or some ad-hoc method, this is a real pain and not very useful
-for big programs. Using the Statistic template makes it very easy to
-keep track of this information, and the calculated information is presented in a
-uniform manner with the rest of the passes being executed.
-
-There are many examples of Statistic users, but this basics of using it
-are as follows:
-
-
-
-
-
-The Statistic template can emulate just about any data-type, but if you
-do not specify a template argument, it defaults to acting like an unsigned int
-counter (this is usually what you want).
-
-
-
-
-
-
-
-That's all you have to do. To get 'opt' to print out the statistics
-gathered, use the '-stats' option:
-
-
-
-When running gccas on a C file from the SPEC benchmark suite, it gives
-a report that looks like this:
-
-
-
-Obviously, with so many optimizations, having a unified framework for this stuff
-is very nice. Making your pass fit well into the framework makes it more
-maintainable and useful.
-
-
-
-
-
-
+
+
+ LLVM Programmer's Manual
-
+
+
+
+
+ LLVM Programmer's Manual
+
-
-
-
-
-
-
+-->
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-Introduction
-
-
-This document is meant to highlight some of the important classes and interfaces
-available in the LLVM source-base. This manual is not intended to explain what
-LLVM is, how it works, and what LLVM code looks like. It assumes that you know
-the basics of LLVM and are interested in writing transformations or otherwise
-analyzing or manipulating the code.
-
-General Information
-
+
+
+
+
+
+
+ Introduction
+
-
-This section contains general information that is useful if you are working in
-the LLVM source-base, but that isn't specific to any particular API.
-
-
-The C++ Standard Template Library
-
-
-LLVM makes heavy use of the C++ Standard Template Library (STL), perhaps much
-more than you are used to, or have seen before. Because of this, you might want
-to do a little background reading in the techniques used and capabilities of the
-library. There are many good pages that discuss the STL, and several books on
-the subject that you can get, so it will not be discussed in this document.
-
-
-
-Other useful references
-
-
-LLVM is currently using CVS as its source versioning system. You may find this
-reference handy:
+
+
+
+
+
+
+ General Information
+
-
-
-Important and useful LLVM APIs
-
+This section contains general information that is useful if you are
+working in the LLVM source-base, but that isn't specific to any
+particular API.
+
+
+
+
+
+
+
+
+ The C++ Standard Template
+Library
+
+LLVM makes heavy use of the C++ Standard Template Library (STL),
+perhaps much more than you are used to, or have seen before. Because of
+this, you might want to do a little background reading in the
+techniques used and capabilities of the library. There are many good
+pages that discuss the STL, and several books on the subject that you
+can get, so it will not be discussed in this document.
+
+
+
+
+
+
+
+
+
+
+ Other useful references
+
+LLVM is currently using CVS as its source versioning system. You may
+find this reference handy:
+
+
+
+
+
+
+
+ Important and useful LLVM
+APIs
+
-
-Here we highlight some LLVM APIs that are generally useful and good to know
-about when writing transformations.
-
-
-The isa<>, cast<> and dyn_cast<> templates
-
-
-The LLVM source-base makes extensive use of a custom form of RTTI. These
-templates have many similarities to the C++ dynamic_cast<>
-operator, but they don't have some drawbacks (primarily stemming from the fact
-that dynamic_cast<> only works on classes that have a v-table).
-Because they are used so often, you must know what they do and how they work.
-All of these templates are defined in the Support/Casting.h file (note
-that you very rarely have to include this file directly).
-
-
-
-These five templates can be used with any classes, whether they have a v-table
-or not. To add support for these templates, you simply need to add
-classof static methods to the class you are interested casting to.
-Describing this is currently outside the scope of this document, but there are
-lots of examples in the LLVM source base.
-static bool isLoopInvariant(const Value *V, const Loop *L) {
- if (isa<Constant>(V) || isa<Argument>(V) || isa<GlobalValue>(V))
- return true;
-
- // Otherwise, it must be an instruction...
- return !L->contains(cast<Instruction>(V)->getParent());
-
- if (AllocationInst *AI = dyn_cast<AllocationInst>(Val)) {
- ...
- }
-
- // Loop over all of the phi nodes in a basic block
- BasicBlock::iterator BBI = BB->begin();
- for (; PHINode *PN = dyn_cast<PHINode>(BBI); ++BBI)
- cerr << *PN;
-
-
-
-The DEBUG() macro & -debug option
-
-
-Often when working on your pass you will put a bunch of debugging printouts and
-other code into your pass. After you get it working, you want to remove
-it... but you may need it again in the future (to work out new bugs that you run
-across).
- ...
- DEBUG(std::cerr << "I am here!\n");
- ...
-
- $ opt < a.bc > /dev/null -mypass
- <no output>
- $ opt < a.bc > /dev/null -mypass -debug
- I am here!
- $
-
Fine grained debug info with
- DEBUG_TYPE() and the -debug-only option
-
+Here we highlight some LLVM APIs that are generally useful and good to
+know about when writing transformations.
+
+
+
+
+
+
+
+
+ The isa<>,
+cast<> and dyn_cast<> templates
+
+The LLVM source-base makes extensive use of a custom form of RTTI.
+These templates have many similarities to the C++ dynamic_cast<>
+operator, but they don't have some drawbacks (primarily stemming from
+the fact that dynamic_cast<> only works on classes that
+have a v-table). Because they are used so often, you must know what they
+do and how they work. All of these templates are defined in the Support/Casting.h
+file (note that you very rarely have to include this file directly).
+
+
+
+These five templates can be used with any classes, whether they have a
+v-table or not. To add support for these templates, you simply need to
+add classof static methods to the class you are interested
+casting to. Describing this is currently outside the scope of this
+document, but there are lots of examples in the LLVM source base.
+ static bool isLoopInvariant(const Value *V, const Loop *L) {
+
if (isa<Constant>(V) || isa<Argument>(V) || isa<GlobalValue>(V))
return true;
// Otherwise, it must be an instruction...
return !L->contains(cast<Instruction>(V)->getParent()); if (AllocationInst *AI = dyn_cast<AllocationInst>(Val)) {
+
...
} // Loop over all of the phi nodes in a basic block
+
BasicBlock::iterator BBI = BB->begin();
for (; PHINode *PN = dyn_cast<PHINode>(BBI); ++BBI)
cerr << *PN;
+
+
+
+
+
+
+ The DEBUG() macro
+& -debug option
+
+Often when working on your pass you will put a bunch of debugging
+printouts and other code into your pass. After you get it working, you
+want to remove it... but you may need it again in the future (to work
+out new bugs that you run across).
+
...
+
DEBUG(std::cerr << "I am here!\n");
... $ opt < a.bc > /dev/null -mypass
+
<no output>
$ opt < a.bc > /dev/null -mypass -debug
I am here!
$
+
+
Fine grained debug info with DEBUG_TYPE() and the -debug-only
+option
Sometimes you may find yourself in a situation where enabling -debug
-just turns on too much information (such as when working on the code
-generator). If you want to enable debug information with more fine-grained
-control, you define the DEBUG_TYPE macro and the -debug only
-option as follows:
- ...
- DEBUG(std::cerr << "No debug type\n");
- #undef DEBUG_TYPE
- #define DEBUG_TYPE "foo"
- DEBUG(std::cerr << "'foo' debug type\n");
- #undef DEBUG_TYPE
- #define DEBUG_TYPE "bar"
- DEBUG(std::cerr << "'bar' debug type\n");
- #undef DEBUG_TYPE
- #define DEBUG_TYPE ""
- DEBUG(std::cerr << "No debug type (2)\n");
- ...
-
- $ opt < a.bc > /dev/null -mypass
- <no output>
- $ opt < a.bc > /dev/null -mypass -debug
- No debug type
- 'foo' debug type
- 'bar' debug type
- No debug type (2)
- $ opt < a.bc > /dev/null -mypass -debug-only=foo
- 'foo' debug type
- $ opt < a.bc > /dev/null -mypass -debug-only=bar
- 'bar' debug type
- $
-
-
-
-The Statistic template & -stats
-option
-
-
-The "Support/Statistic.h"
-file provides a template named Statistic that is used as a unified way
-to keeping track of what the LLVM compiler is doing and how effective various
-optimizations are. It is useful to see what optimizations are contributing to
-making a particular program run faster.
-
-static Statistic<> NumXForms("mypassname", "The # of times I did stuff");
-
- ++NumXForms; // I did stuff
-
- $ opt -stats -mypassname < program.bc > /dev/null
- ... statistic output ...
-
- 7646 bytecodewriter - Number of normal instructions
- 725 bytecodewriter - Number of oversized instructions
- 129996 bytecodewriter - Number of bytecode bytes written
- 2817 raise - Number of insts DCEd or constprop'd
- 3213 raise - Number of cast-of-self removed
- 5046 raise - Number of expression trees converted
- 75 raise - Number of other getelementptr's formed
- 138 raise - Number of load/store peepholes
- 42 deadtypeelim - Number of unused typenames removed from symtab
- 392 funcresolve - Number of varargs functions resolved
- 27 globaldce - Number of global variables removed
- 2 adce - Number of basic blocks removed
- 134 cee - Number of branches revectored
- 49 cee - Number of setcc instruction eliminated
- 532 gcse - Number of loads removed
- 2919 gcse - Number of instructions removed
- 86 indvars - Number of canonical indvars added
- 87 indvars - Number of aux indvars removed
- 25 instcombine - Number of dead inst eliminate
- 434 instcombine - Number of insts combined
- 248 licm - Number of load insts hoisted
- 1298 licm - Number of insts hoisted to a loop pre-header
- 3 licm - Number of insts hoisted to multiple loop preds (bad, no loop pre-header)
- 75 mem2reg - Number of alloca's promoted
- 1444 cfgsimplify - Number of blocks simplified
-
-
-Helpful Hints for Common Operations
-
+ | The Statistic +template & -stats option | +
Often you may run your pass on some big program, and you're +interested to see how many times it makes a certain transformation. +Although you can do this with hand inspection, or some ad-hoc method, +this is a real pain and not very useful for big programs. Using the Statistic +template makes it very easy to keep track of this information, and the +calculated information is presented in a uniform manner with the rest of +the passes being executed.
+There are many examples of Statistic uses, but the basics +of using it are as follows:
++
+
static Statistic<> NumXForms("mypassname", "The # of times I did stuff");+
The Statistic template can emulate just about any +data-type, but if you do not specify a template argument, it defaults to +acting like an unsigned int counter (this is usually what you want).
++
+
++NumXForms; // I did stuff+
+
That's all you have to do. To get 'opt' to print out the +statistics gathered, use the '-stats' option:
++
$ opt -stats -mypassname < program.bc > /dev/null+
... statistic output ...
When running gccas on a C file from the SPEC benchmark +suite, it gives a report that looks like this:
++
7646 bytecodewriter - Number of normal instructions+
725 bytecodewriter - Number of oversized instructions
129996 bytecodewriter - Number of bytecode bytes written
2817 raise - Number of insts DCEd or constprop'd
3213 raise - Number of cast-of-self removed
5046 raise - Number of expression trees converted
75 raise - Number of other getelementptr's formed
138 raise - Number of load/store peepholes
42 deadtypeelim - Number of unused typenames removed from symtab
392 funcresolve - Number of varargs functions resolved
27 globaldce - Number of global variables removed
2 adce - Number of basic blocks removed
134 cee - Number of branches revectored
49 cee - Number of setcc instruction eliminated
532 gcse - Number of loads removed
2919 gcse - Number of instructions removed
86 indvars - Number of canonical indvars added
87 indvars - Number of aux indvars removed
25 instcombine - Number of dead inst eliminate
434 instcombine - Number of insts combined
248 licm - Number of load insts hoisted
1298 licm - Number of insts hoisted to a loop pre-header
3 licm - Number of insts hoisted to multiple loop preds (bad, no loop pre-header)
75 mem2reg - Number of alloca's promoted
1444 cfgsimplify - Number of blocks simplified
Obviously, with so many optimizations, having a unified framework +for this stuff is very nice. Making your pass fit well into the +framework makes it more maintainable and useful.
++ +
Helpful Hints for Common +Operations | +
- -Because this is a "how-to" section, you should also read about the main classes -that you will be working with. The Core LLVM Class -Hierarchy Reference contains details and descriptions of the main classes -that you should know about.
- - - - - -
- -Basic Inspection and Traversal Routines - |
- -Because the pattern for iteration is common across many different aspects of the -program representation, the standard template library algorithms may be used on -them, and it is easier to remember how to iterate. First we show a few common -examples of the data structures that need to be traversed. Other data -structures are traversed in very similar ways.
- - - -
Because this is a "how-to" section, you should also read about the +main classes that you will be working with. The Core +LLVM Class Hierarchy Reference contains details and descriptions of +the main classes that you should know about.
++
+ | Basic Inspection and +Traversal Routines | +
Because the pattern for iteration is common across many different +aspects of the program representation, the standard template library +algorithms may be used on them, and it is easier to remember how to +iterate. First we show a few common examples of the data structures that +need to be traversed. Other data structures are traversed in very +similar ways.
++
- // func is a pointer to a Function instance - for (Function::iterator i = func->begin(), e = func->end(); i != e; ++i) { - - // print out the name of the basic block if it has one, and then the - // number of instructions that it contains - - cerr << "Basic block (name=" << i->getName() << ") has " - << i->size() << " instructions.\n"; - } -- +to transform in some way; in particular, you'd like to manipulate its BasicBlocks. +To facilitate this, you'll need to iterate over all of the BasicBlocks +that constitute the Function. The following is an example +that prints the name of a BasicBlock and the number of Instructions +it contains: +
// func is a pointer to a Function instanceNote that i can be used as if it were a pointer for the purposes of invoking member functions of the Instruction class. This is because the indirection operator is overloaded for the iterator classes. In the above code, the expression i->size() is -exactly equivalent to (*i).size() just like you'd expect. - - -
for (Function::iterator i = func->begin(), e = func->end(); i != e; ++i) {
// print out the name of the basic block if it has one, and then the
// number of instructions that it contains
cerr << "Basic block (name=" << i->getName() << ") has "
<< i->size() << " instructions.\n";
}
- // blk is a pointer to a BasicBlock instance - for (BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i) - // the next statement works since operator<<(ostream&,...) - // is overloaded for Instruction& - cerr << *i << "\n"; -- -However, this isn't really the best way to print out the contents of a -BasicBlock! Since the ostream operators are overloaded for -virtually anything you'll care about, you could have just invoked the -print routine on the basic block itself: cerr << *blk << -"\n";.
- -Note that currently operator<< is implemented for Value*, so it -will print out the contents of the pointer, instead of -the pointer value you might expect. This is a deprecated interface that will -be removed in the future, so it's best not to depend on it. To print out the -pointer value for now, you must cast to void*.
- - - -
-#include "llvm/Support/InstIterator.h" -... -// Suppose F is a ptr to a function -for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) - cerr << **i << "\n"; -- +exactly equivalent to (*i).size() just like you'd expect. + +
// blk is a pointer to a BasicBlock instance+However, this isn't really the best way to print out the contents of a BasicBlock! +Since the ostream operators are overloaded for virtually anything +you'll care about, you could have just invoked the print routine on the +basic block itself: cerr << *blk << "\n";. +
for (BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e; ++i)
// the next statement works since operator<<(ostream&,...)
// is overloaded for Instruction&
cerr << *i << "\n";
Note that currently operator<< is implemented for Value*, +so it will print out the contents of the pointer, instead of the +pointer value you might expect. This is a deprecated interface that +will be removed in the future, so it's best not to depend on it. To +print out the pointer value for now, you must cast to void*.
++ +
#include "llvm/Support/InstIterator.h"Easy, isn't it? You can also use InstIterators to fill a worklist with its initial contents. For example, if you wanted to -initialize a worklist to contain all instructions in a -Function F, all you would need to do is something like: - -
...
// Suppose F is a ptr to a function
for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i)
cerr << **i << "\n";
-std::set<Instruction*> worklist; -worklist.insert(inst_begin(F), inst_end(F)); -- -The STL set worklist would now contain all instructions in -the Function pointed to by F. - - -
std::set<Instruction*> worklist;+The STL set worklist would now contain all instructions in the Function +pointed to by F. + +
worklist.insert(inst_begin(F), inst_end(F));
- Instruction& inst = *i; // grab reference to instruction reference - Instruction* pinst = &*i; // grab pointer to instruction reference - const Instruction& inst = *j; --However, the iterators you'll be working with in the LLVM framework -are special: they will automatically convert to a ptr-to-instance type +Assuming that i is a BasicBlock::iterator and j +is a BasicBlock::const_iterator: +
Instruction& inst = *i; // grab reference to instruction reference+However, the iterators you'll be working with in the LLVM framework are +special: they will automatically convert to a ptr-to-instance type whenever they need to. Instead of dereferencing the iterator and then -taking the address of the result, you can simply assign the iterator -to the proper pointer type and you get the dereference and address-of +taking the address of the result, you can simply assign the iterator to +the proper pointer type and you get the dereference and address-of operation as a result of the assignment (behind the scenes, this is a result of overloading casting mechanisms). Thus the last line of the last example, - -
Instruction* pinst = &*i; // grab pointer to instruction reference
const Instruction& inst = *j;
Instruction* pinst = &*i;- +
Instruction* pinst = &*i;is semantically equivalent to - -
Instruction* pinst = i;- +
Instruction* pinst = i;It's also possible to turn a class pointer into the corresponding iterator. Usually, this conversion is quite inexpensive. The following code snippet illustrates use of the conversion constructors provided by LLVM iterators. By using these, you can explicitly grab the iterator of something without actually obtaining it via iteration over some structure: - -
-void printNextInstruction(Instruction* inst) { - BasicBlock::iterator it(inst); - ++it; // after this line, it refers to the instruction after *inst. - if (it != inst->getParent()->end()) cerr << *it << "\n"; -} -+
void printNextInstruction(Instruction* inst) {Of course, this example is strictly pedagogical, because it'd be much -better to explicitly grab the next instruction directly from inst. - - - -
BasicBlock::iterator it(inst);
++it; // after this line, it refers to the instruction after *inst.
if (it != inst->getParent()->end()) cerr << *it << "\n";
}
-initialize callCounter to zero -for each Function f in the Module - for each BasicBlock b in f - for each Instruction i in b - if (i is a CallInst and calls the given function) - increment callCounter -- -And the actual code is (remember, since we're writing a -FunctionPass, our FunctionPass-derived class simply -has to override the runOnFunction method...): - -
-Function* targetFunc = ...; - -class OurFunctionPass : public FunctionPass { - public: - OurFunctionPass(): c