diff options
author | Chris Lattner <sabre@nondot.org> | 2005-11-21 22:31:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-11-21 22:31:58 +0000 |
commit | e5600e5509be43097e5f3b7e0f5d33305dc77630 (patch) | |
tree | 186184584670310eba7d16674c51f4f0a46843c3 /lib/Target/X86/X86Subtarget.cpp | |
parent | 5df14ca0a1264ace774cc9eb7d6dcb493e8256c4 (diff) | |
download | external_llvm-e5600e5509be43097e5f3b7e0f5d33305dc77630.zip external_llvm-e5600e5509be43097e5f3b7e0f5d33305dc77630.tar.gz external_llvm-e5600e5509be43097e5f3b7e0f5d33305dc77630.tar.bz2 |
Make the X86 subtarget compute the basic target type: ELF, Cygwin, Darwin,
or native Win32
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86Subtarget.cpp')
-rw-r--r-- | lib/Target/X86/X86Subtarget.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index 7a4a178..b05e674 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -21,37 +21,42 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS) asmLeadingUnderscore(false), asmAlignmentIsInBytes(false), asmPrintDotLocalConstants(false), asmPrintDotLCommConstants(false), asmPrintConstantAlignment(false) { - // Declare a boolean for each major platform. - bool forCygwin = false; - bool forDarwin = false; - bool forWindows = false; - + + // Default to ELF unless otherwise specified. + TargetType = isELF; + // 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; + 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; } else if (TT.empty()) { #if defined(__CYGWIN__) || defined(__MINGW32__) - forCygwin = true; + TargetType = isCygwin; #elif defined(__APPLE__) - forDarwin = true; + TargetType = isDarwin; #elif defined(_WIN32) - forWindows = true; + TargetType = isWindows; #endif } - if (forCygwin) { + switch (TargetType) { + case isCygwin: asmLeadingUnderscore = true; - } else if (forDarwin) { + break; + case isDarwin: stackAlignment = 16; indirectExternAndWeakGlobals = true; asmDarwinLinkerStubs = true; asmLeadingUnderscore = true; asmPrintDotLCommConstants = true; - } else if (forWindows) { + break; + default: break; } } |