~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/Analysis/LoopPass.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===- LoopPass.h - LoopPass class ----------------------------------------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
10
// This file defines LoopPass class. All loop optimization
 
11
// and transformation passes are derived from LoopPass.
 
12
//
 
13
//===----------------------------------------------------------------------===//
 
14
 
 
15
#ifndef LLVM_LOOP_PASS_H
 
16
#define LLVM_LOOP_PASS_H
 
17
 
 
18
#include "llvm/Analysis/LoopInfo.h"
 
19
#include "llvm/Pass.h"
 
20
#include "llvm/PassManagers.h"
 
21
#include "llvm/Function.h"
 
22
 
 
23
namespace llvm {
 
24
 
 
25
class LPPassManager;
 
26
class Function;
 
27
class PMStack;
 
28
 
 
29
class LoopPass : public Pass {
 
30
public:
 
31
  explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {}
 
32
  explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {}
 
33
 
 
34
  // runOnLoop - This method should be implemented by the subclass to perform
 
35
  // whatever action is necessary for the specified Loop.
 
36
  virtual bool runOnLoop(Loop *L, LPPassManager &LPM) = 0;
 
37
 
 
38
  // Initialization and finalization hooks.
 
39
  virtual bool doInitialization(Loop *L, LPPassManager &LPM) {
 
40
    return false;
 
41
  }
 
42
 
 
43
  // Finalization hook does not supply Loop because at this time
 
44
  // loop nest is completely different.
 
45
  virtual bool doFinalization() { return false; }
 
46
 
 
47
  // Check if this pass is suitable for the current LPPassManager, if
 
48
  // available. This pass P is not suitable for a LPPassManager if P
 
49
  // is not preserving higher level analysis info used by other
 
50
  // LPPassManager passes. In such case, pop LPPassManager from the
 
51
  // stack. This will force assignPassManager() to create new
 
52
  // LPPassManger as expected.
 
53
  void preparePassManager(PMStack &PMS);
 
54
 
 
55
  /// Assign pass manager to manage this pass
 
56
  virtual void assignPassManager(PMStack &PMS,
 
57
                                 PassManagerType PMT = PMT_LoopPassManager);
 
58
 
 
59
  ///  Return what kind of Pass Manager can manage this pass.
 
60
  virtual PassManagerType getPotentialPassManagerType() const {
 
61
    return PMT_LoopPassManager;
 
62
  }
 
63
 
 
64
  //===--------------------------------------------------------------------===//
 
65
  /// SimpleAnalysis - Provides simple interface to update analysis info
 
66
  /// maintained by various passes. Note, if required this interface can
 
67
  /// be extracted into a separate abstract class but it would require
 
68
  /// additional use of multiple inheritance in Pass class hierarchy, something
 
69
  /// we are trying to avoid.
 
70
 
 
71
  /// Each loop pass can override these simple analysis hooks to update
 
72
  /// desired analysis information.
 
73
  /// cloneBasicBlockAnalysis - Clone analysis info associated with basic block.
 
74
  virtual void cloneBasicBlockAnalysis(BasicBlock *F, BasicBlock *T, Loop *L) {}
 
75
 
 
76
  /// deleteAnalysisValue - Delete analysis info associated with value V.
 
77
  virtual void deleteAnalysisValue(Value *V, Loop *L) {}
 
78
};
 
79
 
 
80
class LPPassManager : public FunctionPass, public PMDataManager {
 
81
public:
 
82
  static char ID;
 
83
  explicit LPPassManager(int Depth);
 
84
 
 
85
  /// run - Execute all of the passes scheduled for execution.  Keep track of
 
86
  /// whether any of the passes modifies the module, and if so, return true.
 
87
  bool runOnFunction(Function &F);
 
88
 
 
89
  /// Pass Manager itself does not invalidate any analysis info.
 
90
  // LPPassManager needs LoopInfo.
 
91
  void getAnalysisUsage(AnalysisUsage &Info) const;
 
92
 
 
93
  virtual const char *getPassName() const {
 
94
    return "Loop Pass Manager";
 
95
  }
 
96
 
 
97
  virtual PMDataManager *getAsPMDataManager() { return this; }
 
98
  virtual Pass *getAsPass() { return this; }
 
99
 
 
100
  /// Print passes managed by this manager
 
101
  void dumpPassStructure(unsigned Offset);
 
102
 
 
103
  Pass *getContainedPass(unsigned N) {
 
104
    assert(N < PassVector.size() && "Pass number out of range!");
 
105
    Pass *FP = static_cast<Pass *>(PassVector[N]);
 
106
    return FP;
 
107
  }
 
108
 
 
109
  virtual PassManagerType getPassManagerType() const {
 
110
    return PMT_LoopPassManager;
 
111
  }
 
112
 
 
113
public:
 
114
  // Delete loop from the loop queue and loop nest (LoopInfo).
 
115
  void deleteLoopFromQueue(Loop *L);
 
116
 
 
117
  // Insert loop into the loop queue and add it as a child of the
 
118
  // given parent.
 
119
  void insertLoop(Loop *L, Loop *ParentLoop);
 
120
 
 
121
  // Insert a loop into the loop queue.
 
122
  void insertLoopIntoQueue(Loop *L);
 
123
 
 
124
  // Reoptimize this loop. LPPassManager will re-insert this loop into the
 
125
  // queue. This allows LoopPass to change loop nest for the loop. This
 
126
  // utility may send LPPassManager into infinite loops so use caution.
 
127
  void redoLoop(Loop *L);
 
128
 
 
129
  //===--------------------------------------------------------------------===//
 
130
  /// SimpleAnalysis - Provides simple interface to update analysis info
 
131
  /// maintained by various passes. Note, if required this interface can
 
132
  /// be extracted into a separate abstract class but it would require
 
133
  /// additional use of multiple inheritance in Pass class hierarchy, something
 
134
  /// we are trying to avoid.
 
135
 
 
136
  /// cloneBasicBlockSimpleAnalysis - Invoke cloneBasicBlockAnalysis hook for
 
137
  /// all passes that implement simple analysis interface.
 
138
  void cloneBasicBlockSimpleAnalysis(BasicBlock *From, BasicBlock *To, Loop *L);
 
139
 
 
140
  /// deleteSimpleAnalysisValue - Invoke deleteAnalysisValue hook for all passes
 
141
  /// that implement simple analysis interface.
 
142
  void deleteSimpleAnalysisValue(Value *V, Loop *L);
 
143
 
 
144
private:
 
145
  std::deque<Loop *> LQ;
 
146
  bool skipThisLoop;
 
147
  bool redoThisLoop;
 
148
  LoopInfo *LI;
 
149
  Loop *CurrentLoop;
 
150
};
 
151
 
 
152
} // End llvm namespace
 
153
 
 
154
#endif