18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/Support/ErrorHandling.h"
22 using namespace clang;
108 default: llvm_unreachable(
"not an integer!");
126 default: llvm_unreachable(
"not an integer!");
149 default: llvm_unreachable(
"not an integer!");
167 default: llvm_unreachable(
"not an integer!");
182 unsigned BitWidth,
bool IsSigned)
const {
197 bool IsSigned)
const {
236 default: llvm_unreachable(
"not an integer!");
254 default: llvm_unreachable(
"not an integer!");
274 if (Opts.NoBitFieldTypeAlign)
318 if (Name[0] ==
'%' || Name[0] ==
'#')
319 Name = Name.substr(1);
329 Name ==
"memory" || Name ==
"cc");
339 const char *
const *Names;
352 if (!Name.getAsInteger(0, n))
353 return n >= 0 && (
unsigned)n < NumNames;
357 for (
unsigned i = 0; i < NumNames; i++) {
358 if (Name == Names[i])
364 unsigned NumAddlNames;
366 for (
unsigned i = 0; i < NumAddlNames; i++)
367 for (
unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
368 if (!AddlNames[i].Names[j])
372 if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < NumNames)
381 for (
unsigned i = 0; i < NumAliases; i++) {
382 for (
unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
383 if (!Aliases[i].Aliases[j])
385 if (Aliases[i].Aliases[j] == Name)
400 const char *
const *Names;
408 if (!Name.getAsInteger(0, n)) {
409 assert(n >= 0 && (
unsigned)n < NumNames &&
410 "Out of bounds register number!");
417 unsigned NumAddlNames;
419 for (
unsigned i = 0; i < NumAddlNames; i++)
420 for (
unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
421 if (!AddlNames[i].Names[j])
425 if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < NumNames)
434 for (
unsigned i = 0; i < NumAliases; i++) {
435 for (
unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
436 if (!Aliases[i].Aliases[j])
438 if (Aliases[i].Aliases[j] == Name)
439 return Aliases[i].Register;
449 if (*Name !=
'=' && *Name !=
'+')
489 if (Name[1] ==
'=' || Name[1] ==
'+')
493 while (Name[1] && Name[1] !=
',')
518 unsigned &Index)
const {
519 assert(*Name ==
'[' &&
"Symbolic name did not start with '['");
521 const char *Start = Name;
522 while (*Name && *Name !=
']')
530 std::string SymbolicName(Start, Name - Start);
532 for (Index = 0; Index != NumOutputs; ++Index)
533 if (SymbolicName == OutputConstraints[Index].getName())
551 if (*Name >=
'0' && *Name <=
'9') {
552 const char *DigitStart = Name;
553 while (Name[1] >=
'0' && Name[1] <=
'9')
555 const char *DigitEnd = Name;
557 if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
558 .getAsInteger(10, i))
562 if (i >= NumOutputs)
return false;
565 if (OutputConstraints[i].isReadWrite())
594 if (OutputConstraints[Index].isReadWrite())
639 while (Name[1] && Name[1] !=
',')
655 const Kind unknown =
static_cast<Kind>(-1);
656 Kind kind = llvm::StringSwitch<Kind>(name)
663 if (kind == unknown)
return false;
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
static LLVM_READONLY bool isDigit(unsigned char c)
Return true if this character is an ASCII digit: [0-9].
Represents a version number in the form major[.minor[.subminor[.build]]].
bool resolveSymbolicName(const char *&Name, ConstraintInfo *OutputConstraints, unsigned NumOutputs, unsigned &Index) const
virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const =0
const llvm::fltSemantics * DoubleFormat
unsigned short MaxVectorAlign
unsigned char LongLongWidth
bool validateOutputConstraint(ConstraintInfo &Info) const
TargetInfo(const llvm::Triple &T)
unsigned char LongDoubleAlign
unsigned short SimdDefaultAlign
unsigned char LongDoubleWidth
unsigned char LargeArrayMinWidth
unsigned ZeroLengthBitfieldBoundary
const std::string & getConstraintStr() const
virtual void adjust(const LangOptions &Opts)
Set forced language options.
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
unsigned char MinGlobalAlign
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
const char * getTypeConstantSuffix(IntType T) const
Return the constant suffix for the specified integer type enum.
const char * DescriptionString
unsigned char LargeArrayAlign
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
unsigned char MaxAtomicPromoteWidth
unsigned char DefaultAlignForAttributeAligned
unsigned char PointerWidth
unsigned char SSERegParmMax
bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
static const LangAS::Map DefaultAddrSpaceMap
unsigned char DoubleWidth
VersionTuple PlatformMinVersion
unsigned ComplexLongDoubleUsesFP2Ret
unsigned RealTypeUsesObjCFPRet
Provides definitions for the various language-specific address spaces.
unsigned getCharAlign() const
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
unsigned HasAlignMac68kSupport
Defines the clang::LangOptions interface.
const char * UserLabelPrefix
bool isValidClobber(StringRef Name) const
Returns whether the passed in string is a valid clobber in an inline asm statement.
std::string ConstraintStr
static StringRef removeGCCRegisterPrefix(StringRef Name)
unsigned getTiedOperand() const
unsigned getIntAlign() const
static const char * getTypeName(IntType T)
Return the user string for the specified integer type enum.
unsigned getLongAlign() const
unsigned getTypeAlign(IntType T) const
Return the alignment (in bits) of the specified integer type enum.
const LangAS::Map * AddrSpaceMap
bool allowsMemory() const
unsigned char DoubleAlign
bool tryParse(llvm::StringRef name)
Try to parse an ABI name, returning false on error.
IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
unsigned char PointerAlign
unsigned char SuitableAlign
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Kind
The basic C++ ABI kind.
const llvm::fltSemantics & getLongDoubleFormat() const
static const char * getTypeFormatModifier(IntType T)
Return the printf format modifier for the specified integer type enum.
unsigned getCharWidth() const
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand...
unsigned getShortWidth() const
Return the size of 'signed short' and 'unsigned short' for this target, in bits.
IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return the smallest integer type with at least the specified width.
unsigned UseSignedCharForObjCBool
Whether Objective-C's built-in boolean type should be signed char.
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, unsigned &NumAliases) const =0
const llvm::fltSemantics * FloatFormat
unsigned char LongLongAlign
const llvm::fltSemantics * HalfFormat
bool allowsRegister() const
unsigned getIntWidth() const
unsigned getLongLongWidth() const
virtual void getGCCAddlRegNames(const AddlRegName *&Addl, unsigned &NumAddl) const
virtual void getGCCRegNames(const char *const *&Names, unsigned &NumNames) const =0
unsigned kind
All of the diagnostics that can be emitted by the frontend.
StringRef getNormalizedGCCRegisterName(StringRef Name) const
Returns the "normalized" GCC register name.
unsigned getLongWidth() const
Defines the clang::TargetInfo interface.
const llvm::fltSemantics * LongDoubleFormat
bool validateInputConstraint(ConstraintInfo *OutputConstraints, unsigned NumOutputs, ConstraintInfo &info) const
unsigned char MaxAtomicInlineWidth
void setTiedOperand(unsigned N, ConstraintInfo &Output)
Indicate that this is an input operand that is tied to the specified output operand.
unsigned short MaxTLSAlign
unsigned UseBitFieldTypeAlignment
unsigned getShortAlign() const
Return the alignment of 'signed short' and 'unsigned short' for this target.
unsigned getLongLongAlign() const
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...