2005-08-04 15:12:09 +08:00
|
|
|
//===-- X86Subtarget.cpp - X86 Subtarget Information ------------*- C++ -*-===//
|
2005-07-12 09:41:54 +08: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-02 05:38:21 +08:00
|
|
|
X86Subtarget::X86Subtarget(const Module &M, const std::string &FS)
|
2005-07-27 14:12:32 +08:00
|
|
|
: TargetSubtarget(), stackAlignment(8),
|
2005-07-12 09:41:54 +08:00
|
|
|
indirectExternAndWeakGlobals(false), asmDarwinLinkerStubs(false),
|
|
|
|
asmLeadingUnderscore(false), asmAlignmentIsInBytes(false),
|
|
|
|
asmPrintDotLocalConstants(false), asmPrintDotLCommConstants(false),
|
|
|
|
asmPrintConstantAlignment(false) {
|
2005-07-12 10:36:10 +08:00
|
|
|
// Declare a boolean for each major platform.
|
2005-07-12 09:41:54 +08:00
|
|
|
bool forCygwin = false;
|
|
|
|
bool forDarwin = false;
|
|
|
|
bool forWindows = false;
|
2005-07-27 14:12:32 +08:00
|
|
|
|
2005-07-12 09:41:54 +08: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) {
|
|
|
|
forCygwin = TT.find("cygwin") != std::string::npos ||
|
|
|
|
TT.find("mingw") != std::string::npos;
|
|
|
|
forDarwin = TT.find("darwin") != std::string::npos;
|
|
|
|
forWindows = TT.find("win32") != std::string::npos;
|
|
|
|
} else if (TT.empty()) {
|
|
|
|
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
|
|
|
forCygwin = true;
|
|
|
|
#elif defined(__APPLE__)
|
|
|
|
forDarwin = true;
|
|
|
|
#elif defined(_WIN32)
|
2005-07-12 10:36:10 +08:00
|
|
|
forWindows = true;
|
2005-07-12 09:41:54 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (forCygwin) {
|
|
|
|
asmLeadingUnderscore = true;
|
2005-07-12 10:36:10 +08:00
|
|
|
} else if (forDarwin) {
|
2005-07-12 09:41:54 +08:00
|
|
|
stackAlignment = 16;
|
|
|
|
indirectExternAndWeakGlobals = true;
|
|
|
|
asmDarwinLinkerStubs = true;
|
|
|
|
asmLeadingUnderscore = true;
|
|
|
|
asmPrintDotLCommConstants = true;
|
2005-07-12 10:36:10 +08:00
|
|
|
} else if (forWindows) {
|
2005-07-12 09:41:54 +08:00
|
|
|
}
|
|
|
|
}
|