[cfe-commits] r65696 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Basic/TargetInfo.cpp lib/Basic/Targets.cpp

Anders Carlsson andersca at mac.com
Sat Feb 28 09:11:49 PST 2009


Author: andersca
Date: Sat Feb 28 11:11:49 2009
New Revision: 65696

URL: http://llvm.org/viewvc/llvm-project?rev=65696&view=rev
Log:
TargetInfo::validateAsmConstraint now takes a reference to the full constraints string. This will make it possible to support multi-character constraints. No functionality change (for now).

Modified:
    cfe/trunk/include/clang/Basic/TargetInfo.h
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=65696&r1=65695&r2=65696&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sat Feb 28 11:11:49 2009
@@ -263,7 +263,7 @@
                               unsigned &NumNames) const = 0;
   virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, 
                                 unsigned &NumAliases) const = 0;
-  virtual bool validateAsmConstraint(char c, 
+  virtual bool validateAsmConstraint(const char *&Name, 
                                      TargetInfo::ConstraintInfo &info) const= 0;
 };
 

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=65696&r1=65695&r2=65696&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Sat Feb 28 11:11:49 2009
@@ -180,7 +180,7 @@
   while (*Name) {
     switch (*Name) {
     default:
-      if (!validateAsmConstraint(*Name, info)) {
+      if (!validateAsmConstraint(Name, info)) {
         // FIXME: We temporarily return false
         // so we can add more constraints as we hit it.
         // Eventually, an unknown constraint should just be treated as 'g'.
@@ -258,7 +258,7 @@
         // The constraint should have the same info as the respective 
         // output constraint.
         info = (ConstraintInfo)(info|OutputConstraints[i]);
-      } else if (!validateAsmConstraint(*Name, info)) {
+      } else if (!validateAsmConstraint(Name, info)) {
         // FIXME: This error return is in place temporarily so we can
         // add more constraints as we hit it.  Eventually, an unknown
         // constraint should just be treated as 'g'.

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=65696&r1=65695&r2=65696&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Feb 28 11:11:49 2009
@@ -279,9 +279,9 @@
                               unsigned &NumNames) const;
   virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, 
                                 unsigned &NumAliases) const;
-  virtual bool validateAsmConstraint(char c,
+  virtual bool validateAsmConstraint(const char *&Name,
                                      TargetInfo::ConstraintInfo &info) const {
-    switch (c) {
+    switch (*Name) {
     default: return false;
     case 'O': // Zero
       return true;
@@ -491,7 +491,7 @@
     Aliases = GCCRegAliases;
     NumAliases = llvm::array_lengthof(GCCRegAliases);
   }
-  virtual bool validateAsmConstraint(char c,
+  virtual bool validateAsmConstraint(const char *&Name,
                                      TargetInfo::ConstraintInfo &info) const;
   virtual std::string convertConstraint(const char Constraint) const;
   virtual const char *getClobbers() const {
@@ -500,9 +500,9 @@
 };
   
 bool
-X86TargetInfo::validateAsmConstraint(char c,
+X86TargetInfo::validateAsmConstraint(const char *&Name,
                                      TargetInfo::ConstraintInfo &info) const {
-  switch (c) {
+  switch (*Name) {
   default: return false;
   case 'a': // eax.
   case 'b': // ebx.
@@ -782,10 +782,10 @@
     Aliases = 0;
     NumAliases = 0;
   }
-  virtual bool validateAsmConstraint(char c,
+  virtual bool validateAsmConstraint(const char *&Name,
                                      TargetInfo::ConstraintInfo &info) const {
     // FIXME: Check if this is complete
-    switch (c) {
+    switch (*Name) {
     default:
     case 'l': // r0-r7
     case 'h': // r8-r15
@@ -847,7 +847,7 @@
                               unsigned &NumNames) const;
   virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, 
                                 unsigned &NumAliases) const;
-  virtual bool validateAsmConstraint(char c,
+  virtual bool validateAsmConstraint(const char *&Name,
                                      TargetInfo::ConstraintInfo &info) const {
     // FIXME: Implement!
     return false;
@@ -958,7 +958,7 @@
     virtual const char *getTargetPrefix() const {return "";}
     virtual void getGCCRegNames(const char * const *&Names, 
                                 unsigned &NumNames) const {} 
-    virtual bool validateAsmConstraint(char c, 
+    virtual bool validateAsmConstraint(const char *&Name, 
                                        TargetInfo::ConstraintInfo &info) const {
       return true;
     }





More information about the cfe-commits mailing list