Chris Lattner | 781e6f5 | 2002-07-29 21:24:10 +0000 | [diff] [blame] | 1 | //===- AnalysisWrappers.cpp - Wrappers around non-pass analyses -----------===// |
John Criswell | 7c0e022 | 2003-10-20 17:47:21 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | 781e6f5 | 2002-07-29 21:24:10 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file defines pass wrappers around LLVM analyses that don't make sense to |
| 11 | // be passes. It provides a nice standard pass interface to these classes so |
| 12 | // that they can be printed out by analyze. |
| 13 | // |
Misha Brukman | bc0e998 | 2003-07-14 17:20:40 +0000 | [diff] [blame] | 14 | // These classes are separated out of analyze.cpp so that it is more clear which |
Chris Lattner | 781e6f5 | 2002-07-29 21:24:10 +0000 | [diff] [blame] | 15 | // code is the integral part of the analyze tool, and which part of the code is |
| 16 | // just making it so more passes are available. |
| 17 | // |
| 18 | //===----------------------------------------------------------------------===// |
| 19 | |
Chris Lattner | 04eaef2 | 2004-04-02 20:56:33 +0000 | [diff] [blame] | 20 | #include "llvm/Pass.h" |
Chris Lattner | 781e6f5 | 2002-07-29 21:24:10 +0000 | [diff] [blame] | 21 | #include "llvm/Analysis/InstForest.h" |
Chris Lattner | 781e6f5 | 2002-07-29 21:24:10 +0000 | [diff] [blame] | 22 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 23 | using namespace llvm; |
| 24 | |
Chris Lattner | 781e6f5 | 2002-07-29 21:24:10 +0000 | [diff] [blame] | 25 | namespace { |
| 26 | struct InstForestHelper : public FunctionPass { |
| 27 | Function *F; |
| 28 | virtual bool runOnFunction(Function &Func) { F = &Func; return false; } |
| 29 | |
| 30 | void print(std::ostream &OS) const { |
| 31 | std::cout << InstForest<char>(F); |
| 32 | } |
| 33 | |
| 34 | virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
| 35 | AU.setPreservesAll(); |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | RegisterAnalysis<InstForestHelper> P1("instforest", "InstForest Printer"); |
Chris Lattner | 781e6f5 | 2002-07-29 21:24:10 +0000 | [diff] [blame] | 40 | } |