aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-08-21 01:40:19 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-08-21 01:40:19 +0000
commit29a305067d2ff1213a98ddff11ba99e28760ef74 (patch)
treea3f42b0a5cf0e4a41c4faf063c35bf9cb29f9c97 /lib/Basic/Targets.cpp
parent0d4047b9a0e6c3b4bbe3df53b2dd59dfb3a2170c (diff)
Initial implementation of Windows x86 target; at the moment, the only
difference from generic x86 is the defines. The rest is non-trivial to implement. I'm not planning on adding any more targets myself; if there are any targets anyone is currently using that are missing, feel free to add them, or ask me to add them. This concludes the work I'm planning for the TargetInfo implementations at the moment; all the other issues with TargetInfo require some API changes, and I haven't really thought it through. Some of the remaining issues: allowing targets to define size_t and wchar_t properly, adding some sort of __builtin_type_info intrinsic so we can finish clang's limits.h and float.h and get rid of a massive number of macro definitions, allowing target-specific command-line options, allowing target-specific defaults for certain command-line options like -fms-extensions, exposing vector alignment outside of the description string, exposing endianness outside of the description string, allowing targets to expose special bit-field layout requirements, exposing some sort of custom hook for call generation in CodeGen, and adding CPU selection to control defines like __SSE__. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r--lib/Basic/Targets.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 73bffd9d31..761bbcbbf1 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -673,6 +673,33 @@ public:
} // end anonymous namespace
namespace {
+// x86-32 Windows target
+class WindowsX86_32TargetInfo : public X86_32TargetInfo {
+public:
+ WindowsX86_32TargetInfo(const std::string& triple)
+ : X86_32TargetInfo(triple) {
+ // FIXME: Fix wchar_t.
+ // FIXME: We should probably enable -fms-extensions by default for
+ // this target.
+ }
+ virtual void getTargetDefines(std::vector<char> &Defines) const {
+ X86_32TargetInfo::getTargetDefines(Defines);
+ // This list is based off of the the list of things MingW defines
+ Define(Defines, "__WIN32__");
+ Define(Defines, "__WIN32");
+ Define(Defines, "_WIN32");
+ Define(Defines, "WIN32");
+ Define(Defines, "__WINNT__");
+ Define(Defines, "__WINNT");
+ Define(Defines, "WINNT");
+ Define(Defines, "_WIN32");
+ Define(Defines, "_X86_");
+ Define(Defines, "__MSVCRT__");
+ }
+};
+} // end anonymous namespace
+
+namespace {
// x86-64 generic target
class X86_64TargetInfo : public X86TargetInfo {
public:
@@ -935,6 +962,8 @@ TargetInfo* TargetInfo::CreateTargetInfo(const std::string &T) {
return new DarwinI386TargetInfo(T);
if (isLinux)
return new LinuxX86_32TargetInfo(T);
+ if (isWindows)
+ return new WindowsX86_32TargetInfo(T);
return new X86_32TargetInfo(T);
}