18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/Support/ErrorHandling.h"
22 using namespace clang;
45 if (T.isGNUEnvironment())
46 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
119 default: llvm_unreachable(
"not an integer!");
137 default: llvm_unreachable(
"not an integer!");
162 default: llvm_unreachable(
"not an integer!");
180 default: llvm_unreachable(
"not an integer!");
195 unsigned BitWidth,
bool IsSigned)
const {
210 bool IsSigned)
const {
251 default: llvm_unreachable(
"not an integer!");
269 default: llvm_unreachable(
"not an integer!");
290 if (Opts.NoBitFieldTypeAlign)
294 if (Opts.AlignDouble) {
320 assert(MaxPointerWidth == 32 || MaxPointerWidth == 64);
321 bool Is32BitArch = MaxPointerWidth == 32;
334 if (Opts.NewAlignOverride)
340 const std::vector<std::string> &FeatureVec)
const {
341 for (
const auto &F : FeatureVec) {
344 bool Enabled = Name[0] ==
'+';
354 if (Name[0] ==
'%' || Name[0] ==
'#')
355 Name = Name.substr(1);
365 Name ==
"memory" || Name ==
"cc");
385 if (!Name.getAsInteger(0, n))
386 return n < Names.size();
390 if (std::find(Names.begin(), Names.end(),
Name) != Names.end())
395 for (
const char *AN : ARN.Names) {
400 if (AN == Name && ARN.RegNum < Names.size())
406 for (
const char *A : GRA.Aliases) {
417 bool ReturnCanonical)
const {
428 if (!Name.getAsInteger(0, n)) {
429 assert(n < Names.size() &&
"Out of bounds register number!");
436 for (
const char *AN : ARN.Names) {
441 if (AN == Name && ARN.RegNum < Names.size())
442 return ReturnCanonical ? Names[ARN.RegNum] : Name;
447 for (
const char *A : RA.Aliases) {
460 if (*Name !=
'=' && *Name !=
'+')
500 if (Name[1] ==
'=' || Name[1] ==
'+')
504 while (Name[1] && Name[1] !=
',')
533 unsigned &Index)
const {
534 assert(*Name ==
'[' &&
"Symbolic name did not start with '['");
536 const char *Start =
Name;
537 while (*Name && *Name !=
']')
545 std::string SymbolicName(Start, Name - Start);
547 for (Index = 0; Index != OutputConstraints.size(); ++Index)
548 if (SymbolicName == OutputConstraints[Index].getName())
566 if (*Name >=
'0' && *Name <=
'9') {
567 const char *DigitStart =
Name;
568 while (Name[1] >=
'0' && Name[1] <=
'9')
570 const char *DigitEnd =
Name;
572 if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
573 .getAsInteger(10, i))
577 if (i >= OutputConstraints.size())
return false;
580 if (OutputConstraints[i].isReadWrite())
609 if (OutputConstraints[Index].isReadWrite())
654 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].
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
Represents a version number in the form major[.minor[.subminor[.build]]].
virtual void adjust(LangOptions &Opts)
Set forced language options.
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
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
unsigned char MinGlobalAlign
const llvm::fltSemantics * Float128Format
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
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
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.
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 Map[FirstTargetAddressSpace]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
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.
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
unsigned IsRenderScriptTarget
const LangAS::Map * AddrSpaceMap
bool allowsMemory() const
unsigned char DoubleAlign
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.
const llvm::fltSemantics * FloatFormat
unsigned char LongLongAlign
const llvm::fltSemantics * HalfFormat
StringRef getNormalizedGCCRegisterName(StringRef Name, bool ReturnCanonical=false) const
Returns the "normalized" GCC register name.
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...
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 Float128Align
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...