1 //=====---- X86Subtarget.h - Define Subtarget for the X86 -----*- C++ -*--====//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Nate Begeman and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the X86 specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86SUBTARGET_H
15 #define X86SUBTARGET_H
17 #include "llvm/Target/TargetSubtarget.h"
24 class X86Subtarget : public TargetSubtarget {
26 enum AsmWriterFlavorTy {
32 NoMMXSSE, MMX, SSE1, SSE2, SSE3
36 NoThreeDNow, ThreeDNow, ThreeDNowA
39 /// AsmFlavor - Which x86 asm dialect to use.
40 AsmWriterFlavorTy AsmFlavor;
42 /// X86SSELevel - MMX, SSE1, SSE2, SSE3, or none supported.
43 X86SSEEnum X86SSELevel;
45 /// X863DNowLevel - 3DNow or 3DNow Athlon, or none supported.
46 X863DNowEnum X863DNowLevel;
48 /// Is64Bit - True if the processor supports Em64T.
51 /// stackAlignment - The minimum alignment known to hold of the stack frame on
52 /// entry to the function and which must be maintained by every function.
53 unsigned stackAlignment;
55 /// Min. memset / memcpy size that is turned into rep/movs, rep/stos ops.
56 unsigned MinRepStrSizeThreshold;
60 isELF, isCygwin, isDarwin, isWindows
63 /// This constructor initializes the data members to match that
64 /// of the specified module.
66 X86Subtarget(const Module &M, const std::string &FS);
68 /// getStackAlignment - Returns the minimum alignment known to hold of the
69 /// stack frame on entry to the function and which must be maintained by every
70 /// function for this subtarget.
71 unsigned getStackAlignment() const { return stackAlignment; }
73 /// getMinRepStrSizeThreshold - Returns the minimum memset / memcpy size
74 /// required to turn the operation into a X86 rep/movs or rep/stos
75 /// instruction. This is only used if the src / dst alignment is not DWORD
77 unsigned getMinRepStrSizeThreshold() const { return MinRepStrSizeThreshold; }
79 /// ParseSubtargetFeatures - Parses features string setting specified
80 /// subtarget options. Definition of function is auto generated by tblgen.
81 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
83 bool is64Bit() const { return Is64Bit; }
85 bool hasMMX() const { return X86SSELevel >= MMX; }
86 bool hasSSE1() const { return X86SSELevel >= SSE1; }
87 bool hasSSE2() const { return X86SSELevel >= SSE2; }
88 bool hasSSE3() const { return X86SSELevel >= SSE3; }
89 bool has3DNow() const { return X863DNowLevel >= ThreeDNow; }
90 bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; }
92 bool isFlavorAtt() const { return AsmFlavor == att; }
93 bool isFlavorIntel() const { return AsmFlavor == intel; }
95 bool isTargetDarwin() const { return TargetType == isDarwin; }
96 bool isTargetELF() const { return TargetType == isELF; }
98 } // End llvm namespace