2005-08-04 07:12:09 +00:00
|
|
|
//===-- X86Subtarget.cpp - X86 Subtarget Information ------------*- C++ -*-===//
|
2005-07-12 01:41:54 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Nate Begeman and is distributed under the
|
|
|
|
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the X86 specific subclass of TargetSubtarget.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "X86Subtarget.h"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
2005-09-01 21:38:21 +00:00
|
|
|
X86Subtarget::X86Subtarget(const Module &M, const std::string &FS)
|
2005-11-21 22:43:58 +00:00
|
|
|
: stackAlignment(8), indirectExternAndWeakGlobals(false) {
|
2005-11-21 22:31:58 +00:00
|
|
|
|
|
|
|
// Default to ELF unless otherwise specified.
|
|
|
|
TargetType = isELF;
|
|
|
|
|
2005-07-12 01:41:54 +00:00
|
|
|
// Set the boolean corresponding to the current target triple, or the default
|
|
|
|
// if one cannot be determined, to true.
|
|
|
|
const std::string& TT = M.getTargetTriple();
|
|
|
|
if (TT.length() > 5) {
|
2005-11-21 22:31:58 +00:00
|
|
|
if (TT.find("cygwin") != std::string::npos ||
|
|
|
|
TT.find("mingw") != std::string::npos)
|
|
|
|
TargetType = isCygwin;
|
|
|
|
else if (TT.find("darwin") != std::string::npos)
|
|
|
|
TargetType = isDarwin;
|
|
|
|
else if (TT.find("win32") != std::string::npos)
|
|
|
|
TargetType = isWindows;
|
2005-07-12 01:41:54 +00:00
|
|
|
} else if (TT.empty()) {
|
|
|
|
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
2005-11-21 22:31:58 +00:00
|
|
|
TargetType = isCygwin;
|
2005-07-12 01:41:54 +00:00
|
|
|
#elif defined(__APPLE__)
|
2005-11-21 22:31:58 +00:00
|
|
|
TargetType = isDarwin;
|
2005-07-12 01:41:54 +00:00
|
|
|
#elif defined(_WIN32)
|
2005-11-21 22:31:58 +00:00
|
|
|
TargetType = isWindows;
|
2005-07-12 01:41:54 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-11-21 22:43:58 +00:00
|
|
|
if (TargetType == isDarwin) {
|
2005-07-12 01:41:54 +00:00
|
|
|
stackAlignment = 16;
|
|
|
|
indirectExternAndWeakGlobals = true;
|
|
|
|
}
|
|
|
|
}
|