~ubuntu-branches/ubuntu/maverick/clamav/maverick-security

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/lib/Target/X86/X86Subtarget.h

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-02-23 14:27:51 UTC
  • mfrom: (0.35.17 sid)
  • Revision ID: james.westby@ubuntu.com-20110223142751-o9xb8jyvhkh75d0n
Tags: 0.96.5+dfsg-1ubuntu1.10.10.2
* SECURITY UPDATE: denial of service via double free in vba processing
  - libclamav/vba_extract.c: set buf to NULL when it gets freed.
  - http://git.clamav.net/gitweb?p=clamav-devel.git;a=commit;h=d21fb8d975f8c9688894a8cef4d50d977022e09f
  - CVE-2011-1003

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#ifndef X86SUBTARGET_H
15
15
#define X86SUBTARGET_H
16
16
 
 
17
#include "llvm/ADT/Triple.h"
17
18
#include "llvm/Target/TargetSubtarget.h"
 
19
#include "llvm/CallingConv.h"
18
20
#include <string>
19
21
 
20
22
namespace llvm {
69
71
  /// HasAVX - Target has AVX instructions
70
72
  bool HasAVX;
71
73
 
 
74
  /// HasAES - Target has AES instructions
 
75
  bool HasAES;
 
76
 
 
77
  /// HasCLMUL - Target has carry-less multiplication
 
78
  bool HasCLMUL;
 
79
 
72
80
  /// HasFMA3 - Target has 3-operand fused multiply-add
73
81
  bool HasFMA3;
74
82
 
78
86
  /// IsBTMemSlow - True if BT (bit test) of memory instructions are slow.
79
87
  bool IsBTMemSlow;
80
88
 
 
89
  /// IsUAMemFast - True if unaligned memory access is fast.
 
90
  bool IsUAMemFast;
 
91
 
81
92
  /// HasVectorUAMem - True if SIMD operations can have unaligned memory
82
 
  ///                  operands. This may require setting a feature bit in the
83
 
  ///                  processor.
 
93
  /// operands. This may require setting a feature bit in the processor.
84
94
  bool HasVectorUAMem;
85
95
 
86
 
  /// DarwinVers - Nonzero if this is a darwin platform: the numeric
87
 
  /// version of the platform, e.g. 8 = 10.4 (Tiger), 9 = 10.5 (Leopard), etc.
88
 
  unsigned char DarwinVers; // Is any darwin-x86 platform.
89
 
 
90
96
  /// stackAlignment - The minimum alignment known to hold of the stack frame on
91
97
  /// entry to the function and which must be maintained by every function.
92
98
  unsigned stackAlignment;
94
100
  /// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
95
101
  ///
96
102
  unsigned MaxInlineSizeThreshold;
 
103
  
 
104
  /// TargetTriple - What processor and OS we're targeting.
 
105
  Triple TargetTriple;
97
106
 
98
107
private:
99
108
  /// Is64Bit - True if the processor supports 64-bit instructions and
101
110
  bool Is64Bit;
102
111
 
103
112
public:
104
 
  enum {
105
 
    isELF, isCygwin, isDarwin, isWindows, isMingw
106
 
  } TargetType;
107
113
 
108
114
  /// This constructor initializes the data members to match that
109
115
  /// of the specified triple.
133
139
  PICStyles::Style getPICStyle() const { return PICStyle; }
134
140
  void setPICStyle(PICStyles::Style Style)  { PICStyle = Style; }
135
141
 
 
142
  bool hasCMov() const { return HasCMov; }
136
143
  bool hasMMX() const { return X86SSELevel >= MMX; }
137
144
  bool hasSSE1() const { return X86SSELevel >= SSE1; }
138
145
  bool hasSSE2() const { return X86SSELevel >= SSE2; }
144
151
  bool has3DNow() const { return X863DNowLevel >= ThreeDNow; }
145
152
  bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; }
146
153
  bool hasAVX() const { return HasAVX; }
 
154
  bool hasAES() const { return HasAES; }
 
