18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/Support/ErrorHandling.h"
22 using namespace clang;
109 default: llvm_unreachable(
"not an integer!");
127 default: llvm_unreachable(
"not an integer!");
150 default: llvm_unreachable(
"not an integer!");
168 default: llvm_unreachable(
"not an integer!");
183 unsigned BitWidth,
bool IsSigned)
const {
198 bool IsSigned)
const {
237 default: llvm_unreachable(
"not an integer!");
255 default: llvm_unreachable(
"not an integer!");
275 if (Opts.NoBitFieldTypeAlign)
317 const std::vector<std::string> &FeatureVec)
const {
318 for (
const auto &F : FeatureVec) {
321 bool Enabled = Name[0] ==
'+';
331 if (Name[0] ==
'%' || Name[0] ==
'#')
332 Name = Name.substr(1);
342 Name ==
"memory" || Name ==
"cc");
362 if (!Name.getAsInteger(0, n))
363 return n < Names.size();
367 if (std::find(Names.begin(), Names.end(),
Name) != Names.end())
372 for (
const char *AN : ARN.Names) {
377 if (AN == Name && ARN.RegNum < Names.size())
383 for (
const char *A : GRA.Aliases) {
405 if (!Name.getAsInteger(0, n)) {
406 assert(n < Names.size() &&
"Out of bounds register number!");
413 for (
const char *AN : ARN.Names) {
418 if (AN == Name && ARN.RegNum < Names.size())
424 for (
const char *A : RA.Aliases) {
437 if (*Name !=
'=' && *Name !=
'+')
477 if (Name[1] ==
'=' || Name[1] ==
'+')
481 while (Name[1] && Name[1] !=
',')
505 unsigned &Index)
const {
506 assert(*Name ==
'[' &&
"Symbolic name did not start with '['");
508 const char *Start =
Name;
509 while (*Name && *Name !=
']')
517 std::string SymbolicName(Start, Name - Start);
519 for (Index = 0; Index != OutputConstraints.size(); ++Index)
520 if (SymbolicName == OutputConstraints[Index].getName())
538 if (*Name >=
'0' && *Name <=
'9') {
539 const char *DigitStart =
Name;
540 while (Name[1] >=
'0' && Name[1] <=
'9')
542 const char *DigitEnd =
Name;
544 if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
545 .getAsInteger(10, i))
549 if (i >= OutputConstraints.size())
return false;
552 if (OutputConstraints[i].isReadWrite())
581 if (OutputConstraints[Index].isReadWrite())
626 while (Name[1] && Name[1] !=
',')
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]]].
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
virtual ArrayRef< AddlRegName > getGCCAddlRegNames() const
bool validateInputConstraint(MutableArrayRef< ConstraintInfo > OutputConstraints, ConstraintInfo &info) const
TargetInfo(const llvm::Triple &T)
unsigned char LongDoubleAlign
unsigned short SimdDefaultAlign
unsigned char LongDoubleWidth
unsigned char LargeArrayMinWidth
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield...
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
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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.
unsigned char LargeArrayAlign
virtual bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeatureVec) const
Initialize the map with the default set of target features for the CPU this should include all legal ...
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
bool resolveSymbolicName(const char *&Name, ArrayRef< ConstraintInfo > OutputConstraints, unsigned &Index) const
unsigned char DefaultAlignForAttributeAligned
unsigned char PointerWidth
unsigned char SSERegParmMax
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
bool isValidGCCRegisterName(StringRef Name) const
Returns whether the passed in string is a valid register name according to GCC.
Concrete class used by the front-end to report problems and issues.
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 HasBuiltinMSVaList
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
const char * DataLayoutString
virtual void setFeatureEnabled(llvm::StringMap< bool > &Features, StringRef Name, bool Enabled) const
Enable or disable a specific target feature; the feature name must be valid.
The generic Itanium ABI is the standard ABI of most open-source and Unix-like platforms.
virtual ArrayRef< GCCRegAlias > getGCCRegAliases() const =0
virtual 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 ----------------------------—===//
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.
virtual 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.
unsigned Map[Count]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
const llvm::fltSemantics * FloatFormat
unsigned char LongLongAlign
const llvm::fltSemantics * HalfFormat
bool allowsRegister() const
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
StringRef getNormalizedGCCRegisterName(StringRef Name) const
Returns the "normalized" GCC register name.
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target...
Defines the clang::TargetInfo interface.
const llvm::fltSemantics * LongDoubleFormat
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
Control whether the alignment of bit-field types is respected when laying out structures.
unsigned getShortAlign() const
Return the alignment of 'signed short' and 'unsigned short' for this target.
virtual ArrayRef< const char * > getGCCRegNames() const =0
unsigned getLongLongAlign() const
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...