~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/include/llvm/Target/TargetMachine.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
//===-- llvm/Target/TargetMachine.h - Target Information --------*- C++ -*-===//
 
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 the TargetMachine and LLVMTargetMachine classes.
 
11
//
 
12
//===----------------------------------------------------------------------===//
 
13
 
 
14
#ifndef LLVM_TARGET_TARGETMACHINE_H
 
15
#define LLVM_TARGET_TARGETMACHINE_H
 
16
 
 
17
#include "llvm/Target/TargetInstrItineraries.h"
 
18
#include <cassert>
 
19
#include <string>
 
20
 
 
21
namespace llvm {
 
22
 
 
23
class Target;
 
24
class MCAsmInfo;
 
25
class TargetData;
 
26
class TargetSubtarget;
 
27
class TargetInstrInfo;
 
28
class TargetIntrinsicInfo;
 
29
class TargetJITInfo;
 
30
class TargetLowering;
 
31
class TargetFrameInfo;
 
32
class JITCodeEmitter;
 
33
class TargetRegisterInfo;
 
34
class PassManagerBase;
 
35
class PassManager;
 
36
class Pass;
 
37
class TargetELFWriterInfo;
 
38
class formatted_raw_ostream;
 
39
 
 
40
// Relocation model types.
 
41
namespace Reloc {
 
42
  enum Model {
 
43
    Default,
 
44
    Static,
 
45
    PIC_,         // Cannot be named PIC due to collision with -DPIC
 
46
    DynamicNoPIC
 
47
  };
 
48
}
 
49
 
 
50
// Code model types.
 
51
namespace CodeModel {
 
52
  enum Model {
 
53
    Default,
 
54
    Small,
 
55
    Kernel,
 
56
    Medium,
 
57
    Large
 
58
  };
 
59
}
 
60
 
 
61
// Code generation optimization level.
 
62
namespace CodeGenOpt {
 
63
  enum Level {
 
64
    None,        // -O0
 
65
    Less,        // -O1
 
66
    Default,     // -O2, -Os
 
67
    Aggressive   // -O3
 
68
  };
 
69
}
 
70
 
 
71
//===----------------------------------------------------------------------===//
 
72
///
 
73
/// TargetMachine - Primary interface to the complete machine description for
 
74
/// the target machine.  All target-specific information should be accessible
 
75
/// through this interface.
 
76
///
 
77
class TargetMachine {
 
78
  TargetMachine(const TargetMachine &);   // DO NOT IMPLEMENT
 
79
  void operator=(const TargetMachine &);  // DO NOT IMPLEMENT
 
80
protected: // Can only create subclasses.
 
81
  TargetMachine(const Target &);
 
82
 
 
83
  /// getSubtargetImpl - virtual method implemented by subclasses that returns
 
84
  /// a reference to that target's TargetSubtarget-derived member variable.
 
85
  virtual const TargetSubtarget *getSubtargetImpl() const { return 0; }
 
86
 
 
87
  /// TheTarget - The Target that this machine was created for.
 
88
  const Target &TheTarget;
 
89
  
 
90
  /// AsmInfo - Contains target specific asm information.
 
91
  ///
 
92
  const MCAsmInfo *AsmInfo;
 
93
  
 
94
public:
 
95
  virtual ~TargetMachine();
 
96
 
 
97
  const Target &getTarget() const { return TheTarget; }
 
98
 
 
99
  // Interfaces to the major aspects of target machine information:
 
100
  // -- Instruction opcode and operand information
 
101
  // -- Pipelines and scheduling information
 
102
  // -- Stack frame information
 
103
  // -- Selection DAG lowering information
 
104
  //
 
105
  virtual const TargetInstrInfo        *getInstrInfo() const { return 0; }
 
106
  virtual const TargetFrameInfo        *getFrameInfo() const { return 0; }
 
107
  virtual       TargetLowering    *getTargetLowering() const { return 0; }
 
108
  virtual const TargetData            *getTargetData() const { return 0; }
 
109
  
 
110
  /// getMCAsmInfo - Return target specific asm information.
 
111
  ///
 
112
  const MCAsmInfo *getMCAsmInfo() const { return AsmInfo; }
 
113
  
 
114
  /// getSubtarget - This method returns a pointer to the specified type of
 
115
  /// TargetSubtarget.  In debug builds, it verifies that the object being
 
116
  /// returned is of the correct type.
 
117
  template<typename STC> const STC &getSubtarget() const {
 
118
    return *static_cast<const STC*>(getSubtargetImpl());
 
119
  }
 
120
 
 
121
  /// getRegisterInfo - If register information is available, return it.  If
 
122
  /// not, return null.  This is kept separate from RegInfo until RegInfo has
 
123
  /// details of graph coloring register allocation removed from it.
 
124
  ///
 
125
  virtual const TargetRegisterInfo *getRegisterInfo() const { return 0; }
 
126
  
 
127
  /// getIntrinsicInfo - If intrinsic information is available, return it.  If
 
128
  /// not, return null.
 
129
  ///
 
130
  virtual const TargetIntrinsicInfo *getIntrinsicInfo() const { return 0; }
 
131
 
 
132
  /// getJITInfo - If this target supports a JIT, return information for it,
 
133
  /// otherwise return null.
 
134
  ///
 
135
  virtual TargetJITInfo *getJITInfo() { return 0; }
 
136
  
 
137
  /// getInstrItineraryData - Returns instruction itinerary data for the target
 
138
  /// or specific subtarget.
 
139
  ///
 
140
  virtual const InstrItineraryData getInstrItineraryData() const {  
 
141
    return InstrItineraryData();
 
142
  }
 
143
 
 
144
  /// getELFWriterInfo - If this target supports an ELF writer, return
 
145
  /// information for it, otherwise return null.
 
146
  /// 
 
147
  virtual const TargetELFWriterInfo *getELFWriterInfo() const { return 0; }
 
148
 
 
149
  /// getRelocationModel - Returns the code generation relocation model. The
 
150
  /// choices are static, PIC, and dynamic-no-pic, and target default.
 
151
  static Reloc::Model getRelocationModel();
 
152
 
 
153
  /// setRelocationModel - Sets the code generation relocation model.
 
154
  ///
 
155
  static void setRelocationModel(Reloc::Model Model);
 
156
 
 
157
  /// getCodeModel - Returns the code model. The choices are small, kernel,
 
158
  /// medium, large, and target default.
 
159
  static CodeModel::Model getCodeModel();
 
160
 
 
161
  /// setCodeModel - Sets the code model.
 
162
  ///
 
163
  static void setCodeModel(CodeModel::Model Model);
 
164
 
 
165
  /// getAsmVerbosityDefault - Returns the default value of asm verbosity.
 
166
  ///
 
167
  static bool getAsmVerbosityDefault();
 
168
 
 
169
  /// setAsmVerbosityDefault - Set the default value of asm verbosity. Default
 
170
  /// is false.
 
171
  static void setAsmVerbosityDefault(bool);
 
172
 
 
173
  /// CodeGenFileType - These enums are meant to be passed into
 
174
  /// addPassesToEmitFile to indicate what type of file to emit, and returned by
 
175
  /// it to indicate what type of file could actually be made.
 
176
  enum CodeGenFileType {
 
177
    CGFT_AssemblyFile,
 
178
    CGFT_ObjectFile,
 
179
    CGFT_Null         // Do not emit any output.
 
180
  };
 
181
 
 
182
  /// getEnableTailMergeDefault - the default setting for -enable-tail-merge
 
183
  /// on this target.  User flag overrides.
 
184
  virtual bool getEnableTailMergeDefault() const { return true; }
 
185
 
 
186
  /// addPassesToEmitFile - Add passes to the specified pass manager to get the
 
187
  /// specified file emitted.  Typically this will involve several steps of code
 
188
  /// generation.  This method should return true if emission of this file type
 
189
  /// is not supported, or false on success.
 
190
  virtual bool addPassesToEmitFile(PassManagerBase &,
 
191
                                   formatted_raw_ostream &,
 
192
                                   CodeGenFileType,
 
193
                                   CodeGenOpt::Level,
 
194
                                   bool DisableVerify = true) {
 
195
    return true;
 
196
  }
 
197
 
 
198
  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
 
199
  /// get machine code emitted.  This uses a JITCodeEmitter object to handle
 
200
  /// actually outputting the machine code and resolving things like the address
 
201
  /// of functions.  This method returns true if machine code emission is
 
202
  /// not supported.
 
203
  ///
 
204
  virtual bool addPassesToEmitMachineCode(PassManagerBase &,
 
205
                                          JITCodeEmitter &,
 
206
                                          CodeGenOpt::Level,
 
207
                                          bool DisableVerify = true) {
 
208
    return true;
 
209
  }
 
210
 
 
211
  /// addPassesToEmitWholeFile - This method can be implemented by targets that 
 
212
  /// require having the entire module at once.  This is not recommended, do not
 
213
  /// use this.
 
214
  virtual bool WantsWholeFile() const { return false; }
 
215
  virtual bool addPassesToEmitWholeFile(PassManager &, formatted_raw_ostream &,
 
216
                                        CodeGenFileType,
 
217
                                        CodeGenOpt::Level,
 
218
                                        bool DisableVerify = true) {
 
219
    return true;
 
220
  }
 
221
};
 
222
 
 
223
/// LLVMTargetMachine - This class describes a target machine that is
 
224
/// implemented with the LLVM target-independent code generator.
 
225
///
 
226
class LLVMTargetMachine : public TargetMachine {
 
227
protected: // Can only create subclasses.
 
228
  LLVMTargetMachine(const Target &T, const std::string &TargetTriple);
 
229
  
 
230
  /// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
 
231
  /// both emitting to assembly files or machine code output.
 
232
  ///
 
233
  bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level,
 
234
                              bool DisableVerify);
 
235
 
 
236
private:
 
237
  virtual void setCodeModelForJIT();
 
238
  virtual void setCodeModelForStatic();
 
239
  
 
240
public:
 
241
  
 
242
  /// addPassesToEmitFile - Add passes to the specified pass manager to get the
 
243
  /// specified file emitted.  Typically this will involve several steps of code
 
244
  /// generation.  If OptLevel is None, the code generator should emit code as
 
245
  /// fast as possible, though the generated code may be less efficient.
 
246
  virtual bool addPassesToEmitFile(PassManagerBase &PM,
 
247
                                   formatted_raw_ostream &Out,
 
248
                                   CodeGenFileType FileType,
 
249
                                   CodeGenOpt::Level,
 
250
                                   bool DisableVerify = true);
 
251
  
 
252
  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
 
253
  /// get machine code emitted.  This uses a JITCodeEmitter object to handle
 
254
  /// actually outputting the machine code and resolving things like the address
 
255
  /// of functions.  This method returns true if machine code emission is
 
256
  /// not supported.
 
257
  ///
 
258
  virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
 
259
                                          JITCodeEmitter &MCE,
 
260
                                          CodeGenOpt::Level,
 
261
                                          bool DisableVerify = true);
 
