Changes in directory llvm/lib/Target/X86:
X86Subtarget.cpp updated: 1.6 -> 1.7 X86Subtarget.h updated: 1.5 -> 1.6 --- Log message: Make the X86 subtarget compute the basic target type: ELF, Cygwin, Darwin, or native Win32 --- Diffs of the changes: (+24 -15) X86Subtarget.cpp | 35 ++++++++++++++++++++--------------- X86Subtarget.h | 4 ++++ 2 files changed, 24 insertions(+), 15 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.6 llvm/lib/Target/X86/X86Subtarget.cpp:1.7 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.6 Thu Sep 1 16:38:21 2005 +++ llvm/lib/Target/X86/X86Subtarget.cpp Mon Nov 21 16:31:58 2005 @@ -21,37 +21,42 @@ 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; } } Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.5 llvm/lib/Target/X86/X86Subtarget.h:1.6 --- llvm/lib/Target/X86/X86Subtarget.h:1.5 Thu Sep 1 16:38:21 2005 +++ llvm/lib/Target/X86/X86Subtarget.h Mon Nov 21 16:31:58 2005 @@ -38,6 +38,10 @@ bool asmPrintDotLCommConstants; bool asmPrintConstantAlignment; public: + enum { + isELF, isCygwin, isDarwin, isWindows + } TargetType; + /// This constructor initializes the data members to match that /// of the specified module. /// _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits