[cfe-commits] r89362 - /cfe/trunk/lib/Basic/Targets.cpp

John Thompson John.Thompson.JTSoftware at gmail.com
Thu Nov 19 09:18:50 PST 2009


Author: jtsoftware
Date: Thu Nov 19 11:18:50 2009
New Revision: 89362

URL: http://llvm.org/viewvc/llvm-project?rev=89362&view=rev
Log:
Added preliminary support step for PS3

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=89362&r1=89361&r2=89362&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Nov 19 11:18:50 2009
@@ -313,6 +313,42 @@
   }
 };
 
+// PS3 PPU Target
+template<typename Target>
+class PS3PPUTargetInfo : public OSTargetInfo<Target> {
+protected:
+  virtual void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+                           std::vector<char> &Defs) const {
+    // PS3 PPU defines.
+    Define(Defs, "__PPU__", "1");
+    Define(Defs, "__CELLOS_LV2__", "1");
+    Define(Defs, "__ELF__", "1");
+  }
+public:
+  PS3PPUTargetInfo(const std::string& triple)
+    : OSTargetInfo<Target>(triple) {
+    this->UserLabelPrefix = "";
+  }
+};
+
+// FIXME: Need a real SPU target.
+// PS3 SPU Target
+template<typename Target>
+class PS3SPUTargetInfo : public OSTargetInfo<Target> {
+protected:
+  virtual void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+                           std::vector<char> &Defs) const {
+    // PS3 PPU defines.
+    Define(Defs, "__SPU__", "1");
+    Define(Defs, "__ELF__", "1");
+  }
+public:
+  PS3SPUTargetInfo(const std::string& triple)
+    : OSTargetInfo<Target>(triple) {
+    this->UserLabelPrefix = "";
+  }
+};
+
 // AuroraUX target
 template<typename Target>
 class AuroraUXTargetInfo : public OSTargetInfo<Target> {
@@ -445,6 +481,11 @@
 
   // FIXME: Should be controlled by command line option.
   Define(Defs, "__LONG_DOUBLE_128__");
+  
+  if (Opts.AltiVec) {
+    Define(Defs, "__VEC__", "10206");
+    Define(Defs, "__ALTIVEC__", "1");
+  }
 }
 
 
@@ -1990,6 +2031,8 @@
   case llvm::Triple::ppc64:
     if (os == llvm::Triple::Darwin)
       return new DarwinTargetInfo<PPC64TargetInfo>(T);
+    else if (os == llvm::Triple::Lv2)
+      return new PS3PPUTargetInfo<PPC64TargetInfo>(T);
     return new PPC64TargetInfo(T);
 
   case llvm::Triple::sparc:
@@ -1999,6 +2042,10 @@
       return new SolarisSparcV8TargetInfo(T);
     return new SparcV8TargetInfo(T);
 
+  // FIXME: Need a real SPU target.
+  case llvm::Triple::cellspu:
+    return new PS3SPUTargetInfo<PPC64TargetInfo>(T);
+
   case llvm::Triple::systemz:
     return new SystemZTargetInfo(T);
 





More information about the cfe-commits mailing list