[cfe-commits] r116989 - /cfe/trunk/lib/Basic/Targets.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Wed Oct 20 20:14:35 PDT 2010
Author: mspencer
Date: Wed Oct 20 22:14:35 2010
New Revision: 116989
URL: http://llvm.org/viewvc/llvm-project?rev=116989&view=rev
Log:
Revert "Cleanup and fix predefined macros for windows."
Didn't realize this was on my branch ;/.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=116989&r1=116988&r2=116989&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Oct 20 22:14:35 2010
@@ -405,54 +405,6 @@
// FIXME: WIntType should be SignedLong
}
};
-
-// Windows target
-template<typename Target>
-class WindowsTargetInfo : public OSTargetInfo<Target> {
-protected:
- virtual void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
- MacroBuilder &Builder) const {
- if (Opts.CPlusPlus) {
- if (Opts.RTTI)
- Builder.defineMacro("_CPPRTTI");
-
- if (Opts.Exceptions)
- Builder.defineMacro("_CPPUNWIND");
- }
-
- if (!Opts.CharIsSigned)
- Builder.defineMacro("_CHAR_UNSIGNED");
-
- // FIXME: POSIXThreads isn't exactly the option this should be defined for,
- // but it works for now.
- if (Opts.POSIXThreads)
- Builder.defineMacro("_MT");
-
- if (Opts.Microsoft) {
- Builder.defineMacro("_MSC_EXTENSIONS");
-
- // Pretend to be the compiler that ships with Visual Studio 2003.
- Builder.defineMacro("_MSC_VER", llvm::Twine(1300));
-
- if (Opts.CPlusPlus0x) {
- Builder.defineMacro("_RVALUE_REFERENCES_V2_SUPPORTED");
- Builder.defineMacro("_RVALUE_REFERENCES_SUPPORTED");
- Builder.defineMacro("_NATIVE_NULLPTR_SUPPORTED");
- }
- }
-
- Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
- Builder.defineMacro("_WIN32");
- }
-
- virtual const char *getVAListDeclaration() const {
- return "typedef char* __builtin_va_list;";
- }
-public:
- WindowsTargetInfo(const std::string &triple)
- : OSTargetInfo<Target>(triple) {}
-};
-
} // end anonymous namespace.
//===----------------------------------------------------------------------===//
@@ -1233,21 +1185,6 @@
break;
}
- if (Opts.Microsoft && PointerWidth == 32) {
- Builder.defineMacro("_M_IX86", "600");
-
- switch (SSELevel) {
- case SSE2:
- Builder.defineMacro("_M_IX86_FP", llvm::Twine(2));
- break;
- case SSE1:
- Builder.defineMacro("_M_IX86_FP", llvm::Twine(1));
- break;
- default:
- Builder.defineMacro("_M_IX86_FP", llvm::Twine(0));
- }
- }
-
// Each case falls through to the previous one here.
switch (AMD3DNowLevel) {
case AMD3DNowAthlon:
@@ -1388,10 +1325,10 @@
namespace {
// x86-32 Windows target
-class WindowsX86_32TargetInfo : public WindowsTargetInfo<X86_32TargetInfo> {
+class WindowsX86_32TargetInfo : public X86_32TargetInfo {
public:
WindowsX86_32TargetInfo(const std::string& triple)
- : WindowsTargetInfo<X86_32TargetInfo>(triple) {
+ : X86_32TargetInfo(triple) {
TLSSupported = false;
WCharType = UnsignedShort;
DoubleAlign = LongLongAlign = 64;
@@ -1399,8 +1336,38 @@
"i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-"
"v128:128:128-a0:0:64-f80:32:32-n8:16:32";
}
+ virtual void getTargetDefines(const LangOptions &Opts,
+ MacroBuilder &Builder) const {
+ X86_32TargetInfo::getTargetDefines(Opts, Builder);
+ // This list is based off of the the list of things MingW defines
+ Builder.defineMacro("_WIN32");
+ DefineStd(Builder, "WIN32", Opts);
+ DefineStd(Builder, "WINNT", Opts);
+ Builder.defineMacro("_X86_");
+ }
+};
+} // end anonymous namespace
+
+namespace {
+
+// x86-32 Windows Visual Studio target
+class VisualStudioWindowsX86_32TargetInfo : public WindowsX86_32TargetInfo {
+public:
+ VisualStudioWindowsX86_32TargetInfo(const std::string& triple)
+ : WindowsX86_32TargetInfo(triple) {
LongDoubleWidth = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+ }
+ virtual void getTargetDefines(const LangOptions &Opts,
+ MacroBuilder &Builder) const {
+ WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
+ // The value of the following reflects processor type.
+ // 300=386, 400=486, 500=Pentium, 600=Blend (default)
+ // We lost the original triple, so we use the default.
+ Builder.defineMacro("_M_IX86", "600");
+ Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
+ Builder.defineMacro("_STDCALL_SUPPORTED");
+ }
};
} // end anonymous namespace
@@ -1507,10 +1474,10 @@
namespace {
// x86-64 Windows target
-class WindowsX86_64TargetInfo : public WindowsTargetInfo<X86_64TargetInfo> {
+class WindowsX86_64TargetInfo : public X86_64TargetInfo {
public:
WindowsX86_64TargetInfo(const std::string& triple)
- : WindowsTargetInfo<X86_64TargetInfo>(triple) {
+ : X86_64TargetInfo(triple) {
TLSSupported = false;
WCharType = UnsignedShort;
LongWidth = LongAlign = 32;
@@ -1524,11 +1491,25 @@
}
virtual void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
- WindowsTargetInfo<X86_64TargetInfo>::getTargetDefines(Opts, Builder);
-
+ X86_64TargetInfo::getTargetDefines(Opts, Builder);
Builder.defineMacro("_WIN64");
+ DefineStd(Builder, "WIN64", Opts);
+ }
+};
+} // end anonymous namespace
+
+namespace {
+// x86-64 Windows Visual Studio target
+class VisualStudioWindowsX86_64TargetInfo : public WindowsX86_64TargetInfo {
+public:
+ VisualStudioWindowsX86_64TargetInfo(const std::string& triple)
+ : WindowsX86_64TargetInfo(triple) {
+ }
+ virtual void getTargetDefines(const LangOptions &Opts,
+ MacroBuilder &Builder) const {
+ WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
Builder.defineMacro("_M_X64");
- Builder.defineMacro("_M_AMD64");
+ Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
}
virtual const char *getVAListDeclaration() const {
return "typedef char* __builtin_va_list;";
@@ -2542,7 +2523,7 @@
case llvm::Triple::MinGW32:
return new MinGWX86_32TargetInfo(T);
case llvm::Triple::Win32:
- return new WindowsX86_32TargetInfo(T);
+ return new VisualStudioWindowsX86_32TargetInfo(T);
case llvm::Triple::Haiku:
return new HaikuX86_32TargetInfo(T);
default:
@@ -2570,7 +2551,7 @@
case llvm::Triple::MinGW64:
return new MinGWX86_64TargetInfo(T);
case llvm::Triple::Win32: // This is what Triple.h supports now.
- return new WindowsX86_64TargetInfo(T);
+ return new VisualStudioWindowsX86_64TargetInfo(T);
default:
return new X86_64TargetInfo(T);
}
More information about the cfe-commits
mailing list