~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/lib/Target/TargetMachine.cpp

  • 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
//===-- TargetMachine.cpp - General Target Information ---------------------==//
 
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 describes the general parts of a Target machine.
 
11
//
 
12
//===----------------------------------------------------------------------===//
 
13
 
 
14
#include "llvm/MC/MCAsmInfo.h"
 
15
#include "llvm/Target/TargetMachine.h"
 
16
#include "llvm/Target/TargetOptions.h"
 
17
#include "llvm/Support/CommandLine.h"
 
18
using namespace llvm;
 
19
 
 
20
//---------------------------------------------------------------------------
 
21
// Command-line options that tend to be useful on more than one back-end.
 
22
//
 
23
 
 
24
namespace llvm {
 
25
  bool LessPreciseFPMADOption;
 
26
  bool PrintMachineCode;
 
27
  bool NoFramePointerElim;
 
28
  bool NoExcessFPPrecision;
 
29
  bool UnsafeFPMath;
 
30
  bool FiniteOnlyFPMathOption;
 
31
  bool HonorSignDependentRoundingFPMathOption;
 
32
  bool UseSoftFloat;
 
33
  FloatABI::ABIType FloatABIType;
 
34
  bool NoImplicitFloat;
 
35
  bool NoZerosInBSS;
 
36
  bool DwarfExceptionHandling;
 
37
  bool SjLjExceptionHandling;
 
38
  bool JITEmitDebugInfo;
 
39
  bool JITEmitDebugInfoToDisk;
 
40
  bool UnwindTablesMandatory;
 
41
  Reloc::Model RelocationModel;
 
42
  CodeModel::Model CMModel;
 
43
  bool GuaranteedTailCallOpt;
 
44
  unsigned StackAlignment;
 
45
  bool RealignStack;
 
46
  bool DisableJumpTables;
 
47
  bool StrongPHIElim;
 
48
  bool AsmVerbosityDefault(false);
 
49
}
 
50
 
 
51
static cl::opt<bool, true>
 
52
PrintCode("print-machineinstrs",
 
53
  cl::desc("Print generated machine code"),
 
54
  cl::location(PrintMachineCode), cl::init(false));
 
55
static cl::opt<bool, true>
 
56
DisableFPElim("disable-fp-elim",
 
57
  cl::desc("Disable frame pointer elimination optimization"),
 
58
  cl::location(NoFramePointerElim),
 
59
  cl::init(false));
 
60
static cl::opt<bool, true>
 
61
DisableExcessPrecision("disable-excess-fp-precision",
 
62
  cl::desc("Disable optimizations that may increase FP precision"),
 
63
  cl::location(NoExcessFPPrecision),
 
64
  cl::init(false));
 
65
static cl::opt<bool, true>
 
66
EnableFPMAD("enable-fp-mad",
 
67
  cl::desc("Enable less precise MAD instructions to be generated"),
 
68
  cl::location(LessPreciseFPMADOption),
 
69
  cl::init(false));
 
70
static cl::opt<bool, true>
 
71
EnableUnsafeFPMath("enable-unsafe-fp-math",
 
72
  cl::desc("Enable optimizations that may decrease FP precision"),
 
73
  cl::location(UnsafeFPMath),
 
74
  cl::init(false));
 
75
static cl::opt<bool, true>
 
76
EnableFiniteOnlyFPMath("enable-finite-only-fp-math",
 
77
  cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"),
 
78
  cl::location(FiniteOnlyFPMathOption),
 
79
  cl::init(false));
 
80
static cl::opt<bool, true>
 
81
EnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math",
 
82
  cl::Hidden,
 
83
  cl::desc("Force codegen to assume rounding mode can change dynamically"),
 
84
  cl::location(HonorSignDependentRoundingFPMathOption),
 
85
  cl::init(false));
 
86
static cl::opt<bool, true>
 
87
GenerateSoftFloatCalls("soft-float",
 
88
  cl::desc("Generate software floating point library calls"),
 
89
  cl::location(UseSoftFloat),
 
90
  cl::init(false));
 
91
static cl::opt<llvm::FloatABI::ABIType, true>
 
