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

Eli Friedman eli.friedman at gmail.com
Wed Aug 20 00:28:15 PDT 2008


Author: efriedma
Date: Wed Aug 20 02:28:14 2008
New Revision: 55041

URL: http://llvm.org/viewvc/llvm-project?rev=55041&view=rev
Log:
Class hierarchy reorg for Sparc architecture.  While I was there, I 
cleaned it up a bit, including fixing the definition of va_list; this
shouldn't break anything, but anyone using Sparc should watch for 
regressions.


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=55041&r1=55040&r2=55041&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 20 02:28:14 2008
@@ -58,23 +58,12 @@
   }
 
 };
+}
 
-
-class SolarisTargetInfo : public TargetInfo {
-public:
-  SolarisTargetInfo(const std::string& triple) : TargetInfo(triple) {}
-  
-  virtual void getTargetDefines(std::vector<char> &Defs) const {
-// FIXME: we need a real target configuration system.  For now, only define
-// __SUN__ if the host has it.
-#ifdef __SUN__
-    Define(Defs, "__SUN__");
-    Define(Defs, "__SOLARIS__");
-#endif
-  }
-
-};
-} // end anonymous namespace.
+static void getSolarisDefines(std::vector<char> &Defs) {
+  Define(Defs, "__SUN__");
+  Define(Defs, "__SOLARIS__");
+}
 
 static void getDarwinDefines(std::vector<char> &Defs) {
   Define(Defs, "__APPLE__");
@@ -363,20 +352,6 @@
   Define(Defs, "__LDBL_MIN__", "2.2250738585072014e-308");
 }
 
-static const char* getI386VAListDeclaration() {
-  return "typedef char* __builtin_va_list;";
-}
-
-static const char* getX86_64VAListDeclaration() {
-  return 
-    "typedef struct __va_list_tag {"
-    "  unsigned gp_offset;"
-    "  unsigned fp_offset;"
-    "  void* overflow_arg_area;"
-    "  void* reg_save_area;"
-    "} __builtin_va_list[1];";
-}
-
 static const char* getPPCVAListDeclaration() {
   return 
     "typedef struct __va_list_tag {"
@@ -696,7 +671,6 @@
     return std::string(1, Constraint);
   }
 }
-
 } // end anonymous namespace
 
 namespace {
@@ -709,7 +683,7 @@
     LongDoubleAlign = 32;
   }
   virtual const char *getVAListDeclaration() const {
-    return getI386VAListDeclaration();
+    return "typedef char* __builtin_va_list;";
   }
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     getX86Defines(Defines, false);
@@ -742,7 +716,12 @@
     LongDoubleAlign = 128;
   }
   virtual const char *getVAListDeclaration() const {
-    return getX86_64VAListDeclaration();
+    return "typedef struct __va_list_tag {"
+           "  unsigned gp_offset;"
+           "  unsigned fp_offset;"
+           "  void* overflow_arg_area;"
+           "  void* reg_save_area;"
+           "} __builtin_va_list[1];";
   }
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     getX86Defines(Defines, true);
@@ -815,46 +794,65 @@
 } // end anonymous namespace.
 
 namespace {
-class SolarisSparcV8TargetInfo : public SolarisTargetInfo {
+class SparcV8TargetInfo : public TargetInfo {
 public:
-  SolarisSparcV8TargetInfo(const std::string& triple) : SolarisTargetInfo(triple) {}
-  
+  SparcV8TargetInfo(const std::string& triple) : TargetInfo(triple) {
+    // FIXME: Support Sparc quad-precision long double?
+  }
   virtual void getTargetDefines(std::vector<char> &Defines) const {
-    SolarisTargetInfo::getTargetDefines(Defines);
-//    getSparcDefines(Defines, false);
+    // FIXME: This is missing a lot of important defines; some of the
+    // missing stuff is likely to break system headers.
     Define(Defines, "__sparc");
     Define(Defines, "__sparc__");
     Define(Defines, "__sparcv8");
   }
   virtual void getTargetBuiltins(const Builtin::Info *&Records,
                                  unsigned &NumRecords) const {
-    PPC::getBuiltins(Records, NumRecords);
+    // FIXME: Implement!
   }
   virtual const char *getVAListDeclaration() const {
-    return getPPCVAListDeclaration();
+    return "typedef void* __builtin_va_list;";
   }
   virtual const char *getTargetPrefix() const {
-    return PPC::getTargetPrefix();
+    return "sparc";
   }
   virtual void getGCCRegNames(const char * const *&Names, 
                               unsigned &NumNames) const {
-    PPC::getGCCRegNames(Names, NumNames);
+    // FIXME: Implement!
+    Names = 0;
+    NumNames = 0;
   }
   virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, 
                                 unsigned &NumAliases) const {
-    PPC::getGCCRegAliases(Aliases, NumAliases);
+    // FIXME: Implement!
+    Aliases = 0;
+    NumAliases = 0;
   }
   virtual bool validateAsmConstraint(char c,
                                      TargetInfo::ConstraintInfo &info) const {
-    return PPC::validateAsmConstraint(c, info);
+    // FIXME: Implement!
+    return false;
   }
   virtual const char *getClobbers() const {
-    return PPC::getClobbers();
+    // FIXME: Implement!
+    return "";
   }
 };
 
 } // end anonymous namespace.
 
+namespace {
+class SolarisSparcV8TargetInfo : public SparcV8TargetInfo {
+public:
+  SolarisSparcV8TargetInfo(const std::string& triple) :
+    SparcV8TargetInfo(triple) {}
+
+  virtual void getTargetDefines(std::vector<char> &Defines) const {
+    SparcV8TargetInfo::getTargetDefines(Defines);
+    getSolarisDefines(Defines);
+  }
+};
+} // end anonymous namespace.
 
 namespace {
   class PIC16TargetInfo : public TargetInfo{





More information about the cfe-commits mailing list