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 {
27 NoMMXSSE, MMX, SSE1, SSE2, SSE3
31 NoThreeDNow, ThreeDNow, ThreeDNowA
34 /// X86SSELevel - MMX, SSE1, SSE2, SSE3, or none supported.
35 X86SSEEnum X86SSELevel;
37 /// X863DNowLevel - 3DNow or 3DNow Athlon, or none supported.
38 X863DNowEnum X863DNowLevel;
40 /// Is64Bit - True if the processor supports Em64T.
43 /// stackAlignment - The minimum alignment known to hold of the stack frame on
44 /// entry to the function and which must be maintained by every function.
45 unsigned stackAlignment;
47 /// Used by instruction selector
48 bool indirectExternAndWeakGlobals;
52 isELF, isCygwin, isDarwin, isWindows
55 /// This constructor initializes the data members to match that
56 /// of the specified module.
58 X86Subtarget(const Module &M, const std::string &FS);
60 /// getStackAlignment - Returns the minimum alignment known to hold of the
61 /// stack frame on entry to the function and which must be maintained by every
62 /// function for this subtarget.
63 unsigned getStackAlignment() const { return stackAlignment; }
65 /// Returns true if the instruction selector should treat global values
66 /// referencing external or weak symbols as indirect rather than direct
68 bool getIndirectExternAndWeakGlobals() const {
69 return indirectExternAndWeakGlobals;
72 /// ParseSubtargetFeatures - Parses features string setting specified
73 /// subtarget options. Definition of function is auto generated by tblgen.
74 void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
76 bool is64Bit() const { return Is64Bit; }
78 bool hasMMX() const { return X86SSELevel >= MMX; }
79 bool hasSSE1() const { return X86SSELevel >= SSE1; }
80 bool hasSSE2() const { return X86SSELevel >= SSE2; }
81 bool hasSSE3() const { return X86SSELevel >= SSE3; }
82 bool has3DNow() const { return X863DNowLevel >= ThreeDNow; }
83 bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; }
85 } // End llvm namespace