File tree Expand file tree Collapse file tree 5 files changed +1871
-5
lines changed Expand file tree Collapse file tree 5 files changed +1871
-5
lines changed Original file line number Diff line number Diff line change 8
8
#include " llvm/Analysis/Verifier.h"
9
9
#include " llvm/IR/BasicBlock.h"
10
10
#include " llvm/IR/CFG.h"
11
+ #include " llvm/IR/IRBuilder.h"
11
12
#include " llvm/IR/PassManager.h"
12
13
#include " llvm/Passes/PassBuilder.h"
13
14
#include " llvm/Passes/PassPlugin.h"
@@ -37,11 +38,19 @@ struct PrinterPass final : public PassInfoMixin<PrinterPass> {
37
38
LoopInfo &getLI = FAM.getResult <llvm::LoopAnalysis>(F);
38
39
DominatorTree &DT = FAM.getResult <DominatorTreeAnalysis>(F);
39
40
41
+ /* *
42
+ * @brief Loop Info Analysis
43
+ */
40
44
if (getLI.empty ())
41
45
std::cout << " No Loops ! \n\n " ;
42
46
else
43
47
getLI.print (errs ());
44
48
49
+ /* *
50
+ * @brief Print Dominator Tree to llvm::errs()
51
+ */
52
+ DT.print (errs ());
53
+
45
54
std::cout << " Function: " << F.getName ().str () << std::endl;
46
55
for (Function::iterator BB = F.begin (); BB != F.end (); BB++) {
47
56
std::cout << " \t Basic Block : " << BB->getName ().str ()
@@ -52,6 +61,7 @@ struct PrinterPass final : public PassInfoMixin<PrinterPass> {
52
61
auto phi = dyn_cast<PHINode>(I);
53
62
if (phi != NULL )
54
63
errs () << " \t\t Phi Alloca : " << phi << " \n " ;
64
+
55
65
for (Use &U : I->operands ()) {
56
66
Value *v = U.get ();
57
67
if (v != NULL )
You can’t perform that action at this time.
0 commit comments