From: Anders Carlsson Date: Sat, 28 Feb 2009 17:11:49 +0000 (+0000) Subject: TargetInfo::validateAsmConstraint now takes a reference to the full constraints strin... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=066d2ea7521896efc05cce7aa46fdd3a7ba96c28;p=clang 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65696 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 633bacf196..00edc57547 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -263,7 +263,7 @@ protected: 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; }; diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index 82b6c190cd..923a75d622 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -180,7 +180,7 @@ bool TargetInfo::validateOutputConstraint(const char *Name, 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 @@ bool TargetInfo::validateInputConstraint(const char *Name, // 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'. diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 1aa82829bb..ef17d2d342 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -279,9 +279,9 @@ public: 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 @@ public: 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 @@ public: }; 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 @@ public: 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 @@ public: 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 @@ namespace { 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; }