262
  
 
263
  /// Target-Independent Code Generator Pass Configuration Options.
 
264
  
 
265
  /// addInstSelector - This method should add any "last minute" LLVM->LLVM
 
266
  /// passes, then install an instruction selector pass, which converts from
 
267
  /// LLVM code to machine instructions.
 
268
  virtual bool addInstSelector(PassManagerBase &, CodeGenOpt::Level) {
 
269
    return true;
 
270
  }
 
271
 
 
272
  /// addPreRegAlloc - This method may be implemented by targets that want to
 
273
  /// run passes immediately before register allocation. This should return
 
274
  /// true if -print-machineinstrs should print after these passes.
 
275
  virtual bool addPreRegAlloc(PassManagerBase &, CodeGenOpt::Level) {
 
276
    return false;
 
277
  }
 
278
 
 
279
  /// addPostRegAlloc - This method may be implemented by targets that want
 
280
  /// to run passes after register allocation but before prolog-epilog
 
281
  /// insertion.  This should return true if -print-machineinstrs should print
 
282
  /// after these passes.
 
283
  virtual bool addPostRegAlloc(PassManagerBase &, CodeGenOpt::Level) {
 
284
    return false;
 
285
  }
 
286
 
 
287
  /// addPreSched2 - This method may be implemented by targets that want to
 
