1 //===-- X86Subtarget.cpp - X86 Subtarget Information ------------*- 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 implements the X86 specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #include "X86Subtarget.h"
15 #include "llvm/Module.h"
18 X86Subtarget::X86Subtarget(const Module &M, const std::string &FS)
19 : stackAlignment(8), indirectExternAndWeakGlobals(false) {
21 // Default to ELF unless otherwise specified.
24 // Set the boolean corresponding to the current target triple, or the default
25 // if one cannot be determined, to true.
26 const std::string& TT = M.getTargetTriple();
27 if (TT.length() > 5) {
28 if (TT.find("cygwin") != std::string::npos ||
29 TT.find("mingw") != std::string::npos)
30 TargetType = isCygwin;
31 else if (TT.find("darwin") != std::string::npos)
32 TargetType = isDarwin;
33 else if (TT.find("win32") != std::string::npos)
34 TargetType = isWindows;
35 } else if (TT.empty()) {
36 #if defined(__CYGWIN__) || defined(__MINGW32__)
37 TargetType = isCygwin;
38 #elif defined(__APPLE__)
39 TargetType = isDarwin;
41 TargetType = isWindows;
45 if (TargetType == isDarwin) {
47 indirectExternAndWeakGlobals = true;