92
FloatABIForCalls("float-abi",
 
93
  cl::desc("Choose float ABI type"),
 
94
  cl::location(FloatABIType),
 
95
  cl::init(FloatABI::Default),
 
96
  cl::values(
 
97
    clEnumValN(FloatABI::Default, "default",
 
98
               "Target default float ABI type"),
 
99
    clEnumValN(FloatABI::Soft, "soft",
 
100
               "Soft float ABI (implied by -soft-float)"),
 
101
    clEnumValN(FloatABI::Hard, "hard",
 
102
               "Hard float ABI (uses FP registers)"),
 
103
    clEnumValEnd));
 
104
static cl::opt<bool, true>
 
105
DontPlaceZerosInBSS("nozero-initialized-in-bss",
 
106
  cl::desc("Don't place zero-initialized symbols into bss section"),
 
107
  cl::location(NoZerosInBSS),
 
108
  cl::init(false));
 
109
static cl::opt<bool, true>
 
110
EnableDwarfExceptionHandling("enable-eh",
 
111
  cl::desc("Emit DWARF exception handling (default if target supports)"),
 
112
  cl::location(DwarfExceptionHandling),
 
113
  cl::init(false));
 
114
static cl::opt<bool, true>
 
115
EnableSjLjExceptionHandling("enable-sjlj-eh",
 
116
  cl::desc("Emit SJLJ exception handling (default if target supports)"),
 
117
  cl::location(SjLjExceptionHandling),
 
118
  cl::init(false));
 
119
// In debug builds, make this default to true.
 
120
#ifdef NDEBUG
 
121
#define EMIT_DEBUG false
 
122
#else
 
123
#define EMIT_DEBUG true
 
124
#endif
 
125
static cl::opt<bool, true>
 
126
EmitJitDebugInfo("jit-emit-debug",
 
127
  cl::desc("Emit debug information to debugger"),
 
128
  cl::location(JITEmitDebugInfo),
 
129
  cl::init(EMIT_DEBUG));
 
130
#undef EMIT_DEBUG
 
131
static cl::opt<bool, true>
 
132
EmitJitDebugInfoToDisk("jit-emit-debug-to-disk",
 
133
  cl::Hidden,
 
134
  cl::desc("Emit debug info objfiles to disk"),
 
135
  cl::location(JITEmitDebugInfoToDisk),
 
136
  cl::init(false));
 
137
static cl::opt<bool, true>
 
138
EnableUnwindTables("unwind-tables",
 
139
  cl::desc("Generate unwinding tables for all functions"),
 
140
  cl::location(UnwindTablesMandatory),
 
141
  cl::init(false));
 
142
 
 
143
static cl::opt<llvm::Reloc::Model, true>
 
144
DefRelocationModel("relocation-model",
 
145
  cl::desc("Choose relocation model"),
 
146
  cl::location(RelocationModel),
 
147
  cl::init(Reloc::Default),
 
148
  cl::values(
 
149
    clEnumValN(Reloc::Default, "default",
 
150
               "Target default relocation model"),
 
151
    clEnumValN(Reloc::Static, "static",
 
152
               "Non-relocatable code"),
 
153
    clEnumValN(Reloc::PIC_, "pic",
 
154
               "Fully relocatable, position independent code"),
 
155
    clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
 
156
               "Relocatable external references, non-relocatable code"),
 
157
    clEnumValEnd));
 
158
static cl::opt<llvm::CodeModel::Model, true>
 
159
DefCodeModel("code-model",
 
160
  cl::desc("Choose code model"),
 
161
  cl::location(CMModel),
 
162
  cl::init(CodeModel::Default),
 
163
  cl::values(
 
164
    clEnumValN(CodeModel::Default, "default",
 
165
               "Target default code model"),
 
166
    clEnumValN(CodeModel::Small, "small",
 
167
               "Small code model"),
 
168
    clEnumValN(CodeModel::Kernel, "kernel",
 
169
               "Kernel code model"),
 
170
    clEnumValN(CodeModel::Medium, "medium",
 
171
               "Medium code model"),
 
172
    clEnumValN(CodeModel::Large, "large",
 
173
               "Large code model"),
 
174
    clEnumValEnd));
 