288
  /// run passes after prolog-epilog insertion and before the second instruction
 
289
  /// scheduling pass.  This should return true if -print-machineinstrs should
 
290
  /// print after these passes.
 
291
  virtual bool addPreSched2(PassManagerBase &, CodeGenOpt::Level) {
 
292
    return false;
 
293
  }
 
294
  
 
295
  /// addPreEmitPass - This pass may be implemented by targets that want to run
 
296
  /// passes immediately before machine code is emitted.  This should return
 
297
  /// true if -print-machineinstrs should print out the code after the passes.
 
298
  virtual bool addPreEmitPass(PassManagerBase &, CodeGenOpt::Level) {
 
299
    return false;
 
300
  }
 
301
  
 
302
  
 
303
  /// addCodeEmitter - This pass should be overridden by the target to add a
 
304
  /// code emitter, if supported.  If this is not supported, 'true' should be
 
305
  /// returned.
 
306
  virtual bool addCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
 
307
                              JITCodeEmitter &) {
 
308
    return true;
 
309
  }
 
310
 
 
311
  /// getEnableTailMergeDefault - the default setting for -enable-tail-merge
 
312
  /// on this target.  User flag overrides.
 
313
  virtual bool getEnableTailMergeDefault() const { return true; }
 
314
};
 
315
 
 
316
} // End llvm namespace
 
317
 
 
318
#endif