Index: cmake/modules/GetTargetTriple.cmake
===================================================================
--- cmake/modules/GetTargetTriple.cmake	(revision 79556)
+++ cmake/modules/GetTargetTriple.cmake	(working copy)
@@ -4,9 +4,9 @@
 function( get_target_triple var )
   if( MSVC )
     if( CMAKE_CL_64 )
-      set( ${var} "x86_64-pc-win32" PARENT_SCOPE )
+      set( ${var} "x86_64-pc-win64-vc" PARENT_SCOPE )
     else()
-      set( ${var} "i686-pc-win32" PARENT_SCOPE )
+      set( ${var} "i686-pc-win32-vc" PARENT_SCOPE )
     endif()
   elseif( MINGW AND NOT MSYS )
     set( ${var} "i686-pc-mingw32" PARENT_SCOPE )
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h	(revision 79556)
+++ include/llvm/ADT/Triple.h	(working copy)
@@ -90,8 +90,13 @@
     NetBSD,
     OpenBSD,
     Solaris,
-    Win32
+    Win32,
+    Win64
   };
+  enum EnvironmentType {
+    UnknownEnvironment,
+    VisualStudio
+  };
   
 private:
   std::string Data;
@@ -105,6 +110,9 @@
   /// The parsed OS type.
   mutable OSType OS;
 
+  /// The parsed environment type.
+  mutable EnvironmentType Environment;
+
   bool isInitialized() const { return Arch != InvalidArch; }
   void Parse() const;
 
@@ -115,12 +123,22 @@
   Triple() : Data(), Arch(InvalidArch) {}
   explicit Triple(const StringRef &Str) : Data(Str), Arch(InvalidArch) {}
   explicit Triple(const char *ArchStr, const char *VendorStr, const char *OSStr)
-    : Data(ArchStr), Arch(InvalidArch) {
+    : Data(ArchStr), Arch(InvalidArch), Environment(UnknownEnvironment) {
     Data += '-';
     Data += VendorStr;
     Data += '-';
     Data += OSStr;
   }
+  explicit Triple(const char *ArchStr, const char *VendorStr,
+      const char *OSStr, const char *EnvironmentStr)
+    : Data(ArchStr), Arch(InvalidArch), Environment(UnknownEnvironment) {
+    Data += '-';
+    Data += VendorStr;
+    Data += '-';
+    Data += OSStr;
+    Data += '-';
+    Data += EnvironmentStr;
+  }
 
   /// @}
   /// @name Typed Component Access
@@ -143,6 +161,12 @@
     if (!isInitialized()) Parse(); 
     return OS;
   }
+  
+  /// getEnvironment - Get the parsed environment type of this triple.
+  EnvironmentType getEnvironment() const { 
+    if (!isInitialized()) Parse(); 
+    return Environment;
+  }
 
   /// hasEnvironment - Does this triple have the optional environment
   /// (fourth) component?
@@ -207,6 +231,10 @@
   /// to a known type.
   void setOS(OSType Kind);
 
+  /// setEnv - Set the optional environment (forth) component of the triple
+  /// to a known type.
+  void setEnvironment(EnvironmentType Kind);
+
   /// setTriple - Set all components to the new triple \arg Str.
   void setTriple(const Twine &Str);
 
@@ -242,9 +270,12 @@
   /// vendor.
   static const char *getVendorTypeName(VendorType Kind);
 
-  /// getOSTypeName - Get the canonical name for the \arg Kind vendor.
+  /// getOSTypeName - Get the canonical name for the \arg Kind OS.
   static const char *getOSTypeName(OSType Kind);
 
+  /// getEnvironmentTypeName - Get the canonical name for the \arg Kind environment.
+  static const char *getEnvironmentTypeName(EnvironmentType Kind);
+
   /// getArchTypeForLLVMName - The canonical type for the given LLVM
   /// architecture name (e.g., "x86").
   static ArchType getArchTypeForLLVMName(const StringRef &Str);
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp	(revision 79556)
+++ lib/Support/Triple.cpp	(working copy)
@@ -70,11 +70,22 @@
   case OpenBSD: return "openbsd";
   case Solaris: return "solaris";
   case Win32: return "win32";
+  case Win64: return "win64";
   }
 
   return "<invalid>";
 }
 
+const char *Triple::getEnvironmentTypeName(EnvironmentType Kind)
+{
+  switch (Kind) {
+  case UnknownEnvironment: return "unknown";
+  case VisualStudio: return "vc";
+  }
+
+  return "<invalid>";
+}
+
 Triple::ArchType Triple::getArchTypeForLLVMName(const StringRef &Name) {
   if (Name == "alpha")
     return alpha;
@@ -122,6 +133,7 @@
   StringRef ArchName = getArchName();
   StringRef VendorName = getVendorName();
   StringRef OSName = getOSName();
+  StringRef EnvironmentName = getEnvironmentName();
 
   if (ArchName.size() == 4 && ArchName[0] == 'i' && 
       ArchName[2] == '8' && ArchName[3] == '6' && 
@@ -211,9 +223,16 @@
     OS = Solaris;
   else if (OSName.startswith("win32"))
     OS = Win32;
+  else if (OSName.startswith("win64"))
+    OS = Win64;
   else
     OS = UnknownOS;
 
+  if (EnvironmentName.startswith("vc"))
+    Environment = VisualStudio;
+  else
+    Environment = UnknownEnvironment;
+
   assert(isInitialized() && "Failed to initialize!");
 }
 
@@ -325,6 +344,10 @@
   setOSName(getOSTypeName(Kind));
 }
 
+void Triple::setEnvironment(EnvironmentType Kind) {
+  setEnvironmentName(getEnvironmentTypeName(Kind));
+}
+
 void Triple::setArchName(const StringRef &Str) {
   setTriple(Str + "-" + getVendorName() + "-" + getOSAndEnvironmentName());
 }
