1 //===- X86Subtarget.cpp - X86 Instruction 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)
19 : TargetSubtarget(), stackAlignment(8),
20 indirectExternAndWeakGlobals(false), asmDarwinLinkerStubs(false),
21 asmLeadingUnderscore(false), asmAlignmentIsInBytes(false),
22 asmPrintDotLocalConstants(false), asmPrintDotLCommConstants(false),
23 asmPrintConstantAlignment(false) {
24 // Declare a boolean for each major platform.
25 bool forCygwin = false;
26 bool forDarwin = false;
27 bool forWindows = false;
29 // Set the boolean corresponding to the current target triple, or the default
30 // if one cannot be determined, to true.
31 const std::string& TT = M.getTargetTriple();
32 if (TT.length() > 5) {
33 forCygwin = TT.find("cygwin") != std::string::npos ||
34 TT.find("mingw") != std::string::npos;
35 forDarwin = TT.find("darwin") != std::string::npos;
36 forWindows = TT.find("win32") != std::string::npos;
37 } else if (TT.empty()) {
38 #if defined(__CYGWIN__) || defined(__MINGW32__)
40 #elif defined(__APPLE__)
48 asmLeadingUnderscore = true;
49 } else if (forDarwin) {
51 indirectExternAndWeakGlobals = true;
52 asmDarwinLinkerStubs = true;
53 asmLeadingUnderscore = true;
54 asmPrintDotLCommConstants = true;
55 } else if (forWindows) {