blob: aa9f03d88388202c77712dd17013af93afef9045 [file] [log] [blame]
Chris Lattner781e6f52002-07-29 21:24:10 +00001//===- AnalysisWrappers.cpp - Wrappers around non-pass analyses -----------===//
John Criswell7c0e0222003-10-20 17:47:21 +00002//
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 Lattner781e6f52002-07-29 21:24:10 +00009//
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 Brukmanbc0e9982003-07-14 17:20:40 +000014// These classes are separated out of analyze.cpp so that it is more clear which
Chris Lattner781e6f52002-07-29 21:24:10 +000015// 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 Lattner04eaef22004-04-02 20:56:33 +000020#include "llvm/Pass.h"
Chris Lattner781e6f52002-07-29 21:24:10 +000021#include "llvm/Analysis/InstForest.h"
Chris Lattner781e6f52002-07-29 21:24:10 +000022
Brian Gaeked0fde302003-11-11 22:41:34 +000023using namespace llvm;
24
Chris Lattner781e6f52002-07-29 21:24:10 +000025namespace {
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 Lattner781e6f52002-07-29 21:24:10 +000040}