175
static cl::opt<bool, true>
 
176
EnableGuaranteedTailCallOpt("tailcallopt",
 
177
  cl::desc("Turn fastcc calls into tail calls by (potentially) changing ABI."),
 
178
  cl::location(GuaranteedTailCallOpt),
 
179
  cl::init(false));
 
180
static cl::opt<unsigned, true>
 
181
OverrideStackAlignment("stack-alignment",
 
182
  cl::desc("Override default stack alignment"),
 
183
  cl::location(StackAlignment),
 
184
  cl::init(0));
 
185
static cl::opt<bool, true>
 
186
EnableRealignStack("realign-stack",
 
187
  cl::desc("Realign stack if needed"),
 
188
  cl::location(RealignStack),
 
189
  cl::init(true));
 
190
static cl::opt<bool, true>
 
191
DisableSwitchTables(cl::Hidden, "disable-jump-tables", 
 
192
  cl::desc("Do not generate jump tables."),
 
193
  cl::location(DisableJumpTables),
 
194
  cl::init(false));
 
195
static cl::opt<bool, true>
 
196
EnableStrongPHIElim(cl::Hidden, "strong-phi-elim",
 
197
  cl::desc("Use strong PHI elimination."),
 
198
  cl::location(StrongPHIElim),
 
199
  cl::init(false));
 
200
 
 
201
//---------------------------------------------------------------------------
 
202
// TargetMachine Class
 
203
//
 
204
 
 
205
TargetMachine::TargetMachine(const Target &T) 
 
206
  : TheTarget(T), AsmInfo(0) {
 
207
  // Typically it will be subtargets that will adjust FloatABIType from Default
 
208
  // to Soft or Hard.
 
209
  if (UseSoftFloat)
 
210
    FloatABIType = FloatABI::Soft;
 
211
}
 
212
 
 
213
TargetMachine::~TargetMachine() {
 
214
  delete AsmInfo;
 
215
}
 
216
 
 
217
/// getRelocationModel - Returns the code generation relocation model. The
 
218
/// choices are static, PIC, and dynamic-no-pic, and target default.
 
219
Reloc::Model TargetMachine::getRelocationModel() {
 
220
  return RelocationModel;
 
221
}
 
222
 
 
223
/// setRelocationModel - Sets the code generation relocation model.
 
224
void TargetMachine::setRelocationModel(Reloc::Model Model) {
 
225
  RelocationModel = Model;
 
226
}
 
227
 
 
228
/// getCodeModel - Returns the code model. The choices are small, kernel,
 
229
/// medium, large, and target default.
 
230
CodeModel::Model TargetMachine::getCodeModel() {
 
231
  return CMModel;
 
232
}
 
233
 
 
234
/// setCodeModel - Sets the code model.
 
235
void TargetMachine::setCodeModel(CodeModel::Model Model) {
 
236
  CMModel = Model;
 
237
}
 
238
 
 
239
bool TargetMachine::getAsmVerbosityDefault() {
 
240
  return AsmVerbosityDefault;
 
241
}
 
242
 
 
243
void TargetMachine::setAsmVerbosityDefault(bool V) {
 
244
  AsmVerbosityDefault = V;
 
245
}
 
246
 
 
247
namespace llvm {
 
248
  /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
 
249
  /// is specified on the command line.  When this flag is off(default), the
 
250
  /// code generator is not allowed to generate mad (multiply add) if the
 
251
  /// result is "less precise" than doing those operations individually.
 
252
  bool LessPreciseFPMAD() { return UnsafeFPMath || LessPreciseFPMADOption; }
 
253
 
 
254
  /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math
 
255
  /// option is specified on the command line. If this returns false (default),
 
256
  /// the code generator is not allowed to assume that FP arithmetic arguments
 
257
  /// and results are never NaNs or +-Infs.
 
258
  bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; }
 
259
  
 
260
  /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
 
261
  /// that the rounding mode of the FPU can change from its default.
 
262
  bool HonorSignDependentRoundingFPMath() {
 
263
    return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
 
264
  }
 
265
}