diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Basic/TargetInfo.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Basic/TargetInfo.cpp | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/contrib/llvm/tools/clang/lib/Basic/TargetInfo.cpp b/contrib/llvm/tools/clang/lib/Basic/TargetInfo.cpp index 6d42883..a9eeb8b 100644 --- a/contrib/llvm/tools/clang/lib/Basic/TargetInfo.cpp +++ b/contrib/llvm/tools/clang/lib/Basic/TargetInfo.cpp @@ -15,6 +15,7 @@ #include "clang/Basic/LangOptions.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/STLExtras.h" +#include <cctype> #include <cstdlib> using namespace clang; @@ -25,6 +26,7 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) { TLSSupported = true; NoAsmVariants = false; PointerWidth = PointerAlign = 32; + BoolWidth = BoolAlign = 8; IntWidth = IntAlign = 32; LongWidth = LongAlign = 32; LongLongWidth = LongLongAlign = 64; @@ -54,6 +56,7 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) { DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-" "i64:64:64-f32:32:32-f64:64:64-n32"; UserLabelPrefix = "_"; + MCountName = "mcount"; HasAlignMac68kSupport = false; // Default to no types using fpret. @@ -98,7 +101,7 @@ const char *TargetInfo::getTypeConstantSuffix(IntType T) { } } -/// getTypeWidth - Return the width (in bits) of the specified integer type +/// getTypeWidth - Return the width (in bits) of the specified integer type /// enum. For example, SignedInt -> getIntWidth(). unsigned TargetInfo::getTypeWidth(IntType T) const { switch (T) { @@ -114,7 +117,7 @@ unsigned TargetInfo::getTypeWidth(IntType T) const { }; } -/// getTypeAlign - Return the alignment (in bits) of the specified integer type +/// getTypeAlign - Return the alignment (in bits) of the specified integer type /// enum. For example, SignedInt -> getIntAlign(). unsigned TargetInfo::getTypeAlign(IntType T) const { switch (T) { @@ -132,18 +135,18 @@ unsigned TargetInfo::getTypeAlign(IntType T) const { /// isTypeSigned - Return whether an integer types is signed. Returns true if /// the type is signed; false otherwise. -bool TargetInfo::isTypeSigned(IntType T) const { +bool TargetInfo::isTypeSigned(IntType T) { switch (T) { default: assert(0 && "not an integer!"); case SignedShort: case SignedInt: case SignedLong: - case SignedLongLong: + case SignedLongLong: return true; case UnsignedShort: case UnsignedInt: case UnsignedLong: - case UnsignedLongLong: + case UnsignedLongLong: return false; }; } @@ -164,7 +167,7 @@ void TargetInfo::setForcedLangOptions(LangOptions &Opts) { static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) { if (Name[0] == '%' || Name[0] == '#') Name = Name.substr(1); - + return Name; } @@ -174,7 +177,7 @@ static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) { bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const { if (Name.empty()) return false; - + const char * const *Names; unsigned NumNames; @@ -216,7 +219,7 @@ bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const { return false; } -llvm::StringRef +llvm::StringRef TargetInfo::getNormalizedGCCRegisterName(llvm::StringRef Name) const { assert(isValidGCCRegisterName(Name) && "Invalid register passed in"); @@ -283,6 +286,10 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const { Info.setAllowsRegister(); break; case 'm': // memory operand. + case 'o': // offsetable memory operand. + case 'V': // non-offsetable memory operand. + case '<': // autodecrement memory operand. + case '>': // autoincrement memory operand. Info.setAllowsMemory(); break; case 'g': // general register, memory operand or immediate integer. @@ -291,13 +298,12 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const { Info.setAllowsMemory(); break; case ',': // multiple alternative constraint. Pass it. - Name++; // Handle additional optional '=' or '+' modifiers. - if (*Name == '=' || *Name == '+') + if (Name[1] == '=' || Name[1] == '+') Name++; break; case '?': // Disparage slightly code. - case '!': // Disparage severly. + case '!': // Disparage severely. break; // Pass them. } @@ -347,6 +353,15 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints, if (i >= NumOutputs) return false; + // A number must refer to an output only operand. + if (OutputConstraints[i].isReadWrite()) + return false; + + // If the constraint is already tied, it must be tied to the + // same operand referenced to by the number. + if (Info.hasTiedOperand() && Info.getTiedOperand() != i) + return false; + // The constraint should have the same info as the respective // output constraint. Info.setTiedOperand(i, OutputConstraints[i]); @@ -362,6 +377,11 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints, if (!resolveSymbolicName(Name, OutputConstraints, NumOutputs, Index)) return false; + // If the constraint is already tied, it must be tied to the + // same operand referenced to by the number. + if (Info.hasTiedOperand() && Info.getTiedOperand() != Index) + return false; + Info.setTiedOperand(Index, OutputConstraints[Index]); break; } @@ -384,8 +404,10 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints, Info.setAllowsRegister(); break; case 'm': // memory operand. - case 'o': // offsettable memory operand - case 'V': // non-offsettable memory operand + case 'o': // offsettable memory operand. + case 'V': // non-offsettable memory operand. + case '<': // autodecrement memory operand. + case '>': // autoincrement memory operand. Info.setAllowsMemory(); break; case 'g': // general register, memory operand or immediate integer. @@ -393,6 +415,10 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints, Info.setAllowsRegister(); Info.setAllowsMemory(); break; + case 'E': // immediate floating point. + case 'F': // immediate floating point. + case 'p': // address operand. + break; case ',': // multiple alternative constraint. Ignore comma. break; case '?': // Disparage slightly code. |