155
  bool hasCLMUL() const { return HasCLMUL; }
147
156
  bool hasFMA3() const { return HasFMA3; }
148
157
  bool hasFMA4() const { return HasFMA4; }
149
158
  bool isBTMemSlow() const { return IsBTMemSlow; }
 
159
  bool isUnalignedMemAccessFast() const { return IsUAMemFast; }
150
160
  bool hasVectorUAMem() const { return HasVectorUAMem; }
151
161
 
152
 
  bool isTargetDarwin() const { return TargetType == isDarwin; }
153
 
  bool isTargetELF() const { return TargetType == isELF; }
 
162
  bool isTargetDarwin() const { return TargetTriple.getOS() == Triple::Darwin; }
 
163
  
 
164
  // ELF is a reasonably sane default and the only other X86 targets we
 
165
  // support are Darwin and Windows. Just use "not those".
 
166
  bool isTargetELF() const { 
 
167
    return !isTargetDarwin() && !isTargetWindows() && !isTargetCygMing();
 
168
  }
 
169
  bool isTargetLinux() const { return TargetTriple.getOS() == Triple::Linux; }
154
170
 
155
 
  bool isTargetWindows() const { return TargetType == isWindows; }
156
 
  bool isTargetMingw() const { return TargetType == isMingw; }
157
 
  bool isTargetCygwin() const { return TargetType == isCygwin; }
 
171
  bool isTargetWindows() const { return TargetTriple.getOS() == Triple::Win32; }
 
172
  bool isTargetMingw() const { 
 
173
    return TargetTriple.getOS() == Triple::MinGW32 ||
 
174
           TargetTriple.getOS() == Triple::MinGW64; }
 
175
  bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; }
158
176
  bool isTargetCygMing() const {
159
 
    return TargetType == isMingw || TargetType == isCygwin;
 
177
    return isTargetMingw() || isTargetCygwin();
160
178
  }
161
 
 
 
179
  
162
180
  /// isTargetCOFF - Return true if this is any COFF/Windows target variant.
163
181
  bool isTargetCOFF() const {
164
 
    return TargetType == isMingw || TargetType == isCygwin ||
165
 
           TargetType == isWindows;
 
182
    return isTargetMingw() || isTargetCygwin() || isTargetWindows();
166
183
  }
167
184
 
168
185
  bool isTargetWin64() const {
169
 
    return Is64Bit && (TargetType == isMingw || TargetType == isWindows);
 
186
    return Is64Bit && (isTargetMingw() || isTargetWindows());
 
187
  }
 
188
 
 
189
  bool isTargetWin32() const {
 
190
    return !Is64Bit && (isTargetMingw() || isTargetWindows());
170
191
  }
171
192
 
172
193
  std::string getDataLayout() const {
200
221
 
201
222
  /// getDarwinVers - Return the darwin version number, 8 = Tiger, 9 = Leopard,
202
223
  /// 10 = Snow Leopard, etc.
203
 
  unsigned getDarwinVers() const { return DarwinVers; }
 
224
  unsigned getDarwinVers() const {
 
225
    if (isTargetDarwin()) return TargetTriple.getDarwinMajorNumber();
 
226
    return 0;
 
227
  }
204
228
 
205
229
  /// ClassifyGlobalReference - Classify a global variable reference for the
206
230
  /// current subtarget according to how we should reference it in a non-pcrel
230
254
  /// should be attempted.
231
255
  unsigned getSpecialAddressLatency() const;
232
256
 
233
 
  /// enablePostRAScheduler - X86 target is enabling post-alloc scheduling
234
 
  /// at 'More' optimization level.
235
 
  bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
236
 
                             TargetSubtarget::AntiDepBreakMode& Mode,
237
 
                             RegClassVector& CriticalPathRCs) const;
 
257
  /// IsCalleePop - Test whether a function should pop its own arguments.
 
258
  bool IsCalleePop(bool isVarArg, CallingConv::ID CallConv) const;
238
259
};
239
260
 
240
261
} // End llvm namespace