diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-26 07:16:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-26 07:16:29 +0000 |
commit | 44def070435a2b5d67f0534f7a3a85a7389d60f2 (patch) | |
tree | ad98260329c0c7d84376df4dfb481471b98935de /lib/Basic/TargetInfo.cpp | |
parent | e60ee1d46aac435154682f4ebba724f24d4b0184 (diff) |
change TargetInfo::ConstraintInfo to be a struct that contains
the enum along with some other data.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/TargetInfo.cpp')
-rw-r--r-- | lib/Basic/TargetInfo.cpp | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index b66e26f3a9..cee13eab41 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -164,24 +164,19 @@ const char *TargetInfo::getNormalizedGCCRegisterName(const char *Name) const { } bool TargetInfo::validateOutputConstraint(const char *Name, - ConstraintInfo &info) const -{ - info = CI_None; - + ConstraintInfo &Info) const { // An output constraint must start with '=' or '+' if (*Name != '=' && *Name != '+') return false; if (*Name == '+') - info = CI_ReadWrite; - else - info = CI_None; + Info.setIsReadWrite(); 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'. @@ -190,14 +185,15 @@ bool TargetInfo::validateOutputConstraint(const char *Name, case '&': // early clobber. break; case 'r': // general register. - info = (ConstraintInfo)(info|CI_AllowsRegister); + Info.setAllowsRegister(); break; case 'm': // memory operand. - info = (ConstraintInfo)(info|CI_AllowsMemory); + Info.setAllowsMemory(); break; case 'g': // general register, memory operand or immediate integer. case 'X': // any operand. - info = (ConstraintInfo)(info|CI_AllowsMemory|CI_AllowsRegister); + Info.setAllowsRegister(); + Info.setAllowsMemory(); break; } @@ -210,10 +206,8 @@ bool TargetInfo::validateOutputConstraint(const char *Name, bool TargetInfo::resolveSymbolicName(const char *&Name, const std::string *OutputNamesBegin, const std::string *OutputNamesEnd, - unsigned &Index) const -{ + unsigned &Index) const { assert(*Name == '[' && "Symbolic name did not start with '['"); - Name++; const char *Start = Name; while (*Name && *Name != ']') @@ -240,10 +234,8 @@ bool TargetInfo::resolveSymbolicName(const char *&Name, bool TargetInfo::validateInputConstraint(const char *Name, const std::string *OutputNamesBegin, const std::string *OutputNamesEnd, - ConstraintInfo* OutputConstraints, - ConstraintInfo &info) const { - info = CI_None; - + ConstraintInfo *OutputConstraints, + ConstraintInfo &Info) const { while (*Name) { switch (*Name) { default: @@ -258,8 +250,9 @@ 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)) { + Info = OutputConstraints[i]; + Info.setTiedOperand(i); + } 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'. @@ -281,14 +274,15 @@ bool TargetInfo::validateInputConstraint(const char *Name, case 'n': // immediate integer with a known value. break; case 'r': // general register. - info = (ConstraintInfo)(info|CI_AllowsRegister); + Info.setAllowsRegister(); break; case 'm': // memory operand. - info = (ConstraintInfo)(info|CI_AllowsMemory); + Info.setAllowsMemory(); break; case 'g': // general register, memory operand or immediate integer. case 'X': // any operand. - info = (ConstraintInfo)(info|CI_AllowsMemory|CI_AllowsRegister); + Info.setAllowsRegister(); + Info.setAllowsMemory(); break; } |