2010-12-04 23:57:24 +00:00
|
|
|
//===-- X86Subtarget.cpp - X86 Subtarget Information ----------------------===//
|
2005-07-12 01:41:54 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-07-12 01:41:54 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the X86 specific subclass of TargetSubtarget.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-01-03 04:04:46 +00:00
|
|
|
#define DEBUG_TYPE "subtarget"
|
2005-07-12 01:41:54 +00:00
|
|
|
#include "X86Subtarget.h"
|
2009-07-10 07:20:05 +00:00
|
|
|
#include "X86InstrInfo.h"
|
2006-10-06 09:17:41 +00:00
|
|
|
#include "X86GenSubtarget.inc"
|
2009-08-02 22:11:08 +00:00
|
|
|
#include "llvm/GlobalValue.h"
|
2009-01-03 04:04:46 +00:00
|
|
|
#include "llvm/Support/Debug.h"
|
2009-08-03 00:11:34 +00:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2010-11-29 18:16:10 +00:00
|
|
|
#include "llvm/Support/Host.h"
|
2006-12-22 22:29:05 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2009-11-10 00:48:55 +00:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2005-07-12 01:41:54 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-04-25 18:27:23 +00:00
|
|
|
#if defined(_MSC_VER)
|
2009-08-03 00:11:34 +00:00
|
|
|
#include <intrin.h>
|
2009-04-25 18:27:23 +00:00
|
|
|
#endif
|
|
|
|
|
2009-11-20 23:18:13 +00:00
|
|
|
/// ClassifyBlockAddressReference - Classify a blockaddress reference for the
|
|
|
|
/// current subtarget according to how we should reference it in a non-pcrel
|
|
|
|
/// context.
|
|
|
|
unsigned char X86Subtarget::
|
|
|
|
ClassifyBlockAddressReference() const {
|
|
|
|
if (isPICStyleGOT()) // 32-bit ELF targets.
|
|
|
|
return X86II::MO_GOTOFF;
|
|
|
|
|
|
|
|
if (isPICStyleStubPIC()) // Darwin/32 in PIC mode.
|
|
|
|
return X86II::MO_PIC_BASE_OFFSET;
|
|
|
|
|
|
|
|
// Direct static reference to label.
|
|
|
|
return X86II::MO_NO_FLAG;
|
|
|
|
}
|
|
|
|
|
2009-07-10 07:20:05 +00:00
|
|
|
/// ClassifyGlobalReference - Classify a global variable reference for the
|
|
|
|
/// current subtarget according to how we should reference it in a non-pcrel
|
|
|
|
/// context.
|
|
|
|
unsigned char X86Subtarget::
|
|
|
|
ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
|
|
|
// DLLImport only exists on windows, it is implemented as a load from a
|
|
|
|
// DLLIMPORT stub.
|
|
|
|
if (GV->hasDLLImportLinkage())
|
|
|
|
return X86II::MO_DLLIMPORT;
|
|
|
|
|
2010-06-14 20:11:56 +00:00
|
|
|
// Determine whether this is a reference to a definition or a declaration.
|
|
|
|
// Materializable GVs (in JIT lazy compilation mode) do not require an extra
|
|
|
|
// load from stub.
|
|
|
|
bool isDecl = GV->hasAvailableExternallyLinkage();
|
|
|
|
if (GV->isDeclaration() && !GV->isMaterializable())
|
|
|
|
isDecl = true;
|
2009-07-16 22:53:10 +00:00
|
|
|
|
2009-07-10 07:20:05 +00:00
|
|
|
// X86-64 in PIC mode.
|
|
|
|
if (isPICStyleRIPRel()) {
|
|
|
|
// Large model never uses stubs.
|
|
|
|
if (TM.getCodeModel() == CodeModel::Large)
|
|
|
|
return X86II::MO_NO_FLAG;
|
|
|
|
|
2009-07-10 21:01:59 +00:00
|
|
|
if (isTargetDarwin()) {
|
|
|
|
// If symbol visibility is hidden, the extra load is not needed if
|
|
|
|
// target is x86-64 or the symbol is definitely defined in the current
|
|
|
|
// translation unit.
|
|
|
|
if (GV->hasDefaultVisibility() &&
|
2009-07-16 22:53:10 +00:00
|
|
|
(isDecl || GV->isWeakForLinker()))
|
2009-07-10 21:01:59 +00:00
|
|
|
return X86II::MO_GOTPCREL;
|
2010-08-21 17:21:11 +00:00
|
|
|
} else if (!isTargetWin64()) {
|
2009-07-10 21:01:59 +00:00
|
|
|
assert(isTargetELF() && "Unknown rip-relative target");
|
2009-07-10 07:20:05 +00:00
|
|
|
|
2009-07-10 21:01:59 +00:00
|
|
|
// Extra load is needed for all externally visible.
|
|
|
|
if (!GV->hasLocalLinkage() && GV->hasDefaultVisibility())
|
|
|
|
return X86II::MO_GOTPCREL;
|
|
|
|
}
|
2009-07-10 07:20:05 +00:00
|
|
|
|
|
|
|
return X86II::MO_NO_FLAG;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isPICStyleGOT()) { // 32-bit ELF targets.
|
|
|
|
// Extra load is needed for all externally visible.
|
|
|
|
if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
|
|
|
|
return X86II::MO_GOTOFF;
|
|
|
|
return X86II::MO_GOT;
|
|
|
|
}
|
|
|
|
|
2009-07-10 21:00:45 +00:00
|
|
|
if (isPICStyleStubPIC()) { // Darwin/32 in PIC mode.
|
2009-07-10 20:53:38 +00:00
|
|
|
// Determine whether we have a stub reference and/or whether the reference
|
|
|
|
// is relative to the PIC base or not.
|
2009-07-10 07:20:05 +00:00
|
|
|
|
|
|
|
// If this is a strong reference to a definition, it is definitely not
|
|
|
|
// through a stub.
|
2009-07-16 22:53:10 +00:00
|
|
|
if (!isDecl && !GV->isWeakForLinker())
|
2009-07-10 20:53:38 +00:00
|
|
|
return X86II::MO_PIC_BASE_OFFSET;
|
2009-07-10 07:20:05 +00:00
|
|
|
|
|
|
|
// Unless we have a symbol with hidden visibility, we have to go through a
|
|
|
|
// normal $non_lazy_ptr stub because this symbol might be resolved late.
|
2009-07-10 20:53:38 +00:00
|
|
|
if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference.
|
|
|
|
return X86II::MO_DARWIN_NONLAZY_PIC_BASE;
|
|
|
|
|
|
|
|
// If symbol visibility is hidden, we have a stub for common symbol
|
|
|
|
// references and external declarations.
|
2009-07-16 22:53:10 +00:00
|
|
|
if (isDecl || GV->hasCommonLinkage()) {
|
2009-07-10 20:53:38 +00:00
|
|
|
// Hidden $non_lazy_ptr reference.
|
|
|
|
return X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE;
|
2009-07-10 07:20:05 +00:00
|
|
|
}
|
|
|
|
|
2009-07-10 20:53:38 +00:00
|
|
|
// Otherwise, no stub.
|
|
|
|
return X86II::MO_PIC_BASE_OFFSET;
|
|
|
|
}
|
|
|
|
|
2009-07-10 21:00:45 +00:00
|
|
|
if (isPICStyleStubNoDynamic()) { // Darwin/32 in -mdynamic-no-pic mode.
|
2009-07-10 20:53:38 +00:00
|
|
|
// Determine whether we have a stub reference.
|
|
|
|
|
|
|
|
// If this is a strong reference to a definition, it is definitely not
|
|
|
|
// through a stub.
|
2009-07-16 22:53:10 +00:00
|
|
|
if (!isDecl && !GV->isWeakForLinker())
|
2009-07-10 20:53:38 +00:00
|
|
|
return X86II::MO_NO_FLAG;
|
|
|
|
|
|
|
|
// Unless we have a symbol with hidden visibility, we have to go through a
|
|
|
|
// normal $non_lazy_ptr stub because this symbol might be resolved late.
|
|
|
|
if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference.
|
|
|
|
return X86II::MO_DARWIN_NONLAZY;
|
2009-09-03 07:04:02 +00:00
|
|
|
|
2009-07-10 07:20:05 +00:00
|
|
|
// Otherwise, no stub.
|
2009-07-10 20:53:38 +00:00
|
|
|
return X86II::MO_NO_FLAG;
|
2009-07-10 07:20:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Direct static reference to global.
|
|
|
|
return X86II::MO_NO_FLAG;
|
|
|
|
}
|
|
|
|
|
2006-11-30 22:42:55 +00:00
|
|
|
|
2008-09-30 21:22:07 +00:00
|
|
|
/// getBZeroEntry - This function returns the name of a function which has an
|
|
|
|
/// interface like the non-standard bzero function, if such a function exists on
|
|
|
|
/// the current subtarget and it is considered prefereable over memset with zero
|
|
|
|
/// passed as the second argument. Otherwise it returns null.
|
2008-09-30 22:05:33 +00:00
|
|
|
const char *X86Subtarget::getBZeroEntry() const {
|
2008-04-01 20:38:36 +00:00
|
|
|
// Darwin 10 has a __bzero entry point for this purpose.
|
2011-04-20 00:14:25 +00:00
|
|
|
if (getTargetTriple().isMacOSX() &&
|
|
|
|
!getTargetTriple().isMacOSXVersionLT(10, 6))
|
2008-09-30 22:05:33 +00:00
|
|
|
return "__bzero";
|
2008-04-01 20:38:36 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-05-20 04:53:57 +00:00
|
|
|
/// IsLegalToCallImmediateAddr - Return true if the subtarget allows calls
|
|
|
|
/// to immediate address.
|
|
|
|
bool X86Subtarget::IsLegalToCallImmediateAddr(const TargetMachine &TM) const {
|
|
|
|
if (Is64Bit)
|
|
|
|
return false;
|
|
|
|
return isTargetELF() || TM.getRelocationModel() == Reloc::Static;
|
|
|
|
}
|
|
|
|
|
2008-12-16 03:35:01 +00:00
|
|
|
/// getSpecialAddressLatency - For targets where it is beneficial to
|
|
|
|
/// backschedule instructions that compute addresses, return a value
|
|
|
|
/// indicating the number of scheduling cycles of backscheduling that
|
|
|
|
/// should be attempted.
|
|
|
|
unsigned X86Subtarget::getSpecialAddressLatency() const {
|
|
|
|
// For x86 out-of-order targets, back-schedule address computations so
|
|
|
|
// that loads and stores aren't blocked.
|
|
|
|
// This value was chosen arbitrarily.
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2006-01-28 06:05:41 +00:00
|
|
|
/// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the
|
|
|
|
/// specified arguments. If we can't run cpuid on the host, return true.
|
2009-09-03 05:47:34 +00:00
|
|
|
static bool GetCpuIDAndInfo(unsigned value, unsigned *rEAX,
|
|
|
|
unsigned *rEBX, unsigned *rECX, unsigned *rEDX) {
|
2009-08-28 16:06:41 +00:00
|
|
|
#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
|
2009-04-25 18:27:23 +00:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
// gcc doesn't know cpuid would clobber ebx/rbx. Preseve it manually.
|
|
|
|
asm ("movq\t%%rbx, %%rsi\n\t"
|
|
|
|
"cpuid\n\t"
|
|
|
|
"xchgq\t%%rbx, %%rsi\n\t"
|
|
|
|
: "=a" (*rEAX),
|
|
|
|
"=S" (*rEBX),
|
|
|
|
"=c" (*rECX),
|
|
|
|
"=d" (*rEDX)
|
|
|
|
: "a" (value));
|
|
|
|
return false;
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
int registers[4];
|
|
|
|
__cpuid(registers, value);
|
|
|
|
*rEAX = registers[0];
|
|
|
|
*rEBX = registers[1];
|
|
|
|
*rECX = registers[2];
|
|
|
|
*rEDX = registers[3];
|
|
|
|
return false;
|
|
|
|
#endif
|
2006-09-08 06:48:29 +00:00
|
|
|
#elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
|
2009-04-25 18:27:23 +00:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
asm ("movl\t%%ebx, %%esi\n\t"
|
|
|
|
"cpuid\n\t"
|
|
|
|
"xchgl\t%%ebx, %%esi\n\t"
|
|
|
|
: "=a" (*rEAX),
|
|
|
|
"=S" (*rEBX),
|
|
|
|
"=c" (*rECX),
|
|
|
|
"=d" (*rEDX)
|
|
|
|
: "a" (value));
|
|
|
|
return false;
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
__asm {
|
|
|
|
mov eax,value
|
|
|
|
cpuid
|
|
|
|
mov esi,rEAX
|
|
|
|
mov dword ptr [esi],eax
|
|
|
|
mov esi,rEBX
|
|
|
|
mov dword ptr [esi],ebx
|
|
|
|
mov esi,rECX
|
|
|
|
mov dword ptr [esi],ecx
|
|
|
|
mov esi,rEDX
|
|
|
|
mov dword ptr [esi],edx
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
#endif
|
2006-01-27 08:10:46 +00:00
|
|
|
#endif
|
2006-01-28 06:05:41 +00:00
|
|
|
return true;
|
2006-01-27 08:10:46 +00:00
|
|
|
}
|
2006-01-26 09:53:06 +00:00
|
|
|
|
2009-01-02 05:35:45 +00:00
|
|
|
static void DetectFamilyModel(unsigned EAX, unsigned &Family, unsigned &Model) {
|
|
|
|
Family = (EAX >> 8) & 0xf; // Bits 8 - 11
|
|
|
|
Model = (EAX >> 4) & 0xf; // Bits 4 - 7
|
|
|
|
if (Family == 6 || Family == 0xf) {
|
|
|
|
if (Family == 0xf)
|
|
|
|
// Examine extended family ID if family ID is F.
|
|
|
|
Family += (EAX >> 20) & 0xff; // Bits 20 - 27
|
|
|
|
// Examine extended model ID if family ID is 6 or F.
|
|
|
|
Model += ((EAX >> 16) & 0xf) << 4; // Bits 16 - 19
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-06 09:17:41 +00:00
|
|
|
void X86Subtarget::AutoDetectSubtargetFeatures() {
|
2006-01-27 19:30:30 +00:00
|
|
|
unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
|
2006-01-28 18:47:32 +00:00
|
|
|
union {
|
2006-01-28 19:48:34 +00:00
|
|
|
unsigned u[3];
|
|
|
|
char c[12];
|
2006-01-28 18:47:32 +00:00
|
|
|
} text;
|
2006-11-20 18:16:05 +00:00
|
|
|
|
2009-09-03 04:37:05 +00:00
|
|
|
if (GetCpuIDAndInfo(0, &EAX, text.u+0, text.u+2, text.u+1))
|
2006-10-06 08:21:07 +00:00
|
|
|
return;
|
|
|
|
|
2009-09-03 04:37:05 +00:00
|
|
|
GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX);
|
2007-03-23 23:46:48 +00:00
|
|
|
|
2009-09-02 05:53:04 +00:00
|
|
|
if ((EDX >> 15) & 1) HasCMov = true;
|
|
|
|
if ((EDX >> 23) & 1) X86SSELevel = MMX;
|
|
|
|
if ((EDX >> 25) & 1) X86SSELevel = SSE1;
|
|
|
|
if ((EDX >> 26) & 1) X86SSELevel = SSE2;
|
2009-09-03 05:47:34 +00:00
|
|
|
if (ECX & 0x1) X86SSELevel = SSE3;
|
2009-09-02 05:53:04 +00:00
|
|
|
if ((ECX >> 9) & 1) X86SSELevel = SSSE3;
|
|
|
|
if ((ECX >> 19) & 1) X86SSELevel = SSE41;
|
|
|
|
if ((ECX >> 20) & 1) X86SSELevel = SSE42;
|
2010-12-13 04:23:53 +00:00
|
|
|
// FIXME: AVX codegen support is not ready.
|
|
|
|
//if ((ECX >> 28) & 1) { HasAVX = true; X86SSELevel = NoMMXSSE; }
|
2006-01-28 18:09:06 +00:00
|
|
|
|
2009-01-02 05:35:45 +00:00
|
|
|
bool IsIntel = memcmp(text.c, "GenuineIntel", 12) == 0;
|
|
|
|
bool IsAMD = !IsIntel && memcmp(text.c, "AuthenticAMD", 12) == 0;
|
2009-06-26 22:46:54 +00:00
|
|
|
|
2010-07-23 01:17:51 +00:00
|
|
|
HasCLMUL = IsIntel && ((ECX >> 1) & 0x1);
|
|
|
|
HasFMA3 = IsIntel && ((ECX >> 12) & 0x1);
|
2011-05-17 18:33:37 +00:00
|
|
|
HasPOPCNT = IsIntel && ((ECX >> 23) & 0x1);
|
2010-07-23 01:17:51 +00:00
|
|
|
HasAES = IsIntel && ((ECX >> 25) & 0x1);
|
2009-06-26 22:46:54 +00:00
|
|
|
|
2009-01-02 05:35:45 +00:00
|
|
|
if (IsIntel || IsAMD) {
|
|
|
|
// Determine if bit test memory instructions are slow.
|
|
|
|
unsigned Family = 0;
|
|
|
|
unsigned Model = 0;
|
|
|
|
DetectFamilyModel(EAX, Family, Model);
|
|
|
|
IsBTMemSlow = IsAMD || (Family == 6 && Model >= 13);
|
2010-04-01 05:58:17 +00:00
|
|
|
// If it's Nehalem, unaligned memory access is fast.
|
|
|
|
if (Family == 15 && Model == 26)
|
|
|
|
IsUAMemFast = true;
|
2009-01-02 05:35:45 +00:00
|
|
|
|
2009-09-03 04:37:05 +00:00
|
|
|
GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
|
2007-04-16 21:59:44 +00:00
|
|
|
HasX86_64 = (EDX >> 29) & 0x1;
|
2009-05-26 21:04:35 +00:00
|
|
|
HasSSE4A = IsAMD && ((ECX >> 6) & 0x1);
|
2009-06-26 22:46:54 +00:00
|
|
|
HasFMA4 = IsAMD && ((ECX >> 16) & 0x1);
|
2007-04-16 21:59:44 +00:00
|
|
|
}
|
2006-01-26 09:53:06 +00:00
|
|
|
}
|
|
|
|
|
2009-08-02 22:11:08 +00:00
|
|
|
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
2011-06-23 17:54:54 +00:00
|
|
|
bool is64Bit, unsigned StackAlignOverride)
|
2009-08-11 23:01:09 +00:00
|
|
|
: PICStyle(PICStyles::None)
|
2006-09-08 06:48:29 +00:00
|
|
|
, X86SSELevel(NoMMXSSE)
|
2008-04-16 19:03:02 +00:00
|
|
|
, X863DNowLevel(NoThreeDNow)
|
2009-09-02 05:53:04 +00:00
|
|
|
, HasCMov(false)
|
2006-09-08 06:48:29 +00:00
|
|
|
, HasX86_64(false)
|
2010-12-04 23:57:24 +00:00
|
|
|
, HasPOPCNT(false)
|
2009-06-26 22:46:54 +00:00
|
|
|
, HasSSE4A(false)
|
|
|
|
, HasAVX(false)
|
2010-04-02 21:54:27 +00:00
|
|
|
, HasAES(false)
|
2010-07-23 01:17:51 +00:00
|
|
|
, HasCLMUL(false)
|
2009-06-26 22:46:54 +00:00
|
|
|
, HasFMA3(false)
|
|
|
|
, HasFMA4(false)
|
2009-01-02 05:35:45 +00:00
|
|
|
, IsBTMemSlow(false)
|
2010-04-01 05:58:17 +00:00
|
|
|
, IsUAMemFast(false)
|
2010-01-11 16:29:42 +00:00
|
|
|
, HasVectorUAMem(false)
|
2006-09-08 06:48:29 +00:00
|
|
|
, stackAlignment(8)
|
|
|
|
// FIXME: this is a known good value for Yonah. How about others?
|
2007-10-31 11:52:06 +00:00
|
|
|
, MaxInlineSizeThreshold(128)
|
2010-07-05 19:26:33 +00:00
|
|
|
, TargetTriple(TT)
|
|
|
|
, Is64Bit(is64Bit) {
|
2009-06-08 22:53:56 +00:00
|
|
|
|
2006-01-26 09:53:06 +00:00
|
|
|
// Determine default and user specified characteristics
|
2006-10-06 09:17:41 +00:00
|
|
|
if (!FS.empty()) {
|
|
|
|
// If feature string is not empty, parse features string.
|
2009-11-14 10:09:12 +00:00
|
|
|
std::string CPU = sys::getHostCPUName();
|
2006-10-06 09:17:41 +00:00
|
|
|
ParseSubtargetFeatures(FS, CPU);
|
2009-02-02 21:57:34 +00:00
|
|
|
// All X86-64 CPUs also have SSE2, however user might request no SSE via
|
|
|
|
// -mattr, so don't force SSELevel here.
|
2010-12-10 00:26:57 +00:00
|
|
|
if (HasAVX)
|
|
|
|
X86SSELevel = NoMMXSSE;
|
2006-11-20 18:16:05 +00:00
|
|
|
} else {
|
|
|
|
// Otherwise, use CPUID to auto-detect feature set.
|
|
|
|
AutoDetectSubtargetFeatures();
|
2009-02-03 00:04:43 +00:00
|
|
|
// Make sure SSE2 is enabled; it is available on all X86-64 CPUs.
|
2010-12-10 00:26:57 +00:00
|
|
|
if (Is64Bit && !HasAVX && X86SSELevel < SSE2)
|
2009-02-03 00:04:43 +00:00
|
|
|
X86SSELevel = SSE2;
|
2006-09-08 06:48:29 +00:00
|
|
|
}
|
2009-02-03 00:04:43 +00:00
|
|
|
|
2009-02-03 18:53:21 +00:00
|
|
|
// If requesting codegen for X86-64, make sure that 64-bit features
|
|
|
|
// are enabled.
|
2010-03-14 22:39:35 +00:00
|
|
|
if (Is64Bit) {
|
2009-02-03 18:53:21 +00:00
|
|
|
HasX86_64 = true;
|
|
|
|
|
2010-03-14 22:39:35 +00:00
|
|
|
// All 64-bit cpus have cmov support.
|
|
|
|
HasCMov = true;
|
|
|
|
}
|
|
|
|
|
2010-01-05 01:29:13 +00:00
|
|
|
DEBUG(dbgs() << "Subtarget features: SSELevel " << X86SSELevel
|
2009-08-03 00:11:34 +00:00
|
|
|
<< ", 3DNowLevel " << X863DNowLevel
|
|
|
|
<< ", 64bit " << HasX86_64 << "\n");
|
2009-02-03 00:04:43 +00:00
|
|
|
assert((!Is64Bit || HasX86_64) &&
|
|
|
|
"64-bit code requested on a subtarget that doesn't support it!");
|
2006-09-08 06:48:29 +00:00
|
|
|
|
2011-02-22 17:30:05 +00:00
|
|
|
// Stack alignment is 16 bytes on Darwin, FreeBSD, Linux and Solaris (both
|
|
|
|
// 32 and 64 bit) and for all 64-bit targets.
|
2011-06-23 17:54:54 +00:00
|
|
|
if (StackAlignOverride)
|
|
|
|
stackAlignment = StackAlignOverride;
|
|
|
|
else if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() ||
|
|
|
|
isTargetSolaris() || Is64Bit)
|
2005-07-12 01:41:54 +00:00
|
|
|
stackAlignment = 16;
|
2010-05-27 18:43:40 +00:00
|
|
|
}
|