From 7fa6d52dda64c950717988c8be2aa32f0314ddda Mon Sep 17 00:00:00 2001
From: Reid Spencer
This makefile specifies that all of the .cpp files in the current directory are to be compiled and linked together into a -lib/Debug/libhello.so shared object that can be dynamically loaded by -the opt or analyze tools. If your operating system uses a -suffix other than .so (such as windows or Mac OS/X), the appropriate extension -will be used.
+Debug/lib/Hello.so shared object that can be dynamically loaded by +the opt or analyze tools via their -load options. +If your operating system uses a suffix other than .so (such as windows or +Mac OS/X), the appropriate extension will be used.Now that we have the build scripts set up, we just need to write the code for the pass itself.
@@ -290,7 +295,7 @@ depending on what it is to be used for. For "optimizations" we use theNow that it's all together, compile the file with a simple "gmake" command in the local directory and you should get a new -"lib/Debug/libhello.so file. Note that everything in this file is +"Debug/lib/Hello.so file. Note that everything in this file is contained in an anonymous namespace: this reflects the fact that passes are self contained units that do not need external interfaces (although they can have them) to be useful.
@@ -316,7 +321,7 @@ through our transformation like this (or course, any bytecode file will work):-$ opt -load ../../../lib/Debug/libhello.so -hello < hello.bc > /dev/null +$ opt -load ../../../Debug/lib/Hello.so -hello < hello.bc > /dev/null Hello: __main Hello: puts Hello: main @@ -333,7 +338,7 @@ interesting way, we just throw away the result of opt (sending it to opt with the --help option:-$ opt -load ../../../lib/Debug/libhello.so --help +$ opt -load ../../../Debug/lib/Hello.so --help OVERVIEW: llvm .bc -> .bc modular optimizer USAGE: opt [options] <input bytecode> @@ -361,7 +366,7 @@ the execution time of your pass along with the other passes you queue up. For example:-$ opt -load ../../../lib/Debug/libhello.so -hello -time-passes < hello.bc > /dev/null +$ opt -load ../../../Debug/lib/Hello.so -hello -time-passes < hello.bc > /dev/null Hello: __main Hello: puts Hello: main @@ -1286,7 +1291,7 @@ how our Hello World pass interacts with other passes. Lets try it out with the gcse and licm passes:-$ opt -load ../../../lib/Debug/libhello.so -gcse -licm --debug-pass=Structure < hello.bc > /dev/null +$ opt -load ../../../Debug/lib/Hello.so -gcse -licm --debug-pass=Structure < hello.bc > /dev/null Module Pass Manager Function Pass Manager Dominator Set Construction @@ -1323,7 +1328,7 @@ passes. World pass in between the two passes:-$ opt -load ../../../lib/Debug/libhello.so -gcse -hello -licm --debug-pass=Structure < hello.bc > /dev/null +$ opt -load ../../../Debug/lib/Hello.so -gcse -hello -licm --debug-pass=Structure < hello.bc > /dev/null Module Pass Manager Function Pass Manager Dominator Set Construction @@ -1364,7 +1369,7 @@ href="#getAnalysisUsage">getAnalysisUsage method to our pass:Now when we run our pass, we get this output:
-$ opt -load ../../../lib/Debug/libhello.so -gcse -hello -licm --debug-pass=Structure < hello.bc > /dev/null +$ opt -load ../../../Debug/lib/Hello.so -gcse -hello -licm --debug-pass=Structure < hello.bc > /dev/null Pass Arguments: -gcse -hello -licm Module Pass Manager Function Pass Manager