18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/Support/ErrorHandling.h"
22 using namespace clang;
111 default: llvm_unreachable(
"not an integer!");
129 default: llvm_unreachable(
"not an integer!");
152 default: llvm_unreachable(
"not an integer!");
170 default: llvm_unreachable(
"not an integer!");
185 unsigned BitWidth,
bool IsSigned)
const {
200 bool IsSigned)
const {
241 default: llvm_unreachable(
"not an integer!");
259 default: llvm_unreachable(
"not an integer!");
279 if (Opts.NoBitFieldTypeAlign)
283 if (Opts.AlignDouble) {
325 const std::vector<std::string> &FeatureVec)
const {
326 for (
const auto &F : FeatureVec) {
329 bool Enabled = Name[0] ==
'+';
339 if (Name[0] ==
'%' || Name[0] ==
'#')
340 Name = Name.substr(1);
350 Name ==
"memory" || Name ==
"cc");
370 if (!Name.getAsInteger(0, n))
371 return n < Names.size();
375 if (std::find(Names.begin(), Names.end(),
Name) != Names.end())
380 for (
const char *AN : ARN.Names) {
385 if (AN == Name && ARN.RegNum < Names.size())
391 for (
const char *A : GRA.Aliases) {
413 if (!Name.getAsInteger(0, n)) {
414 assert(n < Names.size() &&
"Out of bounds register number!");
421 for (
const char *AN : ARN.Names) {
426 if (AN == Name && ARN.RegNum < Names.size())
432 for (
const char *A : RA.Aliases) {
445 if (*Name !=
'=' && *Name !=
'+')
485 if (Name[1] ==
'=' || Name[1] ==
'+')
489 while (Name[1] && Name[1] !=
',')
513 unsigned &Index)
const {
514 assert(*Name ==
'[' &&
"Symbolic name did not start with '['");
516 const char *Start =
Name;
517 while (*Name && *Name !=
']')
525 std::string SymbolicName(Start, Name - Start);
527 for (Index = 0; Index != OutputConstraints.size(); ++Index)
528 if (SymbolicName == OutputConstraints[Index].getName())
546 if (*Name >=
'0' && *Name <=
'9') {
547 const char *DigitStart =
Name;
548 while (Name[1] >=
'0' && Name[1] <=
'9')
550 const char *DigitEnd =
Name;
552 if (StringRef(DigitStart, DigitEnd - DigitStart + 1)
553 .getAsInteger(10, i))
557 if (i >= OutputConstraints.size())
return false;
560 if (OutputConstraints[i].isReadWrite())
589 if (OutputConstraints[Index].isReadWrite())
634 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 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. ...
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
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 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.
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.
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 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...