Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Lex/LiteralSupport.h
//===--- LiteralSupport.h ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the NumericLiteralParser, CharLiteralParser, and // StringLiteralParser interfaces. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LEX_LITERALSUPPORT_H #define LLVM_CLANG_LEX_LITERALSUPPORT_H #include "clang/Basic/CharInfo.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/TokenKinds.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" namespace clang { class DiagnosticsEngine; class Preprocessor; class Token; class SourceLocation; class TargetInfo; class SourceManager; class LangOptions; /// Copy characters from Input to Buf, expanding any UCNs. void expandUCNs(SmallVectorImpl<char> &Buf, StringRef Input); /// NumericLiteralParser - This performs strict semantic analysis of the content /// of a ppnumber, classifying it as either integer, floating, or erroneous, /// determines the radix of the value and can convert it to a useful value. class NumericLiteralParser { Preprocessor &PP; // needed for diagnostics const char *const ThisTokBegin; const char *const ThisTokEnd; const char *DigitsBegin, *SuffixBegin; // markers const char *s; // cursor unsigned radix; bool saw_exponent, saw_period, saw_ud_suffix, saw_inf; SmallString<32> UDSuffixBuf; public: NumericLiteralParser(StringRef TokSpelling, SourceLocation TokLoc, Preprocessor &PP); bool hadError : 1; bool isUnsigned : 1; bool isLong : 1; // This is *not* set for long long. bool isLongLong : 1; bool isFloat : 1; // 1.0f // HLSL Change Begin bool isHalf : 1; // 1.0h // HLSL Change End bool isImaginary : 1; // 1.0i uint8_t MicrosoftInteger; // Microsoft suffix extension i8, i16, i32, or i64. bool isIntegerLiteral() const { return !saw_period && !saw_exponent; } bool isFloatingLiteral() const { return saw_period || saw_exponent; } bool hasUDSuffix() const { return saw_ud_suffix; } StringRef getUDSuffix() const { assert(saw_ud_suffix); return UDSuffixBuf; } unsigned getUDSuffixOffset() const { assert(saw_ud_suffix); return SuffixBegin - ThisTokBegin; } static bool isValidUDSuffix(const LangOptions &LangOpts, StringRef Suffix); unsigned getRadix() const { return radix; } /// GetIntegerValue - Convert this numeric literal value to an APInt that /// matches Val's input width. If there is an overflow (i.e., if the unsigned /// value read is larger than the APInt's bits will hold), set Val to the low /// bits of the result and return true. Otherwise, return false. bool GetIntegerValue(llvm::APInt &Val); /// GetFloatValue - Convert this numeric literal to a floating value, using /// the specified APFloat fltSemantics (specifying float, double, etc). /// The optional bool isExact (passed-by-reference) has its value /// set to true if the returned APFloat can represent the number in the /// literal exactly, and false otherwise. llvm::APFloat::opStatus GetFloatValue(llvm::APFloat &Result); private: void ParseNumberStartingWithZero(SourceLocation TokLoc); static bool isDigitSeparator(char C) { return C == '\''; } enum CheckSeparatorKind { CSK_BeforeDigits, CSK_AfterDigits }; /// \brief Ensure that we don't have a digit separator here. void checkSeparator(SourceLocation TokLoc, const char *Pos, CheckSeparatorKind IsAfterDigits); /// SkipHexDigits - Read and skip over any hex digits, up to End. /// Return a pointer to the first non-hex digit or End. const char *SkipHexDigits(const char *ptr) { while (ptr != ThisTokEnd && (isHexDigit(*ptr) || isDigitSeparator(*ptr))) ptr++; return ptr; } /// SkipOctalDigits - Read and skip over any octal digits, up to End. /// Return a pointer to the first non-hex digit or End. const char *SkipOctalDigits(const char *ptr) { while (ptr != ThisTokEnd && ((*ptr >= '0' && *ptr <= '7') || isDigitSeparator(*ptr))) ptr++; return ptr; } /// SkipDigits - Read and skip over any digits, up to End. /// Return a pointer to the first non-hex digit or End. const char *SkipDigits(const char *ptr) { while (ptr != ThisTokEnd && (isDigit(*ptr) || isDigitSeparator(*ptr))) ptr++; return ptr; } /// SkipBinaryDigits - Read and skip over any binary digits, up to End. /// Return a pointer to the first non-binary digit or End. const char *SkipBinaryDigits(const char *ptr) { while (ptr != ThisTokEnd && (*ptr == '0' || *ptr == '1' || isDigitSeparator(*ptr))) ptr++; return ptr; } }; /// CharLiteralParser - Perform interpretation and semantic analysis of a /// character literal. class CharLiteralParser { uint64_t Value; tok::TokenKind Kind; bool IsMultiChar; bool HadError; SmallString<32> UDSuffixBuf; unsigned UDSuffixOffset; public: CharLiteralParser(const char *begin, const char *end, SourceLocation Loc, Preprocessor &PP, tok::TokenKind kind); bool hadError() const { return HadError; } bool isAscii() const { return Kind == tok::char_constant; } bool isWide() const { return Kind == tok::wide_char_constant; } bool isUTF16() const { return Kind == tok::utf16_char_constant; } bool isUTF32() const { return Kind == tok::utf32_char_constant; } bool isMultiChar() const { return IsMultiChar; } uint64_t getValue() const { return Value; } StringRef getUDSuffix() const { return UDSuffixBuf; } unsigned getUDSuffixOffset() const { assert(!UDSuffixBuf.empty() && "no ud-suffix"); return UDSuffixOffset; } }; /// StringLiteralParser - This decodes string escape characters and performs /// wide string analysis and Translation Phase #6 (concatenation of string /// literals) (C99 5.1.1.2p1). class StringLiteralParser { const SourceManager &SM; const LangOptions &Features; const TargetInfo &Target; DiagnosticsEngine *Diags; unsigned MaxTokenLength; unsigned SizeBound; unsigned CharByteWidth; tok::TokenKind Kind; SmallString<512> ResultBuf; char *ResultPtr; // cursor SmallString<32> UDSuffixBuf; unsigned UDSuffixToken; unsigned UDSuffixOffset; public: StringLiteralParser(ArrayRef<Token> StringToks, Preprocessor &PP, bool Complain = true); StringLiteralParser(ArrayRef<Token> StringToks, const SourceManager &sm, const LangOptions &features, const TargetInfo &target, DiagnosticsEngine *diags = nullptr) : SM(sm), Features(features), Target(target), Diags(diags), MaxTokenLength(0), SizeBound(0), CharByteWidth(0), Kind(tok::unknown), ResultPtr(ResultBuf.data()), hadError(false), Pascal(false) { init(StringToks); } bool hadError; bool Pascal; StringRef GetString() const { return StringRef(ResultBuf.data(), GetStringLength()); } unsigned GetStringLength() const { return ResultPtr-ResultBuf.data(); } unsigned GetNumStringChars() const { return GetStringLength() / CharByteWidth; } /// getOffsetOfStringByte - This function returns the offset of the /// specified byte of the string data represented by Token. This handles /// advancing over escape sequences in the string. /// /// If the Diagnostics pointer is non-null, then this will do semantic /// checking of the string literal and emit errors and warnings. unsigned getOffsetOfStringByte(const Token &TheTok, unsigned ByteNo) const; bool isAscii() const { return Kind == tok::string_literal; } bool isWide() const { return Kind == tok::wide_string_literal; } bool isUTF8() const { return Kind == tok::utf8_string_literal; } bool isUTF16() const { return Kind == tok::utf16_string_literal; } bool isUTF32() const { return Kind == tok::utf32_string_literal; } bool isPascal() const { return Pascal; } StringRef getUDSuffix() const { return UDSuffixBuf; } /// Get the index of a token containing a ud-suffix. unsigned getUDSuffixToken() const { assert(!UDSuffixBuf.empty() && "no ud-suffix"); return UDSuffixToken; } /// Get the spelling offset of the first byte of the ud-suffix. unsigned getUDSuffixOffset() const { assert(!UDSuffixBuf.empty() && "no ud-suffix"); return UDSuffixOffset; } private: void init(ArrayRef<Token> StringToks); bool CopyStringFragment(const Token &Tok, const char *TokBegin, StringRef Fragment); void DiagnoseLexingError(SourceLocation Loc); }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Lex/MacroArgs.h
//===--- MacroArgs.h - Formal argument info for Macros ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the MacroArgs interface. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LEX_MACROARGS_H #define LLVM_CLANG_LEX_MACROARGS_H #include "clang/Basic/LLVM.h" #include "clang/Lex/Token.h" #include "llvm/ADT/ArrayRef.h" #include <vector> namespace clang { class MacroInfo; class Preprocessor; class SourceLocation; /// MacroArgs - An instance of this class captures information about /// the formal arguments specified to a function-like macro invocation. class MacroArgs { /// NumUnexpArgTokens - The number of raw, unexpanded tokens for the /// arguments. All of the actual argument tokens are allocated immediately /// after the MacroArgs object in memory. This is all of the arguments /// concatenated together, with 'EOF' markers at the end of each argument. unsigned NumUnexpArgTokens; /// VarargsElided - True if this is a C99 style varargs macro invocation and /// there was no argument specified for the "..." argument. If the argument /// was specified (even empty) or this isn't a C99 style varargs function, or /// if in strict mode and the C99 varargs macro had only a ... argument, this /// is false. bool VarargsElided; /// PreExpArgTokens - Pre-expanded tokens for arguments that need them. Empty /// if not yet computed. This includes the EOF marker at the end of the /// stream. std::vector<std::vector<Token> > PreExpArgTokens; /// StringifiedArgs - This contains arguments in 'stringified' form. If the /// stringified form of an argument has not yet been computed, this is empty. std::vector<Token> StringifiedArgs; /// ArgCache - This is a linked list of MacroArgs objects that the /// Preprocessor owns which we use to avoid thrashing malloc/free. MacroArgs *ArgCache; MacroArgs(unsigned NumToks, bool varargsElided) : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided), ArgCache(nullptr) {} ~MacroArgs() = default; public: /// MacroArgs ctor function - Create a new MacroArgs object with the specified /// macro and argument info. static MacroArgs *create(const MacroInfo *MI, ArrayRef<Token> UnexpArgTokens, bool VarargsElided, Preprocessor &PP); /// destroy - Destroy and deallocate the memory for this object. /// void destroy(Preprocessor &PP); /// ArgNeedsPreexpansion - If we can prove that the argument won't be affected /// by pre-expansion, return false. Otherwise, conservatively return true. bool ArgNeedsPreexpansion(const Token *ArgTok, Preprocessor &PP) const; /// getUnexpArgument - Return a pointer to the first token of the unexpanded /// token list for the specified formal. /// const Token *getUnexpArgument(unsigned Arg) const; /// getArgLength - Given a pointer to an expanded or unexpanded argument, /// return the number of tokens, not counting the EOF, that make up the /// argument. static unsigned getArgLength(const Token *ArgPtr); /// getPreExpArgument - Return the pre-expanded form of the specified /// argument. const std::vector<Token> & getPreExpArgument(unsigned Arg, const MacroInfo *MI, Preprocessor &PP); /// getStringifiedArgument - Compute, cache, and return the specified argument /// that has been 'stringified' as required by the # operator. const Token &getStringifiedArgument(unsigned ArgNo, Preprocessor &PP, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd); /// getNumArguments - Return the number of arguments passed into this macro /// invocation. unsigned getNumArguments() const { return NumUnexpArgTokens; } /// isVarargsElidedUse - Return true if this is a C99 style varargs macro /// invocation and there was no argument specified for the "..." argument. If /// the argument was specified (even empty) or this isn't a C99 style varargs /// function, or if in strict mode and the C99 varargs macro had only a ... /// argument, this returns false. bool isVarargsElidedUse() const { return VarargsElided; } /// StringifyArgument - Implement C99 6.10.3.2p2, converting a sequence of /// tokens into the literal string token that should be produced by the C # /// preprocessor operator. If Charify is true, then it should be turned into /// a character literal for the Microsoft charize (#@) extension. /// static Token StringifyArgument(const Token *ArgToks, Preprocessor &PP, bool Charify, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd); /// deallocate - This should only be called by the Preprocessor when managing /// its freelist. MacroArgs *deallocate(); }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Lex/ScratchBuffer.h
//===--- ScratchBuffer.h - Scratch space for forming tokens -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the ScratchBuffer interface. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LEX_SCRATCHBUFFER_H #define LLVM_CLANG_LEX_SCRATCHBUFFER_H #include "clang/Basic/SourceLocation.h" namespace clang { class SourceManager; /// ScratchBuffer - This class exposes a simple interface for the dynamic /// construction of tokens. This is used for builtin macros (e.g. __LINE__) as /// well as token pasting, etc. class ScratchBuffer { SourceManager &SourceMgr; char *CurBuffer; SourceLocation BufferStartLoc; unsigned BytesUsed; public: ScratchBuffer(SourceManager &SM); /// getToken - Splat the specified text into a temporary MemoryBuffer and /// return a SourceLocation that refers to the token. This is just like the /// previous method, but returns a location that indicates the physloc of the /// token. SourceLocation getToken(const char *Buf, unsigned Len, const char *&DestPtr); private: void AllocScratchBuffer(unsigned RequestLen); }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Lex/PTHManager.h
//===--- PTHManager.h - Manager object for PTH processing -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the PTHManager interface. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LEX_PTHMANAGER_H #define LLVM_CLANG_LEX_PTHMANAGER_H #include "clang/Basic/Diagnostic.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LangOptions.h" #include "clang/Lex/PTHLexer.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/OnDiskHashTable.h" #include <string> namespace llvm { class MemoryBuffer; } namespace clang { class FileEntry; class PTHLexer; class DiagnosticsEngine; class FileSystemStatCache; class PTHManager : public IdentifierInfoLookup { friend class PTHLexer; friend class PTHStatCache; class PTHStringLookupTrait; class PTHFileLookupTrait; typedef llvm::OnDiskChainedHashTable<PTHStringLookupTrait> PTHStringIdLookup; typedef llvm::OnDiskChainedHashTable<PTHFileLookupTrait> PTHFileLookup; /// The memory mapped PTH file. std::unique_ptr<const llvm::MemoryBuffer> Buf; /// Alloc - Allocator used for IdentifierInfo objects. llvm::BumpPtrAllocator Alloc; /// IdMap - A lazily generated cache mapping from persistent identifiers to /// IdentifierInfo*. std::unique_ptr<IdentifierInfo *[], llvm::FreeDeleter> PerIDCache; /// FileLookup - Abstract data structure used for mapping between files /// and token data in the PTH file. std::unique_ptr<PTHFileLookup> FileLookup; /// IdDataTable - Array representing the mapping from persistent IDs to the /// data offset within the PTH file containing the information to /// reconsitute an IdentifierInfo. const unsigned char* const IdDataTable; /// SortedIdTable - Abstract data structure mapping from strings to /// persistent IDs. This is used by get(). std::unique_ptr<PTHStringIdLookup> StringIdLookup; /// NumIds - The number of identifiers in the PTH file. const unsigned NumIds; /// PP - The Preprocessor object that will use this PTHManager to create /// PTHLexer objects. Preprocessor* PP; /// SpellingBase - The base offset within the PTH memory buffer that /// contains the cached spellings for literals. const unsigned char* const SpellingBase; /// OriginalSourceFile - A null-terminated C-string that specifies the name /// if the file (if any) that was to used to generate the PTH cache. const char* OriginalSourceFile; /// This constructor is intended to only be called by the static 'Create' /// method. PTHManager(std::unique_ptr<const llvm::MemoryBuffer> buf, std::unique_ptr<PTHFileLookup> fileLookup, const unsigned char *idDataTable, std::unique_ptr<IdentifierInfo *[], llvm::FreeDeleter> perIDCache, std::unique_ptr<PTHStringIdLookup> stringIdLookup, unsigned numIds, const unsigned char *spellingBase, const char *originalSourceFile); PTHManager(const PTHManager &) = delete; void operator=(const PTHManager &) = delete; /// getSpellingAtPTHOffset - Used by PTHLexer classes to get the cached /// spelling for a token. unsigned getSpellingAtPTHOffset(unsigned PTHOffset, const char*& Buffer); /// GetIdentifierInfo - Used to reconstruct IdentifierInfo objects from the /// PTH file. inline IdentifierInfo* GetIdentifierInfo(unsigned PersistentID) { // Check if the IdentifierInfo has already been resolved. if (IdentifierInfo* II = PerIDCache[PersistentID]) return II; return LazilyCreateIdentifierInfo(PersistentID); } IdentifierInfo* LazilyCreateIdentifierInfo(unsigned PersistentID); public: // The current PTH version. enum { Version = 10 }; ~PTHManager() override; /// getOriginalSourceFile - Return the full path to the original header /// file name that was used to generate the PTH cache. const char* getOriginalSourceFile() const { return OriginalSourceFile; } /// get - Return the identifier token info for the specified named identifier. /// Unlike the version in IdentifierTable, this returns a pointer instead /// of a reference. If the pointer is NULL then the IdentifierInfo cannot /// be found. IdentifierInfo *get(StringRef Name) override; /// Create - This method creates PTHManager objects. The 'file' argument /// is the name of the PTH file. This method returns NULL upon failure. static PTHManager *Create(StringRef file, DiagnosticsEngine &Diags); void setPreprocessor(Preprocessor *pp) { PP = pp; } /// CreateLexer - Return a PTHLexer that "lexes" the cached tokens for the /// specified file. This method returns NULL if no cached tokens exist. /// It is the responsibility of the caller to 'delete' the returned object. PTHLexer *CreateLexer(FileID FID); /// createStatCache - Returns a FileSystemStatCache object for use with /// FileManager objects. These objects use the PTH data to speed up /// calls to stat by memoizing their results from when the PTH file /// was generated. std::unique_ptr<FileSystemStatCache> createStatCache(); }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TokenKinds.def
//===--- TokenKinds.def - C Family Token Kind Database ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the TokenKind database. This includes normal tokens like // tok::ampamp (corresponding to the && token) as well as keywords for various // languages. Users of this file must optionally #define the TOK, KEYWORD, // CXX11_KEYWORD, CONCEPTS_KEYWORD, ALIAS, or PPKEYWORD macros to make use of // this file. // //===----------------------------------------------------------------------===// #ifndef TOK #define TOK(X) #endif #ifndef PUNCTUATOR #define PUNCTUATOR(X,Y) TOK(X) #endif #ifndef KEYWORD #define KEYWORD(X,Y) TOK(kw_ ## X) #endif #ifndef CXX11_KEYWORD #define CXX11_KEYWORD(X,Y) KEYWORD(X,KEYCXX11|(Y)) #endif #ifndef CONCEPTS_KEYWORD #define CONCEPTS_KEYWORD(X) KEYWORD(X,KEYCONCEPTS) #endif #ifndef TYPE_TRAIT #define TYPE_TRAIT(N,I,K) KEYWORD(I,K) #endif #ifndef TYPE_TRAIT_1 #define TYPE_TRAIT_1(I,E,K) TYPE_TRAIT(1,I,K) #endif #ifndef TYPE_TRAIT_2 #define TYPE_TRAIT_2(I,E,K) TYPE_TRAIT(2,I,K) #endif #ifndef TYPE_TRAIT_N #define TYPE_TRAIT_N(I,E,K) TYPE_TRAIT(0,I,K) #endif #ifndef ALIAS #define ALIAS(X,Y,Z) #endif #ifndef PPKEYWORD #define PPKEYWORD(X) #endif #ifndef CXX_KEYWORD_OPERATOR #define CXX_KEYWORD_OPERATOR(X,Y) #endif #ifndef OBJC1_AT_KEYWORD #define OBJC1_AT_KEYWORD(X) #endif #ifndef OBJC2_AT_KEYWORD #define OBJC2_AT_KEYWORD(X) #endif #ifndef TESTING_KEYWORD #define TESTING_KEYWORD(X, L) KEYWORD(X, L) #endif #ifndef ANNOTATION #define ANNOTATION(X) TOK(annot_ ## X) #endif //===----------------------------------------------------------------------===// // Preprocessor keywords. //===----------------------------------------------------------------------===// // These have meaning after a '#' at the start of a line. These define enums in // the tok::pp_* namespace. Note that IdentifierInfo::getPPKeywordID must be // manually updated if something is added here. PPKEYWORD(not_keyword) // C99 6.10.1 - Conditional Inclusion. PPKEYWORD(if) PPKEYWORD(ifdef) PPKEYWORD(ifndef) PPKEYWORD(elif) PPKEYWORD(else) PPKEYWORD(endif) PPKEYWORD(defined) // C99 6.10.2 - Source File Inclusion. PPKEYWORD(include) PPKEYWORD(__include_macros) // C99 6.10.3 - Macro Replacement. PPKEYWORD(define) PPKEYWORD(undef) // C99 6.10.4 - Line Control. PPKEYWORD(line) // C99 6.10.5 - Error Directive. PPKEYWORD(error) // C99 6.10.6 - Pragma Directive. PPKEYWORD(pragma) // GNU Extensions. PPKEYWORD(import) PPKEYWORD(include_next) PPKEYWORD(warning) PPKEYWORD(ident) PPKEYWORD(sccs) PPKEYWORD(assert) PPKEYWORD(unassert) // Clang extensions PPKEYWORD(__public_macro) PPKEYWORD(__private_macro) //===----------------------------------------------------------------------===// // Language keywords. //===----------------------------------------------------------------------===// // These define members of the tok::* namespace. TOK(unknown) // Not a token. TOK(eof) // End of file. TOK(eod) // End of preprocessing directive (end of line inside a // directive). TOK(code_completion) // Code completion marker // C99 6.4.9: Comments. TOK(comment) // Comment (only in -E -C[C] mode) // C99 6.4.2: Identifiers. TOK(identifier) // abcde123 TOK(raw_identifier) // Used only in raw lexing mode. // C99 6.4.4.1: Integer Constants // C99 6.4.4.2: Floating Constants TOK(numeric_constant) // 0x123 // C99 6.4.4: Character Constants TOK(char_constant) // 'a' TOK(wide_char_constant) // L'b' // C++1z Character Constants TOK(utf8_char_constant) // u8'a' // C++11 Character Constants TOK(utf16_char_constant) // u'a' TOK(utf32_char_constant) // U'a' // C99 6.4.5: String Literals. TOK(string_literal) // "foo" TOK(wide_string_literal) // L"foo" TOK(angle_string_literal)// <foo> // C++11 String Literals. TOK(utf8_string_literal) // u8"foo" TOK(utf16_string_literal)// u"foo" TOK(utf32_string_literal)// U"foo" // C99 6.4.6: Punctuators. PUNCTUATOR(l_square, "[") PUNCTUATOR(r_square, "]") PUNCTUATOR(l_paren, "(") PUNCTUATOR(r_paren, ")") PUNCTUATOR(l_brace, "{") PUNCTUATOR(r_brace, "}") PUNCTUATOR(period, ".") PUNCTUATOR(ellipsis, "...") PUNCTUATOR(amp, "&") PUNCTUATOR(ampamp, "&&") PUNCTUATOR(ampequal, "&=") PUNCTUATOR(star, "*") PUNCTUATOR(starequal, "*=") PUNCTUATOR(plus, "+") PUNCTUATOR(plusplus, "++") PUNCTUATOR(plusequal, "+=") PUNCTUATOR(minus, "-") PUNCTUATOR(arrow, "->") PUNCTUATOR(minusminus, "--") PUNCTUATOR(minusequal, "-=") PUNCTUATOR(tilde, "~") PUNCTUATOR(exclaim, "!") PUNCTUATOR(exclaimequal, "!=") PUNCTUATOR(slash, "/") PUNCTUATOR(slashequal, "/=") PUNCTUATOR(percent, "%") PUNCTUATOR(percentequal, "%=") PUNCTUATOR(less, "<") PUNCTUATOR(lessless, "<<") PUNCTUATOR(lessequal, "<=") PUNCTUATOR(lesslessequal, "<<=") PUNCTUATOR(greater, ">") PUNCTUATOR(greatergreater, ">>") PUNCTUATOR(greaterequal, ">=") PUNCTUATOR(greatergreaterequal, ">>=") PUNCTUATOR(caret, "^") PUNCTUATOR(caretequal, "^=") PUNCTUATOR(pipe, "|") PUNCTUATOR(pipepipe, "||") PUNCTUATOR(pipeequal, "|=") PUNCTUATOR(question, "?") PUNCTUATOR(colon, ":") PUNCTUATOR(semi, ";") PUNCTUATOR(equal, "=") PUNCTUATOR(equalequal, "==") PUNCTUATOR(comma, ",") PUNCTUATOR(hash, "#") PUNCTUATOR(hashhash, "##") PUNCTUATOR(hashat, "#@") // C++ Support PUNCTUATOR(periodstar, ".*") PUNCTUATOR(arrowstar, "->*") PUNCTUATOR(coloncolon, "::") // Objective C support. PUNCTUATOR(at, "@") // CUDA support. PUNCTUATOR(lesslessless, "<<<") PUNCTUATOR(greatergreatergreater, ">>>") // C99 6.4.1: Keywords. These turn into kw_* tokens. // Flags allowed: // KEYALL - This is a keyword in all variants of C and C++, or it // is a keyword in the implementation namespace that should // always be treated as a keyword // KEYC99 - This is a keyword introduced to C in C99 // KEYC11 - This is a keyword introduced to C in C11 // KEYCXX - This is a C++ keyword, or a C++-specific keyword in the // implementation namespace // KEYNOCXX - This is a keyword in every non-C++ dialect. // KEYCXX11 - This is a C++ keyword introduced to C++ in C++11 // KEYCONCEPTS - This is a keyword if the C++ extensions for concepts // are enabled. // KEYGNU - This is a keyword if GNU extensions are enabled // KEYMS - This is a keyword if Microsoft extensions are enabled // KEYNOMS18 - This is a keyword that must never be enabled under // MSVC <= v18. // KEYOPENCL - This is a keyword in OpenCL // KEYNOOPENCL - This is a keyword that is not supported in OpenCL // KEYALTIVEC - This is a keyword in AltiVec // KEYZVECTOR - This is a keyword for the System z vector extensions, // which are heavily based on AltiVec // KEYBORLAND - This is a keyword if Borland extensions are enabled // BOOLSUPPORT - This is a keyword if 'bool' is a built-in type // HALFSUPPORT - This is a keyword if 'half' is a built-in type // WCHARSUPPORT - This is a keyword if 'wchar_t' is a built-in type // KEYWORD(auto , KEYALL) KEYWORD(break , KEYALL) KEYWORD(case , KEYALL) KEYWORD(char , KEYALL) KEYWORD(const , KEYALL) KEYWORD(continue , KEYALL) KEYWORD(default , KEYALL) KEYWORD(do , KEYALL) KEYWORD(double , KEYALL) KEYWORD(else , KEYALL) KEYWORD(enum , KEYALL) KEYWORD(extern , KEYALL) KEYWORD(float , KEYALL) KEYWORD(for , KEYALL) KEYWORD(goto , KEYALL) KEYWORD(if , KEYALL) KEYWORD(inline , KEYC99|KEYCXX|KEYGNU) KEYWORD(int , KEYALL) KEYWORD(long , KEYALL) KEYWORD(register , KEYALL) KEYWORD(restrict , KEYC99) KEYWORD(return , KEYALL) KEYWORD(short , KEYALL) KEYWORD(signed , KEYALL) KEYWORD(sizeof , KEYALL) KEYWORD(static , KEYALL) KEYWORD(struct , KEYALL) KEYWORD(switch , KEYALL) KEYWORD(typedef , KEYALL) KEYWORD(union , KEYALL) KEYWORD(unsigned , KEYALL) KEYWORD(void , KEYALL) KEYWORD(volatile , KEYALL) KEYWORD(while , KEYALL) KEYWORD(_Alignas , KEYALL) KEYWORD(_Alignof , KEYALL) KEYWORD(_Atomic , KEYALL|KEYNOMS18|KEYNOOPENCL) KEYWORD(_Bool , KEYNOCXX) KEYWORD(_Complex , KEYALL) KEYWORD(_Generic , KEYALL) KEYWORD(_Imaginary , KEYALL) KEYWORD(_Noreturn , KEYALL) KEYWORD(_Static_assert , KEYALL) KEYWORD(_Thread_local , KEYALL) KEYWORD(__func__ , KEYALL) KEYWORD(__objc_yes , KEYALL) KEYWORD(__objc_no , KEYALL) // C++ 2.11p1: Keywords. KEYWORD(asm , KEYCXX|KEYGNU) KEYWORD(bool , BOOLSUPPORT) KEYWORD(catch , KEYCXX) KEYWORD(class , KEYCXX) KEYWORD(const_cast , KEYCXX) KEYWORD(delete , KEYCXX) KEYWORD(dynamic_cast , KEYCXX) KEYWORD(explicit , KEYCXX) KEYWORD(export , KEYCXX) KEYWORD(false , BOOLSUPPORT) KEYWORD(friend , KEYCXX) KEYWORD(mutable , KEYCXX) KEYWORD(namespace , KEYCXX) KEYWORD(new , KEYCXX) KEYWORD(operator , KEYCXX) KEYWORD(private , KEYCXX) KEYWORD(protected , KEYCXX) KEYWORD(public , KEYCXX) KEYWORD(reinterpret_cast , KEYCXX) KEYWORD(static_cast , KEYCXX) KEYWORD(template , KEYCXX) KEYWORD(this , KEYCXX) KEYWORD(throw , KEYCXX) KEYWORD(true , BOOLSUPPORT) KEYWORD(try , KEYCXX) KEYWORD(typename , KEYCXX) KEYWORD(typeid , KEYCXX) KEYWORD(using , KEYCXX) KEYWORD(virtual , KEYCXX) KEYWORD(wchar_t , WCHARSUPPORT) // C++ 2.5p2: Alternative Representations. CXX_KEYWORD_OPERATOR(and , ampamp) CXX_KEYWORD_OPERATOR(and_eq , ampequal) CXX_KEYWORD_OPERATOR(bitand , amp) CXX_KEYWORD_OPERATOR(bitor , pipe) CXX_KEYWORD_OPERATOR(compl , tilde) CXX_KEYWORD_OPERATOR(not , exclaim) CXX_KEYWORD_OPERATOR(not_eq , exclaimequal) CXX_KEYWORD_OPERATOR(or , pipepipe) CXX_KEYWORD_OPERATOR(or_eq , pipeequal) CXX_KEYWORD_OPERATOR(xor , caret) CXX_KEYWORD_OPERATOR(xor_eq , caretequal) // C++11 keywords CXX11_KEYWORD(alignas , 0) CXX11_KEYWORD(alignof , 0) CXX11_KEYWORD(char16_t , KEYNOMS18) CXX11_KEYWORD(char32_t , KEYNOMS18) CXX11_KEYWORD(constexpr , 0) CXX11_KEYWORD(decltype , 0) CXX11_KEYWORD(noexcept , 0) CXX11_KEYWORD(nullptr , 0) CXX11_KEYWORD(static_assert , 0) CXX11_KEYWORD(thread_local , 0) // C++ concepts TS keywords CONCEPTS_KEYWORD(concept) CONCEPTS_KEYWORD(requires) // GNU Extensions (in impl-reserved namespace) KEYWORD(_Decimal32 , KEYALL) KEYWORD(_Decimal64 , KEYALL) KEYWORD(_Decimal128 , KEYALL) KEYWORD(__null , KEYCXX) KEYWORD(__alignof , KEYALL) KEYWORD(__attribute , KEYALL) KEYWORD(__builtin_choose_expr , KEYALL) KEYWORD(__builtin_offsetof , KEYALL) // __builtin_types_compatible_p is a GNU C extension that we handle like a C++ // type trait. TYPE_TRAIT_2(__builtin_types_compatible_p, TypeCompatible, KEYNOCXX) KEYWORD(__builtin_va_arg , KEYALL) KEYWORD(__extension__ , KEYALL) KEYWORD(__imag , KEYALL) KEYWORD(__int128 , KEYALL) KEYWORD(__label__ , KEYALL) KEYWORD(__real , KEYALL) KEYWORD(__thread , KEYALL) KEYWORD(__FUNCTION__ , KEYALL) KEYWORD(__PRETTY_FUNCTION__ , KEYALL) // GNU Extensions (outside impl-reserved namespace) KEYWORD(typeof , KEYGNU) // MS Extensions KEYWORD(__FUNCDNAME__ , KEYMS) KEYWORD(__FUNCSIG__ , KEYMS) KEYWORD(L__FUNCTION__ , KEYMS) TYPE_TRAIT_1(__is_interface_class, IsInterfaceClass, KEYMS) TYPE_TRAIT_1(__is_sealed, IsSealed, KEYMS) // MSVC12.0 / VS2013 Type Traits TYPE_TRAIT_1(__is_destructible, IsDestructible, KEYMS) TYPE_TRAIT_1(__is_nothrow_destructible, IsNothrowDestructible, KEYMS) TYPE_TRAIT_2(__is_nothrow_assignable, IsNothrowAssignable, KEYCXX) TYPE_TRAIT_N(__is_constructible, IsConstructible, KEYCXX) TYPE_TRAIT_N(__is_nothrow_constructible, IsNothrowConstructible, KEYCXX) // GNU and MS Type Traits TYPE_TRAIT_1(__has_nothrow_assign, HasNothrowAssign, KEYCXX) TYPE_TRAIT_1(__has_nothrow_move_assign, HasNothrowMoveAssign, KEYCXX) TYPE_TRAIT_1(__has_nothrow_copy, HasNothrowCopy, KEYCXX) TYPE_TRAIT_1(__has_nothrow_constructor, HasNothrowConstructor, KEYCXX) TYPE_TRAIT_1(__has_trivial_assign, HasTrivialAssign, KEYCXX) TYPE_TRAIT_1(__has_trivial_move_assign, HasTrivialMoveAssign, KEYCXX) TYPE_TRAIT_1(__has_trivial_copy, HasTrivialCopy, KEYCXX) TYPE_TRAIT_1(__has_trivial_constructor, HasTrivialDefaultConstructor, KEYCXX) TYPE_TRAIT_1(__has_trivial_move_constructor, HasTrivialMoveConstructor, KEYCXX) TYPE_TRAIT_1(__has_trivial_destructor, HasTrivialDestructor, KEYCXX) TYPE_TRAIT_1(__has_virtual_destructor, HasVirtualDestructor, KEYCXX) TYPE_TRAIT_1(__is_abstract, IsAbstract, KEYCXX) TYPE_TRAIT_2(__is_base_of, IsBaseOf, KEYCXX) TYPE_TRAIT_1(__is_class, IsClass, KEYCXX) TYPE_TRAIT_2(__is_convertible_to, IsConvertibleTo, KEYCXX) TYPE_TRAIT_1(__is_empty, IsEmpty, KEYCXX) TYPE_TRAIT_1(__is_enum, IsEnum, KEYCXX) TYPE_TRAIT_1(__is_final, IsFinal, KEYCXX) // Tentative name - there's no implementation of std::is_literal_type yet. TYPE_TRAIT_1(__is_literal, IsLiteral, KEYCXX) // Name for GCC 4.6 compatibility - people have already written libraries using // this name unfortunately. ALIAS("__is_literal_type", __is_literal, KEYCXX) TYPE_TRAIT_1(__is_pod, IsPOD, KEYCXX) TYPE_TRAIT_1(__is_polymorphic, IsPolymorphic, KEYCXX) TYPE_TRAIT_1(__is_trivial, IsTrivial, KEYCXX) TYPE_TRAIT_1(__is_union, IsUnion, KEYCXX) // Clang-only C++ Type Traits TYPE_TRAIT_N(__is_trivially_constructible, IsTriviallyConstructible, KEYCXX) TYPE_TRAIT_1(__is_trivially_copyable, IsTriviallyCopyable, KEYCXX) TYPE_TRAIT_2(__is_trivially_assignable, IsTriviallyAssignable, KEYCXX) KEYWORD(__underlying_type , KEYCXX) // Embarcadero Expression Traits KEYWORD(__is_lvalue_expr , KEYCXX) KEYWORD(__is_rvalue_expr , KEYCXX) // Embarcadero Unary Type Traits TYPE_TRAIT_1(__is_arithmetic, IsArithmetic, KEYCXX) TYPE_TRAIT_1(__is_floating_point, IsFloatingPoint, KEYCXX) TYPE_TRAIT_1(__is_integral, IsIntegral, KEYCXX) TYPE_TRAIT_1(__is_complete_type, IsCompleteType, KEYCXX) TYPE_TRAIT_1(__is_void, IsVoid, KEYCXX) TYPE_TRAIT_1(__is_array, IsArray, KEYCXX) TYPE_TRAIT_1(__is_function, IsFunction, KEYCXX) TYPE_TRAIT_1(__is_reference, IsReference, KEYCXX) TYPE_TRAIT_1(__is_lvalue_reference, IsLvalueReference, KEYCXX) TYPE_TRAIT_1(__is_rvalue_reference, IsRvalueReference, KEYCXX) TYPE_TRAIT_1(__is_fundamental, IsFundamental, KEYCXX) TYPE_TRAIT_1(__is_object, IsObject, KEYCXX) TYPE_TRAIT_1(__is_scalar, IsScalar, KEYCXX) TYPE_TRAIT_1(__is_compound, IsCompound, KEYCXX) TYPE_TRAIT_1(__is_pointer, IsPointer, KEYCXX) TYPE_TRAIT_1(__is_member_object_pointer, IsMemberObjectPointer, KEYCXX) TYPE_TRAIT_1(__is_member_function_pointer, IsMemberFunctionPointer, KEYCXX) TYPE_TRAIT_1(__is_member_pointer, IsMemberPointer, KEYCXX) TYPE_TRAIT_1(__is_const, IsConst, KEYCXX) TYPE_TRAIT_1(__is_volatile, IsVolatile, KEYCXX) TYPE_TRAIT_1(__is_standard_layout, IsStandardLayout, KEYCXX) TYPE_TRAIT_1(__is_signed, IsSigned, KEYCXX) TYPE_TRAIT_1(__is_unsigned, IsUnsigned, KEYCXX) // Embarcadero Binary Type Traits TYPE_TRAIT_2(__is_same, IsSame, KEYCXX) TYPE_TRAIT_2(__is_convertible, IsConvertible, KEYCXX) KEYWORD(__array_rank , KEYCXX) KEYWORD(__array_extent , KEYCXX) // Apple Extension. KEYWORD(__private_extern__ , KEYALL) KEYWORD(__module_private__ , KEYALL) // Microsoft Extension. KEYWORD(__declspec , KEYMS|KEYBORLAND|KEYHLSL) // HLSL Change - __declspec is a reserved keyword KEYWORD(__cdecl , KEYALL) KEYWORD(__stdcall , KEYALL) KEYWORD(__fastcall , KEYALL) KEYWORD(__thiscall , KEYALL) KEYWORD(__vectorcall , KEYALL) KEYWORD(__forceinline , KEYMS) KEYWORD(__unaligned , KEYMS) KEYWORD(__super , KEYMS) // HLSL Change: HLSL-specific keywords KEYWORD(cbuffer , KEYHLSL) KEYWORD(tbuffer , KEYHLSL) KEYWORD(packoffset , KEYHLSL) KEYWORD(linear , KEYHLSL) KEYWORD(centroid , KEYHLSL) KEYWORD(nointerpolation , KEYHLSL) KEYWORD(noperspective , KEYHLSL) KEYWORD(sample , KEYHLSL) KEYWORD(column_major , KEYHLSL) KEYWORD(row_major , KEYHLSL) KEYWORD(in , KEYHLSL) KEYWORD(out , KEYHLSL) KEYWORD(inout , KEYHLSL) KEYWORD(uniform , KEYHLSL) KEYWORD(precise , KEYHLSL) KEYWORD(center , KEYHLSL) KEYWORD(shared , KEYHLSL) KEYWORD(groupshared , KEYHLSL) KEYWORD(discard , KEYHLSL) KEYWORD(snorm , KEYHLSL) KEYWORD(unorm , KEYHLSL) KEYWORD(point , KEYHLSL) KEYWORD(line , KEYHLSL) KEYWORD(lineadj , KEYHLSL) KEYWORD(triangle , KEYHLSL) KEYWORD(triangleadj , KEYHLSL) KEYWORD(globallycoherent , KEYHLSL) KEYWORD(interface , KEYHLSL) KEYWORD(sampler_state , KEYHLSL) KEYWORD(technique , KEYHLSL) KEYWORD(indices , KEYHLSL) KEYWORD(vertices , KEYHLSL) KEYWORD(primitives , KEYHLSL) KEYWORD(payload , KEYHLSL) ALIAS("Technique", technique , KEYHLSL) ALIAS("technique10", technique , KEYHLSL) ALIAS("technique11", technique , KEYHLSL) // OpenCL address space qualifiers KEYWORD(__global , KEYOPENCL) KEYWORD(__local , KEYOPENCL) KEYWORD(__constant , KEYOPENCL) KEYWORD(__private , KEYOPENCL) KEYWORD(__generic , KEYOPENCL) ALIAS("global", __global , KEYOPENCL) ALIAS("local", __local , KEYOPENCL) ALIAS("constant", __constant , KEYOPENCL) ALIAS("private", __private , KEYOPENCL) ALIAS("generic", __generic , KEYOPENCL) // OpenCL function qualifiers KEYWORD(__kernel , KEYOPENCL) ALIAS("kernel", __kernel , KEYOPENCL) // OpenCL access qualifiers KEYWORD(__read_only , KEYOPENCL) KEYWORD(__write_only , KEYOPENCL) KEYWORD(__read_write , KEYOPENCL) ALIAS("read_only", __read_only , KEYOPENCL) ALIAS("write_only", __write_only , KEYOPENCL) ALIAS("read_write", __read_write , KEYOPENCL) // OpenCL builtins KEYWORD(__builtin_astype , KEYOPENCL) KEYWORD(vec_step , KEYOPENCL|KEYALTIVEC|KEYZVECTOR) // OpenMP Type Traits KEYWORD(__builtin_omp_required_simd_align, KEYALL) // Borland Extensions. KEYWORD(__pascal , KEYALL) // Altivec Extension. KEYWORD(__vector , KEYALTIVEC|KEYZVECTOR) KEYWORD(__pixel , KEYALTIVEC) KEYWORD(__bool , KEYALTIVEC|KEYZVECTOR) // ARM NEON extensions. ALIAS("__fp16", half , KEYALL) // OpenCL Extension. KEYWORD(half , HALFSUPPORT) // Objective-C ARC keywords. KEYWORD(__bridge , KEYARC) KEYWORD(__bridge_transfer , KEYARC) KEYWORD(__bridge_retained , KEYARC) KEYWORD(__bridge_retain , KEYARC) // Objective-C keywords. KEYWORD(__covariant , KEYOBJC2) KEYWORD(__contravariant , KEYOBJC2) KEYWORD(__kindof , KEYOBJC2) // Alternate spelling for various tokens. There are GCC extensions in all // languages, but should not be disabled in strict conformance mode. ALIAS("__alignof__" , __alignof , KEYALL) ALIAS("__asm" , asm , KEYALL) ALIAS("__asm__" , asm , KEYALL) ALIAS("__attribute__", __attribute, KEYALL) ALIAS("__complex" , _Complex , KEYALL) ALIAS("__complex__" , _Complex , KEYALL) ALIAS("__const" , const , KEYALL) ALIAS("__const__" , const , KEYALL) ALIAS("__decltype" , decltype , KEYCXX) ALIAS("__imag__" , __imag , KEYALL) ALIAS("__inline" , inline , KEYALL) ALIAS("__inline__" , inline , KEYALL) ALIAS("__nullptr" , nullptr , KEYCXX) ALIAS("__real__" , __real , KEYALL) ALIAS("__restrict" , restrict , KEYALL) ALIAS("__restrict__" , restrict , KEYALL) ALIAS("__signed" , signed , KEYALL) ALIAS("__signed__" , signed , KEYALL) ALIAS("__typeof" , typeof , KEYALL) ALIAS("__typeof__" , typeof , KEYALL) ALIAS("__volatile" , volatile , KEYALL) ALIAS("__volatile__" , volatile , KEYALL) // Type nullability. KEYWORD(_Nonnull , KEYALL) KEYWORD(_Nullable , KEYALL) KEYWORD(_Null_unspecified , KEYALL) // Microsoft extensions which should be disabled in strict conformance mode KEYWORD(__ptr64 , KEYMS) KEYWORD(__ptr32 , KEYMS) KEYWORD(__sptr , KEYMS) KEYWORD(__uptr , KEYMS) KEYWORD(__w64 , KEYMS) KEYWORD(__uuidof , KEYMS | KEYBORLAND) KEYWORD(__try , KEYMS | KEYBORLAND) KEYWORD(__finally , KEYMS | KEYBORLAND) KEYWORD(__leave , KEYMS | KEYBORLAND) KEYWORD(__int64 , KEYMS) KEYWORD(__if_exists , KEYMS) KEYWORD(__if_not_exists , KEYMS) KEYWORD(__single_inheritance , KEYMS) KEYWORD(__multiple_inheritance , KEYMS) KEYWORD(__virtual_inheritance , KEYMS) KEYWORD(__interface , KEYMS) ALIAS("__int8" , char , KEYMS) ALIAS("_int8" , char , KEYMS) ALIAS("__int16" , short , KEYMS) ALIAS("_int16" , short , KEYMS) ALIAS("__int32" , int , KEYMS) ALIAS("_int32" , int , KEYMS) ALIAS("_int64" , __int64 , KEYMS) ALIAS("__wchar_t" , wchar_t , KEYMS) ALIAS("_asm" , asm , KEYMS) ALIAS("_alignof" , __alignof , KEYMS) ALIAS("__builtin_alignof", __alignof , KEYMS) ALIAS("_cdecl" , __cdecl , KEYMS | KEYBORLAND) ALIAS("_fastcall" , __fastcall , KEYMS | KEYBORLAND) ALIAS("_stdcall" , __stdcall , KEYMS | KEYBORLAND) ALIAS("_thiscall" , __thiscall , KEYMS) ALIAS("_vectorcall" , __vectorcall, KEYMS) ALIAS("_uuidof" , __uuidof , KEYMS | KEYBORLAND) ALIAS("_inline" , inline , KEYMS) ALIAS("_declspec" , __declspec , KEYMS) // Borland Extensions which should be disabled in strict conformance mode. ALIAS("_pascal" , __pascal , KEYBORLAND) // Clang Extensions. KEYWORD(__builtin_convertvector , KEYALL) ALIAS("__char16_t" , char16_t , KEYCXX) ALIAS("__char32_t" , char32_t , KEYCXX) // Clang-specific keywords enabled only in testing. TESTING_KEYWORD(__unknown_anytype , KEYALL) //===----------------------------------------------------------------------===// // Objective-C @-preceded keywords. //===----------------------------------------------------------------------===// // These have meaning after an '@' in Objective-C mode. These define enums in // the tok::objc_* namespace. OBJC1_AT_KEYWORD(not_keyword) OBJC1_AT_KEYWORD(class) OBJC1_AT_KEYWORD(compatibility_alias) OBJC1_AT_KEYWORD(defs) OBJC1_AT_KEYWORD(encode) OBJC1_AT_KEYWORD(end) OBJC1_AT_KEYWORD(implementation) OBJC1_AT_KEYWORD(interface) OBJC1_AT_KEYWORD(private) OBJC1_AT_KEYWORD(protected) OBJC1_AT_KEYWORD(protocol) OBJC1_AT_KEYWORD(public) OBJC1_AT_KEYWORD(selector) OBJC1_AT_KEYWORD(throw) OBJC1_AT_KEYWORD(try) OBJC1_AT_KEYWORD(catch) OBJC1_AT_KEYWORD(finally) OBJC1_AT_KEYWORD(synchronized) OBJC1_AT_KEYWORD(autoreleasepool) OBJC2_AT_KEYWORD(property) OBJC2_AT_KEYWORD(package) OBJC2_AT_KEYWORD(required) OBJC2_AT_KEYWORD(optional) OBJC2_AT_KEYWORD(synthesize) OBJC2_AT_KEYWORD(dynamic) OBJC2_AT_KEYWORD(import) // TODO: What to do about context-sensitive keywords like: // bycopy/byref/in/inout/oneway/out? ANNOTATION(cxxscope) // annotation for a C++ scope spec, e.g. "::foo::bar::" ANNOTATION(typename) // annotation for a C typedef name, a C++ (possibly // qualified) typename, e.g. "foo::MyClass", or // template-id that names a type ("std::vector<int>") ANNOTATION(template_id) // annotation for a C++ template-id that names a // function template specialization (not a type), // e.g., "std::swap<int>" ANNOTATION(primary_expr) // annotation for a primary expression ANNOTATION(decltype) // annotation for a decltype expression, // e.g., "decltype(foo.bar())" // Annotation for #pragma unused(...) // For each argument inside the parentheses the pragma handler will produce // one 'pragma_unused' annotation token followed by the argument token. ANNOTATION(pragma_unused) // Annotation for #pragma GCC visibility... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_vis) // Annotation for #pragma pack... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_pack) // Annotation for #pragma clang __debug parser_crash... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_parser_crash) // Annotation for #pragma clang __debug captured... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_captured) // Annotation for #pragma ms_struct... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_msstruct) // Annotation for #pragma align... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_align) // Annotation for #pragma weak id // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_weak) // Annotation for #pragma weak id = id // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_weakalias) // Annotation for #pragma redefine_extname... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_redefine_extname) // Annotation for #pragma STDC FP_CONTRACT... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_fp_contract) // Annotation for #pragma pointers_to_members... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_ms_pointers_to_members) // Annotation for #pragma vtordisp... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_ms_vtordisp) // Annotation for all microsoft #pragmas... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_ms_pragma) // Annotation for #pragma OPENCL EXTENSION... // The lexer produces these so that they only take effect when the parser // handles them. ANNOTATION(pragma_opencl_extension) // Annotations for OpenMP pragma directives - #pragma omp ... // The lexer produces these so that they only take effect when the parser // handles #pragma omp ... directives. ANNOTATION(pragma_openmp) ANNOTATION(pragma_openmp_end) // Annotations for loop pragma directives #pragma clang loop ... // The lexer produces these so that they only take effect when the parser // handles #pragma loop ... directives. ANNOTATION(pragma_loop_hint) // Annotations for module import translated from #include etc. ANNOTATION(module_include) ANNOTATION(module_begin) ANNOTATION(module_end) #undef ANNOTATION #undef TESTING_KEYWORD #undef OBJC2_AT_KEYWORD #undef OBJC1_AT_KEYWORD #undef CXX_KEYWORD_OPERATOR #undef PPKEYWORD #undef ALIAS #undef TYPE_TRAIT_N #undef TYPE_TRAIT_2 #undef TYPE_TRAIT_1 #undef TYPE_TRAIT #undef CONCEPTS_KEYWORD #undef CXX11_KEYWORD #undef KEYWORD #undef PUNCTUATOR #undef TOK
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Version.h
//===- Version.h - Clang Version Number -------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines version macros and version-related utility functions /// for Clang. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_VERSION_H #define LLVM_CLANG_BASIC_VERSION_H #include "clang/Basic/Version.inc" #include "llvm/ADT/StringRef.h" // HLSL Change - for uint32_t #include <cstdint> /// \brief Helper macro for CLANG_VERSION_STRING. #define CLANG_MAKE_VERSION_STRING2(X) #X #ifdef CLANG_VERSION_PATCHLEVEL /// \brief Helper macro for CLANG_VERSION_STRING. #define CLANG_MAKE_VERSION_STRING(X,Y,Z) CLANG_MAKE_VERSION_STRING2(X.Y.Z) /// \brief A string that describes the Clang version number, e.g., "1.0". #define CLANG_VERSION_STRING \ CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR, \ CLANG_VERSION_PATCHLEVEL) #else /// \brief Helper macro for CLANG_VERSION_STRING. #define CLANG_MAKE_VERSION_STRING(X,Y) CLANG_MAKE_VERSION_STRING2(X.Y) /// \brief A string that describes the Clang version number, e.g., "1.0". #define CLANG_VERSION_STRING \ CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR) #endif namespace clang { /// \brief Retrieves the repository path (e.g., Subversion path) that /// identifies the particular Clang branch, tag, or trunk from which this /// Clang was built. std::string getClangRepositoryPath(); /// \brief Retrieves the repository path from which LLVM was built. /// /// This supports LLVM residing in a separate repository from clang. std::string getLLVMRepositoryPath(); /// \brief Retrieves the repository revision number (or identifer) from which /// this Clang was built. std::string getClangRevision(); /// \brief Retrieves the repository revision number (or identifer) from which /// LLVM was built. /// /// If Clang and LLVM are in the same repository, this returns the same /// string as getClangRevision. std::string getLLVMRevision(); /// \brief Retrieves the full repository version that is an amalgamation of /// the information in getClangRepositoryPath() and getClangRevision(). std::string getClangFullRepositoryVersion(); /// \brief Retrieves a string representing the complete clang version, /// which includes the clang version number, the repository version, /// and the vendor tag. std::string getClangFullVersion(); /// \brief Like getClangFullVersion(), but with a custom tool name. std::string getClangToolFullVersion(llvm::StringRef ToolName); /// \brief Retrieves a string representing the complete clang version suitable /// for use in the CPP __VERSION__ macro, which includes the clang version /// number, the repository version, and the vendor tag. std::string getClangFullCPPVersion(); // HLSL Change Starts #ifdef SUPPORT_QUERY_GIT_COMMIT_INFO /// \brief Returns the number of Git commits in current branch. uint32_t getGitCommitCount(); /// \brief Returns the hash of the current Git commit. const char *getGitCommitHash(); #endif // SUPPORT_QUERY_GIT_COMMIT_INFO // HLSL Change Ends } #endif // LLVM_CLANG_BASIC_VERSION_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Sanitizers.def
//===--- Sanitizers.def - Runtime sanitizer options -------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the options for specifying which runtime sanitizers to // enable. Users of this file must define the SANITIZER macro to make use of // this information. Users of this file can also define the SANITIZER_GROUP // macro to get information on options which refer to sets of sanitizers. // //===----------------------------------------------------------------------===// #ifndef SANITIZER #error "Define SANITIZER prior to including this file!" #endif // SANITIZER(NAME, ID) // The first value is the name of the sanitizer as a string. The sanitizer can // be enabled by specifying -fsanitize=NAME. // The second value is an identifier which can be used to refer to the // sanitizer. // SANITIZER_GROUP(NAME, ID, ALIAS) // The first two values have the same semantics as the corresponding SANITIZER // values. The third value is an expression ORing together the IDs of individual // sanitizers in this group. #ifndef SANITIZER_GROUP #define SANITIZER_GROUP(NAME, ID, ALIAS) #endif // AddressSanitizer SANITIZER("address", Address) // Kernel AddressSanitizer (KASan) SANITIZER("kernel-address", KernelAddress) // MemorySanitizer SANITIZER("memory", Memory) // ThreadSanitizer SANITIZER("thread", Thread) // LeakSanitizer SANITIZER("leak", Leak) // UndefinedBehaviorSanitizer SANITIZER("alignment", Alignment) SANITIZER("array-bounds", ArrayBounds) SANITIZER("bool", Bool) SANITIZER("enum", Enum) SANITIZER("float-cast-overflow", FloatCastOverflow) SANITIZER("float-divide-by-zero", FloatDivideByZero) SANITIZER("function", Function) SANITIZER("integer-divide-by-zero", IntegerDivideByZero) SANITIZER("nonnull-attribute", NonnullAttribute) SANITIZER("null", Null) SANITIZER("object-size", ObjectSize) SANITIZER("return", Return) SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute) SANITIZER("shift-base", ShiftBase) SANITIZER("shift-exponent", ShiftExponent) SANITIZER_GROUP("shift", Shift, ShiftBase | ShiftExponent) SANITIZER("signed-integer-overflow", SignedIntegerOverflow) SANITIZER("unreachable", Unreachable) SANITIZER("vla-bound", VLABound) SANITIZER("vptr", Vptr) // IntegerSanitizer SANITIZER("unsigned-integer-overflow", UnsignedIntegerOverflow) // DataFlowSanitizer SANITIZER("dataflow", DataFlow) // Control Flow Integrity SANITIZER("cfi-cast-strict", CFICastStrict) SANITIZER("cfi-derived-cast", CFIDerivedCast) SANITIZER("cfi-unrelated-cast", CFIUnrelatedCast) SANITIZER("cfi-nvcall", CFINVCall) SANITIZER("cfi-vcall", CFIVCall) SANITIZER_GROUP("cfi", CFI, CFIDerivedCast | CFIUnrelatedCast | CFINVCall | CFIVCall) // Safe Stack SANITIZER("safe-stack", SafeStack) // -fsanitize=undefined includes all the sanitizers which have low overhead, no // ABI or address space layout implications, and only catch undefined behavior. SANITIZER_GROUP("undefined", Undefined, Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow | FloatDivideByZero | IntegerDivideByZero | NonnullAttribute | Null | ObjectSize | Return | ReturnsNonnullAttribute | Shift | SignedIntegerOverflow | Unreachable | VLABound | Function | Vptr) // -fsanitize=undefined-trap is an alias for -fsanitize=undefined. SANITIZER_GROUP("undefined-trap", UndefinedTrap, Undefined) SANITIZER_GROUP("integer", Integer, SignedIntegerOverflow | UnsignedIntegerOverflow | Shift | IntegerDivideByZero) SANITIZER("local-bounds", LocalBounds) SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds) // Magic group, containing all sanitizers. For example, "-fno-sanitize=all" // can be used to disable all the sanitizers. SANITIZER_GROUP("all", All, ~0ULL) #undef SANITIZER #undef SANITIZER_GROUP
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Version.inc.in
#define CLANG_VERSION @CLANG_VERSION@ #define CLANG_VERSION_MAJOR @CLANG_VERSION_MAJOR@ #define CLANG_VERSION_MINOR @CLANG_VERSION_MINOR@ #if @CLANG_HAS_VERSION_PATCHLEVEL@ #define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@ #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsHexagon.def
//===-- BuiltinsHexagon.def - Hexagon Builtin function database --*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the Hexagon-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // The builtins below are not autogenerated from iset.py. // Make sure you do not overwrite these. BUILTIN(__builtin_SI_to_SXTHI_asrh, "ii", "") BUILTIN(__builtin_circ_ldd, "LLi*LLi*LLi*ii", "") // The builtins above are not autogenerated from iset.py. // Make sure you do not overwrite these. BUILTIN(__builtin_HEXAGON_C2_cmpeq,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpgt,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpgtu,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpeqp,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_C2_cmpgtp,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_C2_cmpgtup,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_rcmpeqi,"iii","") BUILTIN(__builtin_HEXAGON_A4_rcmpneqi,"iii","") BUILTIN(__builtin_HEXAGON_A4_rcmpeq,"iii","") BUILTIN(__builtin_HEXAGON_A4_rcmpneq,"iii","") BUILTIN(__builtin_HEXAGON_C2_bitsset,"bii","") BUILTIN(__builtin_HEXAGON_C2_bitsclr,"bii","") BUILTIN(__builtin_HEXAGON_C4_nbitsset,"bii","") BUILTIN(__builtin_HEXAGON_C4_nbitsclr,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpeqi,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpgti,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpgtui,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpgei,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpgeui,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmplt,"bii","") BUILTIN(__builtin_HEXAGON_C2_cmpltu,"bii","") BUILTIN(__builtin_HEXAGON_C2_bitsclri,"bii","") BUILTIN(__builtin_HEXAGON_C4_nbitsclri,"bii","") BUILTIN(__builtin_HEXAGON_C4_cmpneqi,"bii","") BUILTIN(__builtin_HEXAGON_C4_cmpltei,"bii","") BUILTIN(__builtin_HEXAGON_C4_cmplteui,"bii","") BUILTIN(__builtin_HEXAGON_C4_cmpneq,"bii","") BUILTIN(__builtin_HEXAGON_C4_cmplte,"bii","") BUILTIN(__builtin_HEXAGON_C4_cmplteu,"bii","") BUILTIN(__builtin_HEXAGON_C2_and,"bii","") BUILTIN(__builtin_HEXAGON_C2_or,"bii","") BUILTIN(__builtin_HEXAGON_C2_xor,"bii","") BUILTIN(__builtin_HEXAGON_C2_andn,"bii","") BUILTIN(__builtin_HEXAGON_C2_not,"bi","") BUILTIN(__builtin_HEXAGON_C2_orn,"bii","") BUILTIN(__builtin_HEXAGON_C4_and_and,"biii","") BUILTIN(__builtin_HEXAGON_C4_and_or,"biii","") BUILTIN(__builtin_HEXAGON_C4_or_and,"biii","") BUILTIN(__builtin_HEXAGON_C4_or_or,"biii","") BUILTIN(__builtin_HEXAGON_C4_and_andn,"biii","") BUILTIN(__builtin_HEXAGON_C4_and_orn,"biii","") BUILTIN(__builtin_HEXAGON_C4_or_andn,"biii","") BUILTIN(__builtin_HEXAGON_C4_or_orn,"biii","") BUILTIN(__builtin_HEXAGON_C2_pxfer_map,"bi","") BUILTIN(__builtin_HEXAGON_C2_any8,"bi","") BUILTIN(__builtin_HEXAGON_C2_all8,"bi","") BUILTIN(__builtin_HEXAGON_C2_vitpack,"iii","") BUILTIN(__builtin_HEXAGON_C2_mux,"iiii","") BUILTIN(__builtin_HEXAGON_C2_muxii,"iiii","") BUILTIN(__builtin_HEXAGON_C2_muxir,"iiii","") BUILTIN(__builtin_HEXAGON_C2_muxri,"iiii","") BUILTIN(__builtin_HEXAGON_C2_vmux,"LLiiLLiLLi","") BUILTIN(__builtin_HEXAGON_C2_mask,"LLii","") BUILTIN(__builtin_HEXAGON_A2_vcmpbeq,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_vcmpbeqi,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_vcmpbeq_any,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vcmpbgtu,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_vcmpbgtui,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_vcmpbgt,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_vcmpbgti,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_cmpbeq,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmpbeqi,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmpbgtu,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmpbgtui,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmpbgt,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmpbgti,"bii","") BUILTIN(__builtin_HEXAGON_A2_vcmpheq,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vcmphgt,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vcmphgtu,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_vcmpheqi,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_vcmphgti,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_vcmphgtui,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_cmpheq,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmphgt,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmphgtu,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmpheqi,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmphgti,"bii","") BUILTIN(__builtin_HEXAGON_A4_cmphgtui,"bii","") BUILTIN(__builtin_HEXAGON_A2_vcmpweq,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vcmpwgt,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vcmpwgtu,"bLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_vcmpweqi,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_vcmpwgti,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_vcmpwgtui,"bLLii","") BUILTIN(__builtin_HEXAGON_A4_boundscheck,"biLLi","") BUILTIN(__builtin_HEXAGON_A4_tlbmatch,"bLLii","") BUILTIN(__builtin_HEXAGON_C2_tfrpr,"ii","") BUILTIN(__builtin_HEXAGON_C2_tfrrp,"bi","") BUILTIN(__builtin_HEXAGON_C4_fastcorner9,"bii","") BUILTIN(__builtin_HEXAGON_C4_fastcorner9_not,"bii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hl_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hl_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_lh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_lh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_ll_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_ll_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hl_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hl_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_lh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_lh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_ll_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_ll_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hl_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hl_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_lh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_lh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_ll_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_ll_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hl_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hl_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_lh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_lh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_ll_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_ll_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_hh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_hh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_hl_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_hl_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_lh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_lh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_ll_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_ll_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hl_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hl_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_lh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_lh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_ll_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_ll_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hl_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hl_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_lh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_lh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_ll_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_ll_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hl_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hl_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_lh_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_lh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_ll_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_ll_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hl_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hl_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_lh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_lh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_ll_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_ll_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hl_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hl_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_lh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_lh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_ll_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_ll_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_hh_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_hh_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_hl_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_hl_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_lh_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_lh_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_ll_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_ll_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hh_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hh_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hl_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hl_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_lh_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_lh_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_ll_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_ll_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hl_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hl_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_lh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_lh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_ll_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_ll_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hl_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hl_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_lh_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_lh_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_ll_s0,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_ll_s1,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_hh_s0,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_hh_s1,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_hl_s0,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_hl_s1,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_lh_s0,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_lh_s1,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_ll_s0,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_ll_s1,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hl_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hl_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_lh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_lh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_ll_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_ll_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hl_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hl_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_lh_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_lh_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_ll_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_ll_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_hh_s0,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_hh_s1,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_hl_s0,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_hl_s1,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_lh_s0,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_lh_s1,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_ll_s0,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpyud_ll_s1,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_mpysmi,"iii","") BUILTIN(__builtin_HEXAGON_M2_macsip,"iiii","") BUILTIN(__builtin_HEXAGON_M2_macsin,"iiii","") BUILTIN(__builtin_HEXAGON_M2_dpmpyss_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_dpmpyss_acc_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_dpmpyss_nac_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_dpmpyuu_s0,"ULLiii","") BUILTIN(__builtin_HEXAGON_M2_dpmpyuu_acc_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_dpmpyuu_nac_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_mpy_up,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_up_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpy_up_s1_sat,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpyu_up,"Uiii","") BUILTIN(__builtin_HEXAGON_M2_mpysu_up,"iii","") BUILTIN(__builtin_HEXAGON_M2_dpmpyss_rnd_s0,"iii","") BUILTIN(__builtin_HEXAGON_M4_mac_up_s1_sat,"iiii","") BUILTIN(__builtin_HEXAGON_M4_nac_up_s1_sat,"iiii","") BUILTIN(__builtin_HEXAGON_M2_mpyi,"iii","") BUILTIN(__builtin_HEXAGON_M2_mpyui,"iii","") BUILTIN(__builtin_HEXAGON_M2_maci,"iiii","") BUILTIN(__builtin_HEXAGON_M2_acci,"iiii","") BUILTIN(__builtin_HEXAGON_M2_accii,"iiii","") BUILTIN(__builtin_HEXAGON_M2_nacci,"iiii","") BUILTIN(__builtin_HEXAGON_M2_naccii,"iiii","") BUILTIN(__builtin_HEXAGON_M2_subacc,"iiii","") BUILTIN(__builtin_HEXAGON_M4_mpyrr_addr,"iiii","") BUILTIN(__builtin_HEXAGON_M4_mpyri_addr_u2,"iiii","") BUILTIN(__builtin_HEXAGON_M4_mpyri_addr,"iiii","") BUILTIN(__builtin_HEXAGON_M4_mpyri_addi,"iiii","") BUILTIN(__builtin_HEXAGON_M4_mpyrr_addi,"iiii","") BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_vmac2s_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_vmac2s_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_vmpy2su_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_vmpy2su_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_vmac2su_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_vmac2su_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s0pack,"iii","") BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s1pack,"iii","") BUILTIN(__builtin_HEXAGON_M2_vmac2,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_vmpy2es_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vmpy2es_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vmac2es_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vmac2es_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vmac2es,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrmac_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrmpy_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vdmpyrs_s0,"iLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vdmpyrs_s1,"iLLiLLi","") BUILTIN(__builtin_HEXAGON_M5_vrmpybuu,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M5_vrmacbuu,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M5_vrmpybsu,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M5_vrmacbsu,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M5_vmpybuu,"LLiii","") BUILTIN(__builtin_HEXAGON_M5_vmpybsu,"LLiii","") BUILTIN(__builtin_HEXAGON_M5_vmacbuu,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M5_vmacbsu,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M5_vdmpybsu,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M5_vdmacbsu,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vdmacs_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vdmacs_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vdmpys_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vdmpys_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_cmpyrs_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_cmpyrs_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_cmpyrsc_s0,"iii","") BUILTIN(__builtin_HEXAGON_M2_cmpyrsc_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_cmacs_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cmacs_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cmacsc_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cmacsc_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cmpys_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_cmpys_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_cmpysc_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_cmpysc_s1,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_cnacs_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cnacs_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cnacsc_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cnacsc_s1,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_vrcmpys_s1,"LLiLLii","") BUILTIN(__builtin_HEXAGON_M2_vrcmpys_acc_s1,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_M2_vrcmpys_s1rp,"iLLii","") BUILTIN(__builtin_HEXAGON_M2_mmacls_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmacls_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmachs_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmachs_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyl_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyl_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyh_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyh_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmacls_rs0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmacls_rs1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmachs_rs0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmachs_rs1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyl_rs0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyl_rs1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyh_rs0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyh_rs1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyeh_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyeh_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyeh_acc_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyeh_acc_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyoh_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyoh_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyoh_acc_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M4_vrmpyoh_acc_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_hmmpyl_rs1,"iii","") BUILTIN(__builtin_HEXAGON_M2_hmmpyh_rs1,"iii","") BUILTIN(__builtin_HEXAGON_M2_hmmpyl_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_hmmpyh_s1,"iii","") BUILTIN(__builtin_HEXAGON_M2_mmaculs_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmaculs_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmacuhs_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmacuhs_s1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyul_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyul_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyuh_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyuh_s1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmaculs_rs0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmaculs_rs1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmacuhs_rs0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmacuhs_rs1,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyul_rs0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyul_rs1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyuh_rs0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_mmpyuh_rs1,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrcmaci_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrcmacr_s0,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrcmaci_s0c,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrcmacr_s0c,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_cmaci_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_cmacr_s0,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M2_vrcmpyi_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrcmpyr_s0,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrcmpyi_s0c,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vrcmpyr_s0c,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_cmpyi_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M2_cmpyr_s0,"LLiii","") BUILTIN(__builtin_HEXAGON_M4_cmpyi_wh,"iLLii","") BUILTIN(__builtin_HEXAGON_M4_cmpyr_wh,"iLLii","") BUILTIN(__builtin_HEXAGON_M4_cmpyi_whc,"iLLii","") BUILTIN(__builtin_HEXAGON_M4_cmpyr_whc,"iLLii","") BUILTIN(__builtin_HEXAGON_M2_vcmpy_s0_sat_i,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vcmpy_s0_sat_r,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vcmpy_s1_sat_i,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vcmpy_s1_sat_r,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vcmac_s0_sat_i,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vcmac_s0_sat_r,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_vcrotate,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S4_vrcrotate_acc,"LLiLLiLLiii","") BUILTIN(__builtin_HEXAGON_S4_vrcrotate,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_S2_vcnegh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_vrcnegh,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_M4_pmpyw,"LLiii","") BUILTIN(__builtin_HEXAGON_M4_vpmpyh,"LLiii","") BUILTIN(__builtin_HEXAGON_M4_pmpyw_acc,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_M4_vpmpyh_acc,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_A2_add,"iii","") BUILTIN(__builtin_HEXAGON_A2_sub,"iii","") BUILTIN(__builtin_HEXAGON_A2_addsat,"iii","") BUILTIN(__builtin_HEXAGON_A2_subsat,"iii","") BUILTIN(__builtin_HEXAGON_A2_addi,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_l16_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_l16_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_l16_sat_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_l16_sat_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_l16_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_l16_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_l16_sat_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_l16_sat_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_lh,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_hh,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_lh,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_hh,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_lh,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_hh,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_lh,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_hh,"iii","") BUILTIN(__builtin_HEXAGON_A2_aslh,"ii","") BUILTIN(__builtin_HEXAGON_A2_asrh,"ii","") BUILTIN(__builtin_HEXAGON_A2_addp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_addpsat,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_addsp,"LLiiLLi","") BUILTIN(__builtin_HEXAGON_A2_subp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_neg,"ii","") BUILTIN(__builtin_HEXAGON_A2_negsat,"ii","") BUILTIN(__builtin_HEXAGON_A2_abs,"ii","") BUILTIN(__builtin_HEXAGON_A2_abssat,"ii","") BUILTIN(__builtin_HEXAGON_A2_vconj,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_negp,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_absp,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_max,"iii","") BUILTIN(__builtin_HEXAGON_A2_maxu,"Uiii","") BUILTIN(__builtin_HEXAGON_A2_min,"iii","") BUILTIN(__builtin_HEXAGON_A2_minu,"Uiii","") BUILTIN(__builtin_HEXAGON_A2_maxp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_maxup,"ULLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_minp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_minup,"ULLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_tfr,"ii","") BUILTIN(__builtin_HEXAGON_A2_tfrsi,"ii","") BUILTIN(__builtin_HEXAGON_A2_tfrp,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_tfrpi,"LLii","") BUILTIN(__builtin_HEXAGON_A2_zxtb,"ii","") BUILTIN(__builtin_HEXAGON_A2_sxtb,"ii","") BUILTIN(__builtin_HEXAGON_A2_zxth,"ii","") BUILTIN(__builtin_HEXAGON_A2_sxth,"ii","") BUILTIN(__builtin_HEXAGON_A2_combinew,"LLiii","") BUILTIN(__builtin_HEXAGON_A4_combineri,"LLiii","") BUILTIN(__builtin_HEXAGON_A4_combineir,"LLiii","") BUILTIN(__builtin_HEXAGON_A2_combineii,"LLiii","") BUILTIN(__builtin_HEXAGON_A2_combine_hh,"iii","") BUILTIN(__builtin_HEXAGON_A2_combine_hl,"iii","") BUILTIN(__builtin_HEXAGON_A2_combine_lh,"iii","") BUILTIN(__builtin_HEXAGON_A2_combine_ll,"iii","") BUILTIN(__builtin_HEXAGON_A2_tfril,"iii","") BUILTIN(__builtin_HEXAGON_A2_tfrih,"iii","") BUILTIN(__builtin_HEXAGON_A2_and,"iii","") BUILTIN(__builtin_HEXAGON_A2_or,"iii","") BUILTIN(__builtin_HEXAGON_A2_xor,"iii","") BUILTIN(__builtin_HEXAGON_A2_not,"ii","") BUILTIN(__builtin_HEXAGON_M2_xor_xacc,"iiii","") BUILTIN(__builtin_HEXAGON_M4_xor_xacc,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_andn,"iii","") BUILTIN(__builtin_HEXAGON_A4_orn,"iii","") BUILTIN(__builtin_HEXAGON_A4_andnp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_ornp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_addaddi,"iiii","") BUILTIN(__builtin_HEXAGON_S4_subaddi,"iiii","") BUILTIN(__builtin_HEXAGON_M4_and_and,"iiii","") BUILTIN(__builtin_HEXAGON_M4_and_andn,"iiii","") BUILTIN(__builtin_HEXAGON_M4_and_or,"iiii","") BUILTIN(__builtin_HEXAGON_M4_and_xor,"iiii","") BUILTIN(__builtin_HEXAGON_M4_or_and,"iiii","") BUILTIN(__builtin_HEXAGON_M4_or_andn,"iiii","") BUILTIN(__builtin_HEXAGON_M4_or_or,"iiii","") BUILTIN(__builtin_HEXAGON_M4_or_xor,"iiii","") BUILTIN(__builtin_HEXAGON_S4_or_andix,"iiii","") BUILTIN(__builtin_HEXAGON_S4_or_andi,"iiii","") BUILTIN(__builtin_HEXAGON_S4_or_ori,"iiii","") BUILTIN(__builtin_HEXAGON_M4_xor_and,"iiii","") BUILTIN(__builtin_HEXAGON_M4_xor_or,"iiii","") BUILTIN(__builtin_HEXAGON_M4_xor_andn,"iiii","") BUILTIN(__builtin_HEXAGON_A2_subri,"iii","") BUILTIN(__builtin_HEXAGON_A2_andir,"iii","") BUILTIN(__builtin_HEXAGON_A2_orir,"iii","") BUILTIN(__builtin_HEXAGON_A2_andp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_orp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_xorp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_notp,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_sxtw,"LLii","") BUILTIN(__builtin_HEXAGON_A2_sat,"iLLi","") BUILTIN(__builtin_HEXAGON_A2_roundsat,"iLLi","") BUILTIN(__builtin_HEXAGON_A2_sath,"ii","") BUILTIN(__builtin_HEXAGON_A2_satuh,"ii","") BUILTIN(__builtin_HEXAGON_A2_satub,"ii","") BUILTIN(__builtin_HEXAGON_A2_satb,"ii","") BUILTIN(__builtin_HEXAGON_A2_vaddub,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vaddb_map,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vaddubs,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vaddh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vaddhs,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vadduhs,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A5_vaddhubs,"iLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vaddw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vaddws,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_vxaddsubw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_vxsubaddw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_vxaddsubh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_vxsubaddh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_vxaddsubhr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_vxsubaddhr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_svavgh,"iii","") BUILTIN(__builtin_HEXAGON_A2_svavghs,"iii","") BUILTIN(__builtin_HEXAGON_A2_svnavgh,"iii","") BUILTIN(__builtin_HEXAGON_A2_svaddh,"iii","") BUILTIN(__builtin_HEXAGON_A2_svaddhs,"iii","") BUILTIN(__builtin_HEXAGON_A2_svadduhs,"iii","") BUILTIN(__builtin_HEXAGON_A2_svsubh,"iii","") BUILTIN(__builtin_HEXAGON_A2_svsubhs,"iii","") BUILTIN(__builtin_HEXAGON_A2_svsubuhs,"iii","") BUILTIN(__builtin_HEXAGON_A2_vraddub,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vraddub_acc,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vraddh,"iLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vradduh,"iLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsubub,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsubb_map,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsububs,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsubh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsubhs,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsubuhs,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsubw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vsubws,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vabsh,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vabshsat,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vabsw,"LLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vabswsat,"LLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vabsdiffw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_M2_vabsdiffh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vrsadub,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vrsadub_acc,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavgub,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavguh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavgh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vnavgh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavgw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vnavgw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavgwr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vnavgwr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavgwcr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vnavgwcr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavghcr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vnavghcr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavguw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavguwr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavgubr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavguhr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vavghr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vnavghr,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_round_ri,"iii","") BUILTIN(__builtin_HEXAGON_A4_round_rr,"iii","") BUILTIN(__builtin_HEXAGON_A4_round_ri_sat,"iii","") BUILTIN(__builtin_HEXAGON_A4_round_rr_sat,"iii","") BUILTIN(__builtin_HEXAGON_A4_cround_ri,"iii","") BUILTIN(__builtin_HEXAGON_A4_cround_rr,"iii","") BUILTIN(__builtin_HEXAGON_A4_vrminh,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A4_vrmaxh,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A4_vrminuh,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A4_vrmaxuh,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A4_vrminw,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A4_vrmaxw,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A4_vrminuw,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A4_vrmaxuw,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_A2_vminb,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vmaxb,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vminub,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vmaxub,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vminh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vmaxh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vminuh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vmaxuh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vminw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vmaxw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vminuw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A2_vmaxuw,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_A4_modwrapu,"iii","") BUILTIN(__builtin_HEXAGON_F2_sfadd,"fff","") BUILTIN(__builtin_HEXAGON_F2_sfsub,"fff","") BUILTIN(__builtin_HEXAGON_F2_sfmpy,"fff","") BUILTIN(__builtin_HEXAGON_F2_sffma,"ffff","") BUILTIN(__builtin_HEXAGON_F2_sffma_sc,"ffffi","") BUILTIN(__builtin_HEXAGON_F2_sffms,"ffff","") BUILTIN(__builtin_HEXAGON_F2_sffma_lib,"ffff","") BUILTIN(__builtin_HEXAGON_F2_sffms_lib,"ffff","") BUILTIN(__builtin_HEXAGON_F2_sfcmpeq,"bff","") BUILTIN(__builtin_HEXAGON_F2_sfcmpgt,"bff","") BUILTIN(__builtin_HEXAGON_F2_sfcmpge,"bff","") BUILTIN(__builtin_HEXAGON_F2_sfcmpuo,"bff","") BUILTIN(__builtin_HEXAGON_F2_sfmax,"fff","") BUILTIN(__builtin_HEXAGON_F2_sfmin,"fff","") BUILTIN(__builtin_HEXAGON_F2_sfclass,"bfi","") BUILTIN(__builtin_HEXAGON_F2_sfimm_p,"fi","") BUILTIN(__builtin_HEXAGON_F2_sfimm_n,"fi","") BUILTIN(__builtin_HEXAGON_F2_sffixupn,"fff","") BUILTIN(__builtin_HEXAGON_F2_sffixupd,"fff","") BUILTIN(__builtin_HEXAGON_F2_sffixupr,"ff","") BUILTIN(__builtin_HEXAGON_F2_dfadd,"ddd","") BUILTIN(__builtin_HEXAGON_F2_dfsub,"ddd","") BUILTIN(__builtin_HEXAGON_F2_dfmpy,"ddd","") BUILTIN(__builtin_HEXAGON_F2_dffma,"dddd","") BUILTIN(__builtin_HEXAGON_F2_dffms,"dddd","") BUILTIN(__builtin_HEXAGON_F2_dffma_lib,"dddd","") BUILTIN(__builtin_HEXAGON_F2_dffms_lib,"dddd","") BUILTIN(__builtin_HEXAGON_F2_dffma_sc,"ddddi","") BUILTIN(__builtin_HEXAGON_F2_dfmax,"ddd","") BUILTIN(__builtin_HEXAGON_F2_dfmin,"ddd","") BUILTIN(__builtin_HEXAGON_F2_dfcmpeq,"bdd","") BUILTIN(__builtin_HEXAGON_F2_dfcmpgt,"bdd","") BUILTIN(__builtin_HEXAGON_F2_dfcmpge,"bdd","") BUILTIN(__builtin_HEXAGON_F2_dfcmpuo,"bdd","") BUILTIN(__builtin_HEXAGON_F2_dfclass,"bdi","") BUILTIN(__builtin_HEXAGON_F2_dfimm_p,"di","") BUILTIN(__builtin_HEXAGON_F2_dfimm_n,"di","") BUILTIN(__builtin_HEXAGON_F2_dffixupn,"ddd","") BUILTIN(__builtin_HEXAGON_F2_dffixupd,"ddd","") BUILTIN(__builtin_HEXAGON_F2_dffixupr,"dd","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2df,"df","") BUILTIN(__builtin_HEXAGON_F2_conv_df2sf,"fd","") BUILTIN(__builtin_HEXAGON_F2_conv_uw2sf,"fi","") BUILTIN(__builtin_HEXAGON_F2_conv_uw2df,"di","") BUILTIN(__builtin_HEXAGON_F2_conv_w2sf,"fi","") BUILTIN(__builtin_HEXAGON_F2_conv_w2df,"di","") BUILTIN(__builtin_HEXAGON_F2_conv_ud2sf,"fLLi","") BUILTIN(__builtin_HEXAGON_F2_conv_ud2df,"dLLi","") BUILTIN(__builtin_HEXAGON_F2_conv_d2sf,"fLLi","") BUILTIN(__builtin_HEXAGON_F2_conv_d2df,"dLLi","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2uw,"if","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2w,"if","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2ud,"LLif","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2d,"LLif","") BUILTIN(__builtin_HEXAGON_F2_conv_df2uw,"id","") BUILTIN(__builtin_HEXAGON_F2_conv_df2w,"id","") BUILTIN(__builtin_HEXAGON_F2_conv_df2ud,"LLid","") BUILTIN(__builtin_HEXAGON_F2_conv_df2d,"LLid","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2uw_chop,"if","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2w_chop,"if","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2ud_chop,"LLif","") BUILTIN(__builtin_HEXAGON_F2_conv_sf2d_chop,"LLif","") BUILTIN(__builtin_HEXAGON_F2_conv_df2uw_chop,"id","") BUILTIN(__builtin_HEXAGON_F2_conv_df2w_chop,"id","") BUILTIN(__builtin_HEXAGON_F2_conv_df2ud_chop,"LLid","") BUILTIN(__builtin_HEXAGON_F2_conv_df2d_chop,"LLid","") BUILTIN(__builtin_HEXAGON_S2_asr_r_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_p,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_p,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_p,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_p,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_r_acc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_r_acc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_acc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_acc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_p_acc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_p_acc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_acc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_acc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_r_nac,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_r_nac,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_nac,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_nac,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_p_nac,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_p_nac,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_nac,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_nac,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_r_and,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_r_and,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_and,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_and,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_r_or,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_r_or,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_or,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_or,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_p_and,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_p_and,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_and,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_and,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_p_or,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_p_or,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_or,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_or,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_p_xor,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_p_xor,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_xor,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_xor,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_r_sat,"iii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_r_sat,"iii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_p,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_p,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_p,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_r_acc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_acc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_r_acc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_p_acc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_acc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_p_acc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_r_nac,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_nac,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_r_nac,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_p_nac,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_nac,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_p_nac,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_xacc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_r_xacc,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_xacc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_p_xacc,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_r_and,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_and,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_r_and,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_r_or,"iiii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_or,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_r_or,"iiii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_p_and,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_and,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_p_and,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_p_or,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_or,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_p_or,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_r_sat,"iii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_r_rnd,"iii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_r_rnd_goodsyntax,"iii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_p_rnd,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_p_rnd_goodsyntax,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S4_lsli,"iii","") BUILTIN(__builtin_HEXAGON_S2_addasl_rrri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_andi_asl_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_ori_asl_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_addi_asl_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_subi_asl_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_andi_lsr_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_ori_lsr_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_addi_lsr_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S4_subi_lsr_ri,"iiii","") BUILTIN(__builtin_HEXAGON_S2_valignib,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_valignrb,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_vspliceib,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_vsplicerb,"LLiLLiLLii","") BUILTIN(__builtin_HEXAGON_S2_vsplatrh,"LLii","") BUILTIN(__builtin_HEXAGON_S2_vsplatrb,"ii","") BUILTIN(__builtin_HEXAGON_S2_insert,"iiiii","") BUILTIN(__builtin_HEXAGON_S2_tableidxb_goodsyntax,"iiiii","") BUILTIN(__builtin_HEXAGON_S2_tableidxh_goodsyntax,"iiiii","") BUILTIN(__builtin_HEXAGON_S2_tableidxw_goodsyntax,"iiiii","") BUILTIN(__builtin_HEXAGON_S2_tableidxd_goodsyntax,"iiiii","") BUILTIN(__builtin_HEXAGON_A4_bitspliti,"LLiii","") BUILTIN(__builtin_HEXAGON_A4_bitsplit,"LLiii","") BUILTIN(__builtin_HEXAGON_S4_extract,"iiii","") BUILTIN(__builtin_HEXAGON_S2_extractu,"iiii","") BUILTIN(__builtin_HEXAGON_S2_insertp,"LLiLLiLLiii","") BUILTIN(__builtin_HEXAGON_S4_extractp,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_S2_extractup,"LLiLLiii","") BUILTIN(__builtin_HEXAGON_S2_insert_rp,"iiiLLi","") BUILTIN(__builtin_HEXAGON_S4_extract_rp,"iiLLi","") BUILTIN(__builtin_HEXAGON_S2_extractu_rp,"iiLLi","") BUILTIN(__builtin_HEXAGON_S2_insertp_rp,"LLiLLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S4_extractp_rp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_extractup_rp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_tstbit_i,"bii","") BUILTIN(__builtin_HEXAGON_S4_ntstbit_i,"bii","") BUILTIN(__builtin_HEXAGON_S2_setbit_i,"iii","") BUILTIN(__builtin_HEXAGON_S2_togglebit_i,"iii","") BUILTIN(__builtin_HEXAGON_S2_clrbit_i,"iii","") BUILTIN(__builtin_HEXAGON_S2_tstbit_r,"bii","") BUILTIN(__builtin_HEXAGON_S4_ntstbit_r,"bii","") BUILTIN(__builtin_HEXAGON_S2_setbit_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_togglebit_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_clrbit_r,"iii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_vh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_vh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_vh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_vh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S5_asrhub_rnd_sat_goodsyntax,"iLLii","") BUILTIN(__builtin_HEXAGON_S5_asrhub_sat,"iLLii","") BUILTIN(__builtin_HEXAGON_S5_vasrhrnd_goodsyntax,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_vh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_vh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_vh,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_vw,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_i_svw_trun,"iLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_svw_trun,"iLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_i_vw,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_i_vw,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asr_r_vw,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_asl_r_vw,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsr_r_vw,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_lsl_r_vw,"LLiLLii","") BUILTIN(__builtin_HEXAGON_S2_vrndpackwh,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_vrndpackwhs,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_vsxtbh,"LLii","") BUILTIN(__builtin_HEXAGON_S2_vzxtbh,"LLii","") BUILTIN(__builtin_HEXAGON_S2_vsathub,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_svsathub,"ii","") BUILTIN(__builtin_HEXAGON_S2_svsathb,"ii","") BUILTIN(__builtin_HEXAGON_S2_vsathb,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_vtrunohb,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_vtrunewh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_vtrunowh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_vtrunehb,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_vsxthw,"LLii","") BUILTIN(__builtin_HEXAGON_S2_vzxthw,"LLii","") BUILTIN(__builtin_HEXAGON_S2_vsatwh,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_vsatwuh,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_packhl,"LLiii","") BUILTIN(__builtin_HEXAGON_A2_swiz,"ii","") BUILTIN(__builtin_HEXAGON_S2_vsathub_nopack,"LLiLLi","") BUILTIN(__builtin_HEXAGON_S2_vsathb_nopack,"LLiLLi","") BUILTIN(__builtin_HEXAGON_S2_vsatwh_nopack,"LLiLLi","") BUILTIN(__builtin_HEXAGON_S2_vsatwuh_nopack,"LLiLLi","") BUILTIN(__builtin_HEXAGON_S2_shuffob,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_shuffeb,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_shuffoh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_shuffeh,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S5_popcountp,"iLLi","") BUILTIN(__builtin_HEXAGON_S4_parity,"iii","") BUILTIN(__builtin_HEXAGON_S2_parityp,"iLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_lfsp,"LLiLLiLLi","") BUILTIN(__builtin_HEXAGON_S2_clbnorm,"ii","") BUILTIN(__builtin_HEXAGON_S4_clbaddi,"iii","") BUILTIN(__builtin_HEXAGON_S4_clbpnorm,"iLLi","") BUILTIN(__builtin_HEXAGON_S4_clbpaddi,"iLLii","") BUILTIN(__builtin_HEXAGON_S2_clb,"ii","") BUILTIN(__builtin_HEXAGON_S2_cl0,"ii","") BUILTIN(__builtin_HEXAGON_S2_cl1,"ii","") BUILTIN(__builtin_HEXAGON_S2_clbp,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_cl0p,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_cl1p,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_brev,"ii","") BUILTIN(__builtin_HEXAGON_S2_brevp,"LLiLLi","") BUILTIN(__builtin_HEXAGON_S2_ct0,"ii","") BUILTIN(__builtin_HEXAGON_S2_ct1,"ii","") BUILTIN(__builtin_HEXAGON_S2_ct0p,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_ct1p,"iLLi","") BUILTIN(__builtin_HEXAGON_S2_interleave,"LLiLLi","") BUILTIN(__builtin_HEXAGON_S2_deinterleave,"LLiLLi","") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/DiagnosticOptions.h
//===--- DiagnosticOptions.h ------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H #define LLVM_CLANG_BASIC_DIAGNOSTICOPTIONS_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include <string> #include <type_traits> #include <vector> namespace clang { /// \brief Specifies which overload candidates to display when overload /// resolution fails. enum OverloadsShown : unsigned { Ovl_All, ///< Show all overloads. Ovl_Best ///< Show just the "best" overload candidates. }; /// \brief A bitmask representing the diagnostic levels used by /// VerifyDiagnosticConsumer. enum class DiagnosticLevelMask : unsigned { None = 0, Note = 1 << 0, Remark = 1 << 1, Warning = 1 << 2, Error = 1 << 3, All = Note | Remark | Warning | Error }; inline DiagnosticLevelMask operator~(DiagnosticLevelMask M) { using UT = std::underlying_type<DiagnosticLevelMask>::type; return static_cast<DiagnosticLevelMask>(~static_cast<UT>(M)); } inline DiagnosticLevelMask operator|(DiagnosticLevelMask LHS, DiagnosticLevelMask RHS) { using UT = std::underlying_type<DiagnosticLevelMask>::type; return static_cast<DiagnosticLevelMask>( static_cast<UT>(LHS) | static_cast<UT>(RHS)); } inline DiagnosticLevelMask operator&(DiagnosticLevelMask LHS, DiagnosticLevelMask RHS) { using UT = std::underlying_type<DiagnosticLevelMask>::type; return static_cast<DiagnosticLevelMask>( static_cast<UT>(LHS) & static_cast<UT>(RHS)); } raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M); /// \brief Options for controlling the compiler diagnostics engine. class DiagnosticOptions : public RefCountedBase<DiagnosticOptions>{ public: enum TextDiagnosticFormat { Clang, MSVC, Vi }; // Default values. enum { DefaultTabStop = 8, MaxTabStop = 100, DefaultMacroBacktraceLimit = 6, DefaultTemplateBacktraceLimit = 10, DefaultConstexprBacktraceLimit = 10, DefaultSpellCheckingLimit = 50 }; // Define simple diagnostic options (with no accessors). #define DIAGOPT(Name, Bits, Default) unsigned Name : Bits; #define ENUM_DIAGOPT(Name, Type, Bits, Default) #include "clang/Basic/DiagnosticOptions.def" protected: // Define diagnostic options of enumeration type. These are private, and will // have accessors (below). #define DIAGOPT(Name, Bits, Default) #define ENUM_DIAGOPT(Name, Type, Bits, Default) unsigned Name : Bits; #include "clang/Basic/DiagnosticOptions.def" public: /// \brief The file to log diagnostic output to. std::string DiagnosticLogFile; /// \brief The file to serialize diagnostics to (non-appending). std::string DiagnosticSerializationFile; /// The list of -W... options used to alter the diagnostic mappings, with the /// prefixes removed. std::vector<std::string> Warnings; /// The list of -R... options used to alter the diagnostic mappings, with the /// prefixes removed. std::vector<std::string> Remarks; public: // Define accessors/mutators for diagnostic options of enumeration type. #define DIAGOPT(Name, Bits, Default) #define ENUM_DIAGOPT(Name, Type, Bits, Default) \ Type get##Name() const { return static_cast<Type>(Name); } \ void set##Name(Type Value) { Name = static_cast<unsigned>(Value); } #include "clang/Basic/DiagnosticOptions.def" DiagnosticOptions() { #define DIAGOPT(Name, Bits, Default) Name = Default; #define ENUM_DIAGOPT(Name, Type, Bits, Default) set##Name(Default); #include "clang/Basic/DiagnosticOptions.def" } }; typedef DiagnosticOptions::TextDiagnosticFormat TextDiagnosticFormat; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/OperatorPrecedence.h
//===--- OperatorPrecedence.h - Operator precedence levels ------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines and computes precedence levels for binary/ternary operators. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H #define LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H #include "clang/Basic/TokenKinds.h" namespace clang { /// PrecedenceLevels - These are precedences for the binary/ternary /// operators in the C99 grammar. These have been named to relate /// with the C99 grammar productions. Low precedences numbers bind /// more weakly than high numbers. namespace prec { enum Level { Unknown = 0, // Not binary operator. Comma = 1, // , Assignment = 2, // =, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |= Conditional = 3, // ? LogicalOr = 4, // || LogicalAnd = 5, // && InclusiveOr = 6, // | ExclusiveOr = 7, // ^ And = 8, // & Equality = 9, // ==, != Relational = 10, // >=, <=, >, < Shift = 11, // <<, >> Additive = 12, // -, + Multiplicative = 13, // *, /, % PointerToMember = 14 // .*, ->* }; } /// \brief Return the precedence of the specified binary operator token. prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11); } // end namespace clang #endif // LLVM_CLANG_OPERATOR_PRECEDENCE_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsMips.def
//===-- BuiltinsMips.def - Mips Builtin function database --------*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the MIPS-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // MIPS DSP Rev 1 // Add/subtract with optional saturation BUILTIN(__builtin_mips_addu_qb, "V4ScV4ScV4Sc", "n") BUILTIN(__builtin_mips_addu_s_qb, "V4ScV4ScV4Sc", "n") BUILTIN(__builtin_mips_subu_qb, "V4ScV4ScV4Sc", "n") BUILTIN(__builtin_mips_subu_s_qb, "V4ScV4ScV4Sc", "n") BUILTIN(__builtin_mips_addq_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_addq_s_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_subq_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_subq_s_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_madd, "LLiLLiii", "nc") BUILTIN(__builtin_mips_maddu, "LLiLLiUiUi", "nc") BUILTIN(__builtin_mips_msub, "LLiLLiii", "nc") BUILTIN(__builtin_mips_msubu, "LLiLLiUiUi", "nc") BUILTIN(__builtin_mips_addq_s_w, "iii", "n") BUILTIN(__builtin_mips_subq_s_w, "iii", "n") BUILTIN(__builtin_mips_addsc, "iii", "n") BUILTIN(__builtin_mips_addwc, "iii", "n") BUILTIN(__builtin_mips_modsub, "iii", "nc") BUILTIN(__builtin_mips_raddu_w_qb, "iV4Sc", "nc") BUILTIN(__builtin_mips_absq_s_ph, "V2sV2s", "n") BUILTIN(__builtin_mips_absq_s_w, "ii", "n") BUILTIN(__builtin_mips_precrq_qb_ph, "V4ScV2sV2s", "nc") BUILTIN(__builtin_mips_precrqu_s_qb_ph, "V4ScV2sV2s", "n") BUILTIN(__builtin_mips_precrq_ph_w, "V2sii", "nc") BUILTIN(__builtin_mips_precrq_rs_ph_w, "V2sii", "n") BUILTIN(__builtin_mips_preceq_w_phl, "iV2s", "nc") BUILTIN(__builtin_mips_preceq_w_phr, "iV2s", "nc") BUILTIN(__builtin_mips_precequ_ph_qbl, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_precequ_ph_qbr, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_precequ_ph_qbla, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_precequ_ph_qbra, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_preceu_ph_qbl, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_preceu_ph_qbr, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_preceu_ph_qbla, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_preceu_ph_qbra, "V2sV4Sc", "nc") BUILTIN(__builtin_mips_shll_qb, "V4ScV4Sci", "n") BUILTIN(__builtin_mips_shrl_qb, "V4ScV4Sci", "nc") BUILTIN(__builtin_mips_shll_ph, "V2sV2si", "n") BUILTIN(__builtin_mips_shll_s_ph, "V2sV2si", "n") BUILTIN(__builtin_mips_shra_ph, "V2sV2si", "nc") BUILTIN(__builtin_mips_shra_r_ph, "V2sV2si", "nc") BUILTIN(__builtin_mips_shll_s_w, "iii", "n") BUILTIN(__builtin_mips_shra_r_w, "iii", "nc") BUILTIN(__builtin_mips_shilo, "LLiLLii", "nc") BUILTIN(__builtin_mips_muleu_s_ph_qbl, "V2sV4ScV2s", "n") BUILTIN(__builtin_mips_muleu_s_ph_qbr, "V2sV4ScV2s", "n") BUILTIN(__builtin_mips_mulq_rs_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_muleq_s_w_phl, "iV2sV2s", "n") BUILTIN(__builtin_mips_muleq_s_w_phr, "iV2sV2s", "n") BUILTIN(__builtin_mips_mulsaq_s_w_ph, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_maq_s_w_phl, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_maq_s_w_phr, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_maq_sa_w_phl, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_maq_sa_w_phr, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_mult, "LLiii", "nc") BUILTIN(__builtin_mips_multu, "LLiUiUi", "nc") BUILTIN(__builtin_mips_dpau_h_qbl, "LLiLLiV4ScV4Sc", "nc") BUILTIN(__builtin_mips_dpau_h_qbr, "LLiLLiV4ScV4Sc", "nc") BUILTIN(__builtin_mips_dpsu_h_qbl, "LLiLLiV4ScV4Sc", "nc") BUILTIN(__builtin_mips_dpsu_h_qbr, "LLiLLiV4ScV4Sc", "nc") BUILTIN(__builtin_mips_dpaq_s_w_ph, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_dpsq_s_w_ph, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_dpaq_sa_l_w, "LLiLLiii", "n") BUILTIN(__builtin_mips_dpsq_sa_l_w, "LLiLLiii", "n") BUILTIN(__builtin_mips_cmpu_eq_qb, "vV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmpu_lt_qb, "vV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmpu_le_qb, "vV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmpgu_eq_qb, "iV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmpgu_lt_qb, "iV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmpgu_le_qb, "iV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmp_eq_ph, "vV2sV2s", "n") BUILTIN(__builtin_mips_cmp_lt_ph, "vV2sV2s", "n") BUILTIN(__builtin_mips_cmp_le_ph, "vV2sV2s", "n") BUILTIN(__builtin_mips_extr_s_h, "iLLii", "n") BUILTIN(__builtin_mips_extr_w, "iLLii", "n") BUILTIN(__builtin_mips_extr_rs_w, "iLLii", "n") BUILTIN(__builtin_mips_extr_r_w, "iLLii", "n") BUILTIN(__builtin_mips_extp, "iLLii", "n") BUILTIN(__builtin_mips_extpdp, "iLLii", "n") BUILTIN(__builtin_mips_wrdsp, "viIi", "n") BUILTIN(__builtin_mips_rddsp, "iIi", "n") BUILTIN(__builtin_mips_insv, "iii", "n") BUILTIN(__builtin_mips_bitrev, "ii", "nc") BUILTIN(__builtin_mips_packrl_ph, "V2sV2sV2s", "nc") BUILTIN(__builtin_mips_repl_qb, "V4Sci", "nc") BUILTIN(__builtin_mips_repl_ph, "V2si", "nc") BUILTIN(__builtin_mips_pick_qb, "V4ScV4ScV4Sc", "n") BUILTIN(__builtin_mips_pick_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_mthlip, "LLiLLii", "n") BUILTIN(__builtin_mips_bposge32, "i", "n") BUILTIN(__builtin_mips_lbux, "iv*i", "n") BUILTIN(__builtin_mips_lhx, "iv*i", "n") BUILTIN(__builtin_mips_lwx, "iv*i", "n") // MIPS DSP Rev 2 BUILTIN(__builtin_mips_absq_s_qb, "V4ScV4Sc", "n") BUILTIN(__builtin_mips_addqh_ph, "V2sV2sV2s", "nc") BUILTIN(__builtin_mips_addqh_r_ph, "V2sV2sV2s", "nc") BUILTIN(__builtin_mips_addqh_w, "iii", "nc") BUILTIN(__builtin_mips_addqh_r_w, "iii", "nc") BUILTIN(__builtin_mips_addu_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_addu_s_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_adduh_qb, "V4ScV4ScV4Sc", "nc") BUILTIN(__builtin_mips_adduh_r_qb, "V4ScV4ScV4Sc", "nc") BUILTIN(__builtin_mips_append, "iiiIi", "nc") BUILTIN(__builtin_mips_balign, "iiiIi", "nc") BUILTIN(__builtin_mips_cmpgdu_eq_qb, "iV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmpgdu_lt_qb, "iV4ScV4Sc", "n") BUILTIN(__builtin_mips_cmpgdu_le_qb, "iV4ScV4Sc", "n") BUILTIN(__builtin_mips_dpa_w_ph, "LLiLLiV2sV2s", "nc") BUILTIN(__builtin_mips_dps_w_ph, "LLiLLiV2sV2s", "nc") BUILTIN(__builtin_mips_dpaqx_s_w_ph, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_dpaqx_sa_w_ph, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_dpax_w_ph, "LLiLLiV2sV2s", "nc") BUILTIN(__builtin_mips_dpsx_w_ph, "LLiLLiV2sV2s", "nc") BUILTIN(__builtin_mips_dpsqx_s_w_ph, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_dpsqx_sa_w_ph, "LLiLLiV2sV2s", "n") BUILTIN(__builtin_mips_mul_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_mul_s_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_mulq_rs_w, "iii", "n") BUILTIN(__builtin_mips_mulq_s_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_mulq_s_w, "iii", "n") BUILTIN(__builtin_mips_mulsa_w_ph, "LLiLLiV2sV2s", "nc") BUILTIN(__builtin_mips_precr_qb_ph, "V4ScV2sV2s", "n") BUILTIN(__builtin_mips_precr_sra_ph_w, "V2siiIi", "nc") BUILTIN(__builtin_mips_precr_sra_r_ph_w, "V2siiIi", "nc") BUILTIN(__builtin_mips_prepend, "iiiIi", "nc") BUILTIN(__builtin_mips_shra_qb, "V4ScV4Sci", "nc") BUILTIN(__builtin_mips_shra_r_qb, "V4ScV4Sci", "nc") BUILTIN(__builtin_mips_shrl_ph, "V2sV2si", "nc") BUILTIN(__builtin_mips_subqh_ph, "V2sV2sV2s", "nc") BUILTIN(__builtin_mips_subqh_r_ph, "V2sV2sV2s", "nc") BUILTIN(__builtin_mips_subqh_w, "iii", "nc") BUILTIN(__builtin_mips_subqh_r_w, "iii", "nc") BUILTIN(__builtin_mips_subu_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_subu_s_ph, "V2sV2sV2s", "n") BUILTIN(__builtin_mips_subuh_qb, "V4ScV4ScV4Sc", "nc") BUILTIN(__builtin_mips_subuh_r_qb, "V4ScV4ScV4Sc", "nc") // MIPS MSA BUILTIN(__builtin_msa_add_a_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_add_a_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_add_a_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_add_a_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_adds_a_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_adds_a_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_adds_a_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_adds_a_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_adds_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_adds_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_adds_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_adds_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_adds_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_adds_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_adds_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_adds_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_addv_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_addv_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_addv_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_addv_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_addvi_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_addvi_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_addvi_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_addvi_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_and_v, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_andi_b, "V16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_asub_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_asub_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_asub_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_asub_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_asub_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_asub_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_asub_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_asub_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_ave_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_ave_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_ave_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_ave_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_ave_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_ave_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_ave_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_ave_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_aver_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_aver_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_aver_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_aver_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_aver_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_aver_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_aver_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_aver_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_bclr_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_bclr_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_bclr_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_bclr_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_bclri_b, "V16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_bclri_h, "V8UsV8UsIUi", "nc") BUILTIN(__builtin_msa_bclri_w, "V4UiV4UiIUi", "nc") BUILTIN(__builtin_msa_bclri_d, "V2ULLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_binsl_b, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_binsl_h, "V8UsV8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_binsl_w, "V4UiV4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_binsl_d, "V2ULLiV2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_binsli_b, "V16UcV16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_binsli_h, "V8UsV8UsV8UsIUi", "nc") BUILTIN(__builtin_msa_binsli_w, "V4UiV4UiV4UiIUi", "nc") BUILTIN(__builtin_msa_binsli_d, "V2ULLiV2ULLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_binsr_b, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_binsr_h, "V8UsV8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_binsr_w, "V4UiV4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_binsr_d, "V2ULLiV2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_binsri_b, "V16UcV16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_binsri_h, "V8UsV8UsV8UsIUi", "nc") BUILTIN(__builtin_msa_binsri_w, "V4UiV4UiV4UiIUi", "nc") BUILTIN(__builtin_msa_binsri_d, "V2ULLiV2ULLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_bmnz_v, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_bmnzi_b, "V16UcV16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_bmz_v, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_bmzi_b, "V16UcV16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_bneg_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_bneg_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_bneg_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_bneg_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_bnegi_b, "V16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_bnegi_h, "V8UsV8UsIUi", "nc") BUILTIN(__builtin_msa_bnegi_w, "V4UiV4UiIUi", "nc") BUILTIN(__builtin_msa_bnegi_d, "V2ULLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_bnz_b, "iV16Uc", "nc") BUILTIN(__builtin_msa_bnz_h, "iV8Us", "nc") BUILTIN(__builtin_msa_bnz_w, "iV4Ui", "nc") BUILTIN(__builtin_msa_bnz_d, "iV2ULLi", "nc") BUILTIN(__builtin_msa_bnz_v, "iV16Uc", "nc") BUILTIN(__builtin_msa_bsel_v, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_bseli_b, "V16UcV16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_bset_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_bset_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_bset_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_bset_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_bseti_b, "V16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_bseti_h, "V8UsV8UsIUi", "nc") BUILTIN(__builtin_msa_bseti_w, "V4UiV4UiIUi", "nc") BUILTIN(__builtin_msa_bseti_d, "V2ULLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_bz_b, "iV16Uc", "nc") BUILTIN(__builtin_msa_bz_h, "iV8Us", "nc") BUILTIN(__builtin_msa_bz_w, "iV4Ui", "nc") BUILTIN(__builtin_msa_bz_d, "iV2ULLi", "nc") BUILTIN(__builtin_msa_bz_v, "iV16Uc", "nc") BUILTIN(__builtin_msa_ceq_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_ceq_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_ceq_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_ceq_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_ceqi_b, "V16ScV16ScISi", "nc") BUILTIN(__builtin_msa_ceqi_h, "V8SsV8SsISi", "nc") BUILTIN(__builtin_msa_ceqi_w, "V4SiV4SiISi", "nc") BUILTIN(__builtin_msa_ceqi_d, "V2SLLiV2SLLiISi", "nc") BUILTIN(__builtin_msa_cfcmsa, "iIi", "n") BUILTIN(__builtin_msa_cle_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_cle_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_cle_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_cle_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_cle_u_b, "V16ScV16UcV16Uc", "nc") BUILTIN(__builtin_msa_cle_u_h, "V8SsV8UsV8Us", "nc") BUILTIN(__builtin_msa_cle_u_w, "V4SiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_cle_u_d, "V2SLLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_clei_s_b, "V16ScV16ScISi", "nc") BUILTIN(__builtin_msa_clei_s_h, "V8SsV8SsISi", "nc") BUILTIN(__builtin_msa_clei_s_w, "V4SiV4SiISi", "nc") BUILTIN(__builtin_msa_clei_s_d, "V2SLLiV2SLLiISi", "nc") BUILTIN(__builtin_msa_clei_u_b, "V16ScV16UcIUi", "nc") BUILTIN(__builtin_msa_clei_u_h, "V8SsV8UsIUi", "nc") BUILTIN(__builtin_msa_clei_u_w, "V4SiV4UiIUi", "nc") BUILTIN(__builtin_msa_clei_u_d, "V2SLLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_clt_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_clt_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_clt_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_clt_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_clt_u_b, "V16ScV16UcV16Uc", "nc") BUILTIN(__builtin_msa_clt_u_h, "V8SsV8UsV8Us", "nc") BUILTIN(__builtin_msa_clt_u_w, "V4SiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_clt_u_d, "V2SLLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_clti_s_b, "V16ScV16ScISi", "nc") BUILTIN(__builtin_msa_clti_s_h, "V8SsV8SsISi", "nc") BUILTIN(__builtin_msa_clti_s_w, "V4SiV4SiISi", "nc") BUILTIN(__builtin_msa_clti_s_d, "V2SLLiV2SLLiISi", "nc") BUILTIN(__builtin_msa_clti_u_b, "V16ScV16UcIUi", "nc") BUILTIN(__builtin_msa_clti_u_h, "V8SsV8UsIUi", "nc") BUILTIN(__builtin_msa_clti_u_w, "V4SiV4UiIUi", "nc") BUILTIN(__builtin_msa_clti_u_d, "V2SLLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_copy_s_b, "iV16ScIUi", "nc") BUILTIN(__builtin_msa_copy_s_h, "iV8SsIUi", "nc") BUILTIN(__builtin_msa_copy_s_w, "iV4SiIUi", "nc") BUILTIN(__builtin_msa_copy_s_d, "LLiV2SLLiIUi", "nc") BUILTIN(__builtin_msa_copy_u_b, "iV16UcIUi", "nc") BUILTIN(__builtin_msa_copy_u_h, "iV8UsIUi", "nc") BUILTIN(__builtin_msa_copy_u_w, "iV4UiIUi", "nc") BUILTIN(__builtin_msa_copy_u_d, "LLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_ctcmsa, "vIii", "n") BUILTIN(__builtin_msa_div_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_div_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_div_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_div_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_div_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_div_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_div_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_div_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_dotp_s_h, "V8SsV16ScV16Sc", "nc") BUILTIN(__builtin_msa_dotp_s_w, "V4SiV8SsV8Ss", "nc") BUILTIN(__builtin_msa_dotp_s_d, "V2SLLiV4SiV4Si", "nc") BUILTIN(__builtin_msa_dotp_u_h, "V8UsV16UcV16Uc", "nc") BUILTIN(__builtin_msa_dotp_u_w, "V4UiV8UsV8Us", "nc") BUILTIN(__builtin_msa_dotp_u_d, "V2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_dpadd_s_h, "V8SsV8SsV16ScV16Sc", "nc") BUILTIN(__builtin_msa_dpadd_s_w, "V4SiV4SiV8SsV8Ss", "nc") BUILTIN(__builtin_msa_dpadd_s_d, "V2SLLiV2SLLiV4SiV4Si", "nc") BUILTIN(__builtin_msa_dpadd_u_h, "V8UsV8UsV16UcV16Uc", "nc") BUILTIN(__builtin_msa_dpadd_u_w, "V4UiV4UiV8UsV8Us", "nc") BUILTIN(__builtin_msa_dpadd_u_d, "V2ULLiV2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_dpsub_s_h, "V8SsV8SsV16ScV16Sc", "nc") BUILTIN(__builtin_msa_dpsub_s_w, "V4SiV4SiV8SsV8Ss", "nc") BUILTIN(__builtin_msa_dpsub_s_d, "V2SLLiV2SLLiV4SiV4Si", "nc") BUILTIN(__builtin_msa_dpsub_u_h, "V8UsV8UsV16UcV16Uc", "nc") BUILTIN(__builtin_msa_dpsub_u_w, "V4UiV4UiV8UsV8Us", "nc") BUILTIN(__builtin_msa_dpsub_u_d, "V2ULLiV2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_fadd_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fadd_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_fcaf_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcaf_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fceq_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fceq_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fclass_w, "V4iV4f", "nc") BUILTIN(__builtin_msa_fclass_d, "V2LLiV2d", "nc") BUILTIN(__builtin_msa_fcle_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcle_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fclt_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fclt_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fcne_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcne_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fcor_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcor_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fcueq_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcueq_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fcule_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcule_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fcult_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcult_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fcun_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcun_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fcune_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fcune_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fdiv_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fdiv_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_fexdo_h, "V8hV4fV4f", "nc") BUILTIN(__builtin_msa_fexdo_w, "V4fV2dV2d", "nc") BUILTIN(__builtin_msa_fexp2_w, "V4fV4fV4i", "nc") BUILTIN(__builtin_msa_fexp2_d, "V2dV2dV2LLi", "nc") BUILTIN(__builtin_msa_fexupl_w, "V4fV8h", "nc") BUILTIN(__builtin_msa_fexupl_d, "V2dV4f", "nc") BUILTIN(__builtin_msa_fexupr_w, "V4fV8h", "nc") BUILTIN(__builtin_msa_fexupr_d, "V2dV4f", "nc") BUILTIN(__builtin_msa_ffint_s_w, "V4fV4Si", "nc") BUILTIN(__builtin_msa_ffint_s_d, "V2dV2SLLi", "nc") BUILTIN(__builtin_msa_ffint_u_w, "V4fV4Ui", "nc") BUILTIN(__builtin_msa_ffint_u_d, "V2dV2ULLi", "nc") // ffql uses integers since long _Fract is not implemented BUILTIN(__builtin_msa_ffql_w, "V4fV8Ss", "nc") BUILTIN(__builtin_msa_ffql_d, "V2dV4Si", "nc") // ffqr uses integers since long _Fract is not implemented BUILTIN(__builtin_msa_ffqr_w, "V4fV8Ss", "nc") BUILTIN(__builtin_msa_ffqr_d, "V2dV4Si", "nc") BUILTIN(__builtin_msa_fill_b, "V16Sci", "nc") BUILTIN(__builtin_msa_fill_h, "V8Ssi", "nc") BUILTIN(__builtin_msa_fill_w, "V4Sii", "nc") BUILTIN(__builtin_msa_fill_d, "V2SLLiLLi", "nc") BUILTIN(__builtin_msa_flog2_w, "V4fV4f", "nc") BUILTIN(__builtin_msa_flog2_d, "V2dV2d", "nc") BUILTIN(__builtin_msa_fmadd_w, "V4fV4fV4fV4f", "nc") BUILTIN(__builtin_msa_fmadd_d, "V2dV2dV2dV2d", "nc") BUILTIN(__builtin_msa_fmax_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fmax_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_fmax_a_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fmax_a_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_fmin_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fmin_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_fmin_a_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fmin_a_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_fmsub_w, "V4fV4fV4fV4f", "nc") BUILTIN(__builtin_msa_fmsub_d, "V2dV2dV2dV2d", "nc") BUILTIN(__builtin_msa_fmul_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fmul_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_frint_w, "V4fV4f", "nc") BUILTIN(__builtin_msa_frint_d, "V2dV2d", "nc") BUILTIN(__builtin_msa_frcp_w, "V4fV4f", "nc") BUILTIN(__builtin_msa_frcp_d, "V2dV2d", "nc") BUILTIN(__builtin_msa_frsqrt_w, "V4fV4f", "nc") BUILTIN(__builtin_msa_frsqrt_d, "V2dV2d", "nc") BUILTIN(__builtin_msa_fsaf_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsaf_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fseq_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fseq_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsle_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsle_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fslt_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fslt_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsne_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsne_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsor_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsor_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsqrt_w, "V4fV4f", "nc") BUILTIN(__builtin_msa_fsqrt_d, "V2dV2d", "nc") BUILTIN(__builtin_msa_fsub_w, "V4fV4fV4f", "nc") BUILTIN(__builtin_msa_fsub_d, "V2dV2dV2d", "nc") BUILTIN(__builtin_msa_fsueq_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsueq_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsule_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsule_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsult_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsult_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsun_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsun_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_fsune_w, "V4iV4fV4f", "nc") BUILTIN(__builtin_msa_fsune_d, "V2LLiV2dV2d", "nc") BUILTIN(__builtin_msa_ftint_s_w, "V4SiV4f", "nc") BUILTIN(__builtin_msa_ftint_s_d, "V2SLLiV2d", "nc") BUILTIN(__builtin_msa_ftint_u_w, "V4UiV4f", "nc") BUILTIN(__builtin_msa_ftint_u_d, "V2ULLiV2d", "nc") BUILTIN(__builtin_msa_ftq_h, "V4UiV4fV4f", "nc") BUILTIN(__builtin_msa_ftq_w, "V2ULLiV2dV2d", "nc") BUILTIN(__builtin_msa_ftrunc_s_w, "V4SiV4f", "nc") BUILTIN(__builtin_msa_ftrunc_s_d, "V2SLLiV2d", "nc") BUILTIN(__builtin_msa_ftrunc_u_w, "V4UiV4f", "nc") BUILTIN(__builtin_msa_ftrunc_u_d, "V2ULLiV2d", "nc") BUILTIN(__builtin_msa_hadd_s_h, "V8SsV16ScV16Sc", "nc") BUILTIN(__builtin_msa_hadd_s_w, "V4SiV8SsV8Ss", "nc") BUILTIN(__builtin_msa_hadd_s_d, "V2SLLiV4SiV4Si", "nc") BUILTIN(__builtin_msa_hadd_u_h, "V8UsV16UcV16Uc", "nc") BUILTIN(__builtin_msa_hadd_u_w, "V4UiV8UsV8Us", "nc") BUILTIN(__builtin_msa_hadd_u_d, "V2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_hsub_s_h, "V8SsV16ScV16Sc", "nc") BUILTIN(__builtin_msa_hsub_s_w, "V4SiV8SsV8Ss", "nc") BUILTIN(__builtin_msa_hsub_s_d, "V2SLLiV4SiV4Si", "nc") BUILTIN(__builtin_msa_hsub_u_h, "V8UsV16UcV16Uc", "nc") BUILTIN(__builtin_msa_hsub_u_w, "V4UiV8UsV8Us", "nc") BUILTIN(__builtin_msa_hsub_u_d, "V2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_ilvev_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_ilvev_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_ilvev_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_ilvev_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_ilvl_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_ilvl_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_ilvl_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_ilvl_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_ilvod_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_ilvod_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_ilvod_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_ilvod_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_ilvr_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_ilvr_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_ilvr_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_ilvr_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_insert_b, "V16ScV16ScIUii", "nc") BUILTIN(__builtin_msa_insert_h, "V8SsV8SsIUii", "nc") BUILTIN(__builtin_msa_insert_w, "V4SiV4SiIUii", "nc") BUILTIN(__builtin_msa_insert_d, "V2SLLiV2SLLiIUiLLi", "nc") BUILTIN(__builtin_msa_insve_b, "V16ScV16ScIUiV16Sc", "nc") BUILTIN(__builtin_msa_insve_h, "V8SsV8SsIUiV8Ss", "nc") BUILTIN(__builtin_msa_insve_w, "V4SiV4SiIUiV4Si", "nc") BUILTIN(__builtin_msa_insve_d, "V2SLLiV2SLLiIUiV2SLLi", "nc") BUILTIN(__builtin_msa_ld_b, "V16Scv*Ii", "nc") BUILTIN(__builtin_msa_ld_h, "V8Ssv*Ii", "nc") BUILTIN(__builtin_msa_ld_w, "V4Siv*Ii", "nc") BUILTIN(__builtin_msa_ld_d, "V2SLLiv*Ii", "nc") BUILTIN(__builtin_msa_ldi_b, "V16cIi", "nc") BUILTIN(__builtin_msa_ldi_h, "V8sIi", "nc") BUILTIN(__builtin_msa_ldi_w, "V4iIi", "nc") BUILTIN(__builtin_msa_ldi_d, "V2LLiIi", "nc") BUILTIN(__builtin_msa_madd_q_h, "V8SsV8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_madd_q_w, "V4SiV4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_maddr_q_h, "V8SsV8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_maddr_q_w, "V4SiV4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_maddv_b, "V16ScV16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_maddv_h, "V8SsV8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_maddv_w, "V4SiV4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_maddv_d, "V2SLLiV2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_max_a_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_max_a_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_max_a_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_max_a_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_max_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_max_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_max_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_max_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_max_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_max_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_max_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_max_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_maxi_s_b, "V16ScV16ScIi", "nc") BUILTIN(__builtin_msa_maxi_s_h, "V8SsV8SsIi", "nc") BUILTIN(__builtin_msa_maxi_s_w, "V4SiV4SiIi", "nc") BUILTIN(__builtin_msa_maxi_s_d, "V2SLLiV2SLLiIi", "nc") BUILTIN(__builtin_msa_maxi_u_b, "V16UcV16UcIi", "nc") BUILTIN(__builtin_msa_maxi_u_h, "V8UsV8UsIi", "nc") BUILTIN(__builtin_msa_maxi_u_w, "V4UiV4UiIi", "nc") BUILTIN(__builtin_msa_maxi_u_d, "V2ULLiV2ULLiIi", "nc") BUILTIN(__builtin_msa_min_a_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_min_a_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_min_a_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_min_a_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_min_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_min_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_min_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_min_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_min_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_min_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_min_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_min_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_mini_s_b, "V16ScV16ScIi", "nc") BUILTIN(__builtin_msa_mini_s_h, "V8SsV8SsIi", "nc") BUILTIN(__builtin_msa_mini_s_w, "V4SiV4SiIi", "nc") BUILTIN(__builtin_msa_mini_s_d, "V2SLLiV2SLLiIi", "nc") BUILTIN(__builtin_msa_mini_u_b, "V16UcV16UcIi", "nc") BUILTIN(__builtin_msa_mini_u_h, "V8UsV8UsIi", "nc") BUILTIN(__builtin_msa_mini_u_w, "V4UiV4UiIi", "nc") BUILTIN(__builtin_msa_mini_u_d, "V2ULLiV2ULLiIi", "nc") BUILTIN(__builtin_msa_mod_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_mod_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_mod_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_mod_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_mod_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_mod_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_mod_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_mod_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_move_v, "V16ScV16Sc", "nc") BUILTIN(__builtin_msa_msub_q_h, "V8SsV8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_msub_q_w, "V4SiV4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_msubr_q_h, "V8SsV8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_msubr_q_w, "V4SiV4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_msubv_b, "V16ScV16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_msubv_h, "V8SsV8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_msubv_w, "V4SiV4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_msubv_d, "V2SLLiV2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_mul_q_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_mul_q_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_mulr_q_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_mulr_q_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_mulv_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_mulv_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_mulv_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_mulv_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_nloc_b, "V16ScV16Sc", "nc") BUILTIN(__builtin_msa_nloc_h, "V8SsV8Ss", "nc") BUILTIN(__builtin_msa_nloc_w, "V4SiV4Si", "nc") BUILTIN(__builtin_msa_nloc_d, "V2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_nlzc_b, "V16ScV16Sc", "nc") BUILTIN(__builtin_msa_nlzc_h, "V8SsV8Ss", "nc") BUILTIN(__builtin_msa_nlzc_w, "V4SiV4Si", "nc") BUILTIN(__builtin_msa_nlzc_d, "V2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_nor_v, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_nori_b, "V16UcV16cIUi", "nc") BUILTIN(__builtin_msa_or_v, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_ori_b, "V16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_pckev_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_pckev_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_pckev_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_pckev_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_pckod_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_pckod_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_pckod_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_pckod_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_pcnt_b, "V16ScV16Sc", "nc") BUILTIN(__builtin_msa_pcnt_h, "V8SsV8Ss", "nc") BUILTIN(__builtin_msa_pcnt_w, "V4SiV4Si", "nc") BUILTIN(__builtin_msa_pcnt_d, "V2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_sat_s_b, "V16ScV16ScIUi", "nc") BUILTIN(__builtin_msa_sat_s_h, "V8SsV8SsIUi", "nc") BUILTIN(__builtin_msa_sat_s_w, "V4SiV4SiIUi", "nc") BUILTIN(__builtin_msa_sat_s_d, "V2SLLiV2SLLiIUi", "nc") BUILTIN(__builtin_msa_sat_u_b, "V16UcV16UcIUi", "nc") BUILTIN(__builtin_msa_sat_u_h, "V8UsV8UsIUi", "nc") BUILTIN(__builtin_msa_sat_u_w, "V4UiV4UiIUi", "nc") BUILTIN(__builtin_msa_sat_u_d, "V2ULLiV2ULLiIUi", "nc") BUILTIN(__builtin_msa_shf_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_shf_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_shf_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_sld_b, "V16cV16cV16cUi", "nc") BUILTIN(__builtin_msa_sld_h, "V8sV8sV8sUi", "nc") BUILTIN(__builtin_msa_sld_w, "V4iV4iV4iUi", "nc") BUILTIN(__builtin_msa_sld_d, "V2LLiV2LLiV2LLiUi", "nc") BUILTIN(__builtin_msa_sldi_b, "V16cV16cV16cIUi", "nc") BUILTIN(__builtin_msa_sldi_h, "V8sV8sV8sIUi", "nc") BUILTIN(__builtin_msa_sldi_w, "V4iV4iV4iIUi", "nc") BUILTIN(__builtin_msa_sldi_d, "V2LLiV2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_sll_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_sll_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_sll_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_sll_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_slli_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_slli_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_slli_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_slli_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_splat_b, "V16cV16cUi", "nc") BUILTIN(__builtin_msa_splat_h, "V8sV8sUi", "nc") BUILTIN(__builtin_msa_splat_w, "V4iV4iUi", "nc") BUILTIN(__builtin_msa_splat_d, "V2LLiV2LLiUi", "nc") BUILTIN(__builtin_msa_splati_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_splati_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_splati_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_splati_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_sra_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_sra_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_sra_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_sra_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_srai_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_srai_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_srai_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_srai_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_srar_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_srar_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_srar_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_srar_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_srari_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_srari_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_srari_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_srari_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_srl_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_srl_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_srl_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_srl_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_srli_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_srli_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_srli_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_srli_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_srlr_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_srlr_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_srlr_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_srlr_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_srlri_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_srlri_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_srlri_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_srlri_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_st_b, "vV16Scv*Ii", "nc") BUILTIN(__builtin_msa_st_h, "vV8Ssv*Ii", "nc") BUILTIN(__builtin_msa_st_w, "vV4Siv*Ii", "nc") BUILTIN(__builtin_msa_st_d, "vV2SLLiv*Ii", "nc") BUILTIN(__builtin_msa_subs_s_b, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_msa_subs_s_h, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_msa_subs_s_w, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_msa_subs_s_d, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_msa_subs_u_b, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_msa_subs_u_h, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_msa_subs_u_w, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_subs_u_d, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_subsus_u_b, "V16UcV16UcV16Sc", "nc") BUILTIN(__builtin_msa_subsus_u_h, "V8UsV8UsV8Ss", "nc") BUILTIN(__builtin_msa_subsus_u_w, "V4UiV4UiV4Si", "nc") BUILTIN(__builtin_msa_subsus_u_d, "V2ULLiV2ULLiV2SLLi", "nc") BUILTIN(__builtin_msa_subsuu_s_b, "V16ScV16UcV16Uc", "nc") BUILTIN(__builtin_msa_subsuu_s_h, "V8SsV8UsV8Us", "nc") BUILTIN(__builtin_msa_subsuu_s_w, "V4SiV4UiV4Ui", "nc") BUILTIN(__builtin_msa_subsuu_s_d, "V2SLLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_msa_subv_b, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_subv_h, "V8sV8sV8s", "nc") BUILTIN(__builtin_msa_subv_w, "V4iV4iV4i", "nc") BUILTIN(__builtin_msa_subv_d, "V2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_subvi_b, "V16cV16cIUi", "nc") BUILTIN(__builtin_msa_subvi_h, "V8sV8sIUi", "nc") BUILTIN(__builtin_msa_subvi_w, "V4iV4iIUi", "nc") BUILTIN(__builtin_msa_subvi_d, "V2LLiV2LLiIUi", "nc") BUILTIN(__builtin_msa_vshf_b, "V16cV16cV16cV16c", "nc") BUILTIN(__builtin_msa_vshf_h, "V8sV8sV8sV8s", "nc") BUILTIN(__builtin_msa_vshf_w, "V4iV4iV4iV4i", "nc") BUILTIN(__builtin_msa_vshf_d, "V2LLiV2LLiV2LLiV2LLi", "nc") BUILTIN(__builtin_msa_xor_v, "V16cV16cV16c", "nc") BUILTIN(__builtin_msa_xori_b, "V16cV16cIUi", "nc") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Sanitizers.h
//===--- Sanitizers.h - C Language Family Language Options ------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::SanitizerKind enum. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SANITIZERS_H #define LLVM_CLANG_BASIC_SANITIZERS_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/MathExtras.h" namespace clang { typedef uint64_t SanitizerMask; namespace SanitizerKind { // Assign ordinals to possible values of -fsanitize= flag, which we will use as // bit positions. enum SanitizerOrdinal : uint64_t { #define SANITIZER(NAME, ID) SO_##ID, #define SANITIZER_GROUP(NAME, ID, ALIAS) SO_##ID##Group, #include "clang/Basic/Sanitizers.def" SO_Count }; // Define the set of sanitizer kinds, as well as the set of sanitizers each // sanitizer group expands into. #define SANITIZER(NAME, ID) \ const SanitizerMask ID = 1ULL << SO_##ID; #define SANITIZER_GROUP(NAME, ID, ALIAS) \ const SanitizerMask ID = ALIAS; \ const SanitizerMask ID##Group = 1ULL << SO_##ID##Group; #include "clang/Basic/Sanitizers.def" } struct SanitizerSet { SanitizerSet() : Mask(0) {} /// \brief Check if a certain (single) sanitizer is enabled. bool has(SanitizerMask K) const { assert(llvm::isPowerOf2_64(K)); return Mask & K; } /// \brief Check if one or more sanitizers are enabled. bool hasOneOf(SanitizerMask K) const { return Mask & K; } /// \brief Enable or disable a certain (single) sanitizer. void set(SanitizerMask K, bool Value) { assert(llvm::isPowerOf2_64(K)); Mask = Value ? (Mask | K) : (Mask & ~K); } /// \brief Disable all sanitizers. void clear() { Mask = 0; } /// \brief Returns true if at least one sanitizer is enabled. bool empty() const { return Mask == 0; } /// \brief Bitmask of enabled sanitizers. SanitizerMask Mask; }; /// Parse a single value from a -fsanitize= or -fno-sanitize= value list. /// Returns a non-zero SanitizerMask, or \c 0 if \p Value is not known. SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups); /// For each sanitizer group bit set in \p Kinds, set the bits for sanitizers /// this group enables. SanitizerMask expandSanitizerGroups(SanitizerMask Kinds); } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/SourceManagerInternals.h
//===--- SourceManagerInternals.h - SourceManager Internals -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines implementation details of the clang::SourceManager class. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H #define LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/StringMap.h" #include <map> namespace clang { //===----------------------------------------------------------------------===// // Line Table Implementation // // /////////////////////////////////////////////////////////////////////////////// struct LineEntry { /// \brief The offset in this file that the line entry occurs at. unsigned FileOffset; /// \brief The presumed line number of this line entry: \#line 4. unsigned LineNo; /// \brief The ID of the filename identified by this line entry: /// \#line 4 "foo.c". This is -1 if not specified. int FilenameID; /// \brief Set the 0 if no flags, 1 if a system header, SrcMgr::CharacteristicKind FileKind; /// \brief The offset of the virtual include stack location, /// which is manipulated by GNU linemarker directives. /// /// If this is 0 then there is no virtual \#includer. unsigned IncludeOffset; static LineEntry get(unsigned Offs, unsigned Line, int Filename, SrcMgr::CharacteristicKind FileKind, unsigned IncludeOffset) { LineEntry E; E.FileOffset = Offs; E.LineNo = Line; E.FilenameID = Filename; E.FileKind = FileKind; E.IncludeOffset = IncludeOffset; return E; } }; // needed for FindNearestLineEntry (upper_bound of LineEntry) inline bool operator<(const LineEntry &lhs, const LineEntry &rhs) { // FIXME: should check the other field? return lhs.FileOffset < rhs.FileOffset; } inline bool operator<(const LineEntry &E, unsigned Offset) { return E.FileOffset < Offset; } inline bool operator<(unsigned Offset, const LineEntry &E) { return Offset < E.FileOffset; } /// \brief Used to hold and unique data used to represent \#line information. class LineTableInfo { /// \brief Map used to assign unique IDs to filenames in \#line directives. /// /// This allows us to unique the filenames that /// frequently reoccur and reference them with indices. FilenameIDs holds /// the mapping from string -> ID, and FilenamesByID holds the mapping of ID /// to string. llvm::StringMap<unsigned, llvm::BumpPtrAllocator> FilenameIDs; std::vector<llvm::StringMapEntry<unsigned>*> FilenamesByID; /// \brief Map from FileIDs to a list of line entries (sorted by the offset /// at which they occur in the file). std::map<FileID, std::vector<LineEntry> > LineEntries; public: void clear() { FilenameIDs.clear(); FilenamesByID.clear(); LineEntries.clear(); } unsigned getLineTableFilenameID(StringRef Str); const char *getFilename(unsigned ID) const { assert(ID < FilenamesByID.size() && "Invalid FilenameID"); return FilenamesByID[ID]->getKeyData(); } unsigned getNumFilenames() const { return FilenamesByID.size(); } void AddLineNote(FileID FID, unsigned Offset, unsigned LineNo, int FilenameID); void AddLineNote(FileID FID, unsigned Offset, unsigned LineNo, int FilenameID, unsigned EntryExit, SrcMgr::CharacteristicKind FileKind); /// \brief Find the line entry nearest to FID that is before it. /// /// If there is no line entry before \p Offset in \p FID, returns null. const LineEntry *FindNearestLineEntry(FileID FID, unsigned Offset); // Low-level access typedef std::map<FileID, std::vector<LineEntry> >::iterator iterator; iterator begin() { return LineEntries.begin(); } iterator end() { return LineEntries.end(); } /// \brief Add a new line entry that has already been encoded into /// the internal representation of the line table. void AddEntry(FileID FID, const std::vector<LineEntry> &Entries); }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Diagnostic.h
//===--- Diagnostic.h - C Language Family Diagnostic Handling ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the Diagnostic-related interfaces. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_DIAGNOSTIC_H #define LLVM_CLANG_BASIC_DIAGNOSTIC_H #include "clang/Basic/DiagnosticIDs.h" #include "clang/Basic/DiagnosticOptions.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/Specifiers.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/iterator_range.h" #include "llvm/ADT/SmallVector.h" #include <list> #include <vector> namespace clang { class DeclContext; class DiagnosticBuilder; class DiagnosticConsumer; class DiagnosticErrorTrap; class DiagnosticOptions; class IdentifierInfo; class LangOptions; class Preprocessor; class StoredDiagnostic; namespace tok { enum TokenKind : unsigned short; } /// \brief Annotates a diagnostic with some code that should be /// inserted, removed, or replaced to fix the problem. /// /// This kind of hint should be used when we are certain that the /// introduction, removal, or modification of a particular (small!) /// amount of code will correct a compilation error. The compiler /// should also provide full recovery from such errors, such that /// suppressing the diagnostic output can still result in successful /// compilation. class FixItHint { public: /// \brief Code that should be replaced to correct the error. Empty for an /// insertion hint. CharSourceRange RemoveRange; /// \brief Code in the specific range that should be inserted in the insertion /// location. CharSourceRange InsertFromRange; /// \brief The actual code to insert at the insertion location, as a /// string. std::string CodeToInsert; bool BeforePreviousInsertions; /// \brief Empty code modification hint, indicating that no code /// modification is known. FixItHint() : BeforePreviousInsertions(false) { } bool isNull() const { return !RemoveRange.isValid(); } /// \brief Create a code modification hint that inserts the given /// code string at a specific location. static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions = false) { FixItHint Hint; Hint.RemoveRange = CharSourceRange::getCharRange(InsertionLoc, InsertionLoc); Hint.CodeToInsert = Code; Hint.BeforePreviousInsertions = BeforePreviousInsertions; return Hint; } /// \brief Create a code modification hint that inserts the given /// code from \p FromRange at a specific location. static FixItHint CreateInsertionFromRange(SourceLocation InsertionLoc, CharSourceRange FromRange, bool BeforePreviousInsertions = false) { FixItHint Hint; Hint.RemoveRange = CharSourceRange::getCharRange(InsertionLoc, InsertionLoc); Hint.InsertFromRange = FromRange; Hint.BeforePreviousInsertions = BeforePreviousInsertions; return Hint; } /// \brief Create a code modification hint that removes the given /// source range. static FixItHint CreateRemoval(CharSourceRange RemoveRange) { FixItHint Hint; Hint.RemoveRange = RemoveRange; return Hint; } static FixItHint CreateRemoval(SourceRange RemoveRange) { return CreateRemoval(CharSourceRange::getTokenRange(RemoveRange)); } /// \brief Create a code modification hint that replaces the given /// source range with the given code string. static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code) { FixItHint Hint; Hint.RemoveRange = RemoveRange; Hint.CodeToInsert = Code; return Hint; } static FixItHint CreateReplacement(SourceRange RemoveRange, StringRef Code) { return CreateReplacement(CharSourceRange::getTokenRange(RemoveRange), Code); } }; /// \brief Concrete class used by the front-end to report problems and issues. /// /// This massages the diagnostics (e.g. handling things like "report warnings /// as errors" and passes them off to the DiagnosticConsumer for reporting to /// the user. DiagnosticsEngine is tied to one translation unit and one /// SourceManager. class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> { DiagnosticsEngine(const DiagnosticsEngine &) = delete; void operator=(const DiagnosticsEngine &) = delete; public: /// \brief The level of the diagnostic, after it has been through mapping. enum Level { Ignored = DiagnosticIDs::Ignored, Note = DiagnosticIDs::Note, Remark = DiagnosticIDs::Remark, Warning = DiagnosticIDs::Warning, Error = DiagnosticIDs::Error, Fatal = DiagnosticIDs::Fatal }; enum ArgumentKind { ak_std_string, ///< std::string ak_c_string, ///< const char * ak_sint, ///< int ak_uint, ///< unsigned ak_tokenkind, ///< enum TokenKind : unsigned ak_identifierinfo, ///< IdentifierInfo ak_qualtype, ///< QualType ak_declarationname, ///< DeclarationName ak_nameddecl, ///< NamedDecl * ak_nestednamespec, ///< NestedNameSpecifier * ak_declcontext, ///< DeclContext * ak_qualtype_pair, ///< pair<QualType, QualType> ak_attr ///< Attr * }; /// \brief Represents on argument value, which is a union discriminated /// by ArgumentKind, with a value. typedef std::pair<ArgumentKind, intptr_t> ArgumentValue; private: unsigned char AllExtensionsSilenced; // Used by __extension__ bool IgnoreAllWarnings; // Ignore all warnings: -w bool WarningsAsErrors; // Treat warnings like errors. bool EnableAllWarnings; // Enable all warnings. bool ErrorsAsFatal; // Treat errors like fatal errors. bool SuppressSystemWarnings; // Suppress warnings in system headers. bool SuppressAllDiagnostics; // Suppress all diagnostics. bool ElideType; // Elide common types of templates. bool PrintTemplateTree; // Print a tree when comparing templates. bool ShowColors; // Color printing is enabled. OverloadsShown ShowOverloads; // Which overload candidates to show. unsigned ErrorLimit; // Cap of # errors emitted, 0 -> no limit. unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack, // 0 -> no limit. unsigned ConstexprBacktraceLimit; // Cap on depth of constexpr evaluation // backtrace stack, 0 -> no limit. diag::Severity ExtBehavior; // Map extensions to warnings or errors? IntrusiveRefCntPtr<DiagnosticIDs> Diags; IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; DiagnosticConsumer *Client; std::unique_ptr<DiagnosticConsumer> Owner; SourceManager *SourceMgr; /// \brief Mapping information for diagnostics. /// /// Mapping info is packed into four bits per diagnostic. The low three /// bits are the mapping (an instance of diag::Severity), or zero if unset. /// The high bit is set when the mapping was established as a user mapping. /// If the high bit is clear, then the low bits are set to the default /// value, and should be mapped with -pedantic, -Werror, etc. /// /// A new DiagState is created and kept around when diagnostic pragmas modify /// the state so that we know what is the diagnostic state at any given /// source location. class DiagState { llvm::DenseMap<unsigned, DiagnosticMapping> DiagMap; public: typedef llvm::DenseMap<unsigned, DiagnosticMapping>::iterator iterator; typedef llvm::DenseMap<unsigned, DiagnosticMapping>::const_iterator const_iterator; void setMapping(diag::kind Diag, DiagnosticMapping Info) { DiagMap[Diag] = Info; } DiagnosticMapping &getOrAddMapping(diag::kind Diag); const_iterator begin() const { return DiagMap.begin(); } const_iterator end() const { return DiagMap.end(); } }; /// \brief Keeps and automatically disposes all DiagStates that we create. std::list<DiagState> DiagStates; /// \brief Represents a point in source where the diagnostic state was /// modified because of a pragma. /// /// 'Loc' can be null if the point represents the diagnostic state /// modifications done through the command-line. struct DiagStatePoint { DiagState *State; FullSourceLoc Loc; DiagStatePoint(DiagState *State, FullSourceLoc Loc) : State(State), Loc(Loc) { } bool operator<(const DiagStatePoint &RHS) const { // If Loc is invalid it means it came from <command-line>, in which case // we regard it as coming before any valid source location. if (RHS.Loc.isInvalid()) return false; if (Loc.isInvalid()) return true; return Loc.isBeforeInTranslationUnitThan(RHS.Loc); } }; /// \brief A sorted vector of all DiagStatePoints representing changes in /// diagnostic state due to diagnostic pragmas. /// /// The vector is always sorted according to the SourceLocation of the /// DiagStatePoint. typedef std::vector<DiagStatePoint> DiagStatePointsTy; mutable DiagStatePointsTy DiagStatePoints; /// \brief Keeps the DiagState that was active during each diagnostic 'push' /// so we can get back at it when we 'pop'. std::vector<DiagState *> DiagStateOnPushStack; DiagState *GetCurDiagState() const { assert(!DiagStatePoints.empty()); return DiagStatePoints.back().State; } void PushDiagStatePoint(DiagState *State, SourceLocation L) { FullSourceLoc Loc(L, getSourceManager()); // Make sure that DiagStatePoints is always sorted according to Loc. assert(Loc.isValid() && "Adding invalid loc point"); assert(!DiagStatePoints.empty() && (DiagStatePoints.back().Loc.isInvalid() || DiagStatePoints.back().Loc.isBeforeInTranslationUnitThan(Loc)) && "Previous point loc comes after or is the same as new one"); DiagStatePoints.push_back(DiagStatePoint(State, Loc)); } /// \brief Finds the DiagStatePoint that contains the diagnostic state of /// the given source location. DiagStatePointsTy::iterator GetDiagStatePointForLoc(SourceLocation Loc) const; /// \brief Sticky flag set to \c true when an error is emitted. bool ErrorOccurred; /// \brief Sticky flag set to \c true when an "uncompilable error" occurs. /// I.e. an error that was not upgraded from a warning by -Werror. bool UncompilableErrorOccurred; /// \brief Sticky flag set to \c true when a fatal error is emitted. bool FatalErrorOccurred; /// \brief Indicates that an unrecoverable error has occurred. bool UnrecoverableErrorOccurred; /// \brief Counts for DiagnosticErrorTrap to check whether an error occurred /// during a parsing section, e.g. during parsing a function. unsigned TrapNumErrorsOccurred; unsigned TrapNumUnrecoverableErrorsOccurred; /// \brief The level of the last diagnostic emitted. /// /// This is used to emit continuation diagnostics with the same level as the /// diagnostic that they follow. DiagnosticIDs::Level LastDiagLevel; unsigned NumWarnings; ///< Number of warnings reported unsigned NumErrors; ///< Number of errors reported /// \brief A function pointer that converts an opaque diagnostic /// argument to a strings. /// /// This takes the modifiers and argument that was present in the diagnostic. /// /// The PrevArgs array indicates the previous arguments formatted for this /// diagnostic. Implementations of this function can use this information to /// avoid redundancy across arguments. /// /// This is a hack to avoid a layering violation between libbasic and libsema. typedef void (*ArgToStringFnTy)( ArgumentKind Kind, intptr_t Val, StringRef Modifier, StringRef Argument, ArrayRef<ArgumentValue> PrevArgs, SmallVectorImpl<char> &Output, void *Cookie, ArrayRef<intptr_t> QualTypeVals); void *ArgToStringCookie; ArgToStringFnTy ArgToStringFn; /// \brief ID of the "delayed" diagnostic, which is a (typically /// fatal) diagnostic that had to be delayed because it was found /// while emitting another diagnostic. unsigned DelayedDiagID; /// \brief First string argument for the delayed diagnostic. std::string DelayedDiagArg1; /// \brief Second string argument for the delayed diagnostic. std::string DelayedDiagArg2; /// \brief Optional flag value. /// /// Some flags accept values, for instance: -Wframe-larger-than=<value> and /// -Rpass=<value>. The content of this string is emitted after the flag name /// and '='. std::string FlagValue; public: explicit DiagnosticsEngine( const IntrusiveRefCntPtr<DiagnosticIDs> &Diags, DiagnosticOptions *DiagOpts, DiagnosticConsumer *client = nullptr, bool ShouldOwnClient = true); ~DiagnosticsEngine(); const IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const { return Diags; } /// \brief Retrieve the diagnostic options. DiagnosticOptions &getDiagnosticOptions() const { return *DiagOpts; } typedef llvm::iterator_range<DiagState::const_iterator> diag_mapping_range; /// \brief Get the current set of diagnostic mappings. diag_mapping_range getDiagnosticMappings() const { const DiagState &DS = *GetCurDiagState(); return diag_mapping_range(DS.begin(), DS.end()); } DiagnosticConsumer *getClient() { return Client; } const DiagnosticConsumer *getClient() const { return Client; } /// \brief Determine whether this \c DiagnosticsEngine object own its client. bool ownsClient() const { return Owner != nullptr; } /// \brief Return the current diagnostic client along with ownership of that /// client. std::unique_ptr<DiagnosticConsumer> takeClient() { return std::move(Owner); } bool hasSourceManager() const { return SourceMgr != nullptr; } SourceManager &getSourceManager() const { assert(SourceMgr && "SourceManager not set!"); return *SourceMgr; } void setSourceManager(SourceManager *SrcMgr) { SourceMgr = SrcMgr; } //===--------------------------------------------------------------------===// // DiagnosticsEngine characterization methods, used by a client to customize // how diagnostics are emitted. // /// \brief Copies the current DiagMappings and pushes the new copy /// onto the top of the stack. void pushMappings(SourceLocation Loc); /// \brief Pops the current DiagMappings off the top of the stack, /// causing the new top of the stack to be the active mappings. /// /// \returns \c true if the pop happens, \c false if there is only one /// DiagMapping on the stack. bool popMappings(SourceLocation Loc); /// \brief Set the diagnostic client associated with this diagnostic object. /// /// \param ShouldOwnClient true if the diagnostic object should take /// ownership of \c client. void setClient(DiagnosticConsumer *client, bool ShouldOwnClient = true); /// \brief Specify a limit for the number of errors we should /// emit before giving up. /// /// Zero disables the limit. void setErrorLimit(unsigned Limit) { ErrorLimit = Limit; } /// \brief Specify the maximum number of template instantiation /// notes to emit along with a given diagnostic. void setTemplateBacktraceLimit(unsigned Limit) { TemplateBacktraceLimit = Limit; } /// \brief Retrieve the maximum number of template instantiation /// notes to emit along with a given diagnostic. unsigned getTemplateBacktraceLimit() const { return TemplateBacktraceLimit; } /// \brief Specify the maximum number of constexpr evaluation /// notes to emit along with a given diagnostic. void setConstexprBacktraceLimit(unsigned Limit) { ConstexprBacktraceLimit = Limit; } /// \brief Retrieve the maximum number of constexpr evaluation /// notes to emit along with a given diagnostic. unsigned getConstexprBacktraceLimit() const { return ConstexprBacktraceLimit; } /// \brief When set to true, any unmapped warnings are ignored. /// /// If this and WarningsAsErrors are both set, then this one wins. void setIgnoreAllWarnings(bool Val) { IgnoreAllWarnings = Val; } bool getIgnoreAllWarnings() const { return IgnoreAllWarnings; } /// \brief When set to true, any unmapped ignored warnings are no longer /// ignored. /// /// If this and IgnoreAllWarnings are both set, then that one wins. void setEnableAllWarnings(bool Val) { EnableAllWarnings = Val; } bool getEnableAllWarnings() const { return EnableAllWarnings; } /// \brief When set to true, any warnings reported are issued as errors. void setWarningsAsErrors(bool Val) { WarningsAsErrors = Val; } bool getWarningsAsErrors() const { return WarningsAsErrors; } /// \brief When set to true, any error reported is made a fatal error. void setErrorsAsFatal(bool Val) { ErrorsAsFatal = Val; } bool getErrorsAsFatal() const { return ErrorsAsFatal; } /// \brief When set to true mask warnings that come from system headers. void setSuppressSystemWarnings(bool Val) { SuppressSystemWarnings = Val; } bool getSuppressSystemWarnings() const { return SuppressSystemWarnings; } /// \brief Suppress all diagnostics, to silence the front end when we /// know that we don't want any more diagnostics to be passed along to the /// client void setSuppressAllDiagnostics(bool Val = true) { SuppressAllDiagnostics = Val; } bool getSuppressAllDiagnostics() const { return SuppressAllDiagnostics; } /// \brief Set type eliding, to skip outputting same types occurring in /// template types. void setElideType(bool Val = true) { ElideType = Val; } bool getElideType() { return ElideType; } /// \brief Set tree printing, to outputting the template difference in a /// tree format. void setPrintTemplateTree(bool Val = false) { PrintTemplateTree = Val; } bool getPrintTemplateTree() { return PrintTemplateTree; } /// \brief Set color printing, so the type diffing will inject color markers /// into the output. void setShowColors(bool Val = false) { ShowColors = Val; } bool getShowColors() { return ShowColors; } /// \brief Specify which overload candidates to show when overload resolution /// fails. /// /// By default, we show all candidates. void setShowOverloads(OverloadsShown Val) { ShowOverloads = Val; } OverloadsShown getShowOverloads() const { return ShowOverloads; } /// \brief Pretend that the last diagnostic issued was ignored, so any /// subsequent notes will be suppressed. /// /// This can be used by clients who suppress diagnostics themselves. void setLastDiagnosticIgnored() { if (LastDiagLevel == DiagnosticIDs::Fatal) FatalErrorOccurred = true; LastDiagLevel = DiagnosticIDs::Ignored; } /// \brief Determine whether the previous diagnostic was ignored. This can /// be used by clients that want to determine whether notes attached to a /// diagnostic will be suppressed. bool isLastDiagnosticIgnored() const { return LastDiagLevel == DiagnosticIDs::Ignored; } /// \brief Controls whether otherwise-unmapped extension diagnostics are /// mapped onto ignore/warning/error. /// /// This corresponds to the GCC -pedantic and -pedantic-errors option. void setExtensionHandlingBehavior(diag::Severity H) { ExtBehavior = H; } diag::Severity getExtensionHandlingBehavior() const { return ExtBehavior; } /// \brief Counter bumped when an __extension__ block is/ encountered. /// /// When non-zero, all extension diagnostics are entirely silenced, no /// matter how they are mapped. void IncrementAllExtensionsSilenced() { ++AllExtensionsSilenced; } void DecrementAllExtensionsSilenced() { --AllExtensionsSilenced; } bool hasAllExtensionsSilenced() { return AllExtensionsSilenced != 0; } /// \brief This allows the client to specify that certain warnings are /// ignored. /// /// Notes can never be mapped, errors can only be mapped to fatal, and /// WARNINGs and EXTENSIONs can be mapped arbitrarily. /// /// \param Loc The source location that this change of diagnostic state should /// take affect. It can be null if we are setting the latest state. void setSeverity(diag::kind Diag, diag::Severity Map, SourceLocation Loc); /// \brief Change an entire diagnostic group (e.g. "unknown-pragmas") to /// have the specified mapping. /// /// \returns true (and ignores the request) if "Group" was unknown, false /// otherwise. /// /// \param Flavor The flavor of group to affect. -Rfoo does not affect the /// state of the -Wfoo group and vice versa. /// /// \param Loc The source location that this change of diagnostic state should /// take affect. It can be null if we are setting the state from command-line. bool setSeverityForGroup(diag::Flavor Flavor, StringRef Group, diag::Severity Map, SourceLocation Loc = SourceLocation()); /// \brief Set the warning-as-error flag for the given diagnostic group. /// /// This function always only operates on the current diagnostic state. /// /// \returns True if the given group is unknown, false otherwise. bool setDiagnosticGroupWarningAsError(StringRef Group, bool Enabled); /// \brief Set the error-as-fatal flag for the given diagnostic group. /// /// This function always only operates on the current diagnostic state. /// /// \returns True if the given group is unknown, false otherwise. bool setDiagnosticGroupErrorAsFatal(StringRef Group, bool Enabled); /// \brief Add the specified mapping to all diagnostics of the specified /// flavor. /// /// Mainly to be used by -Wno-everything to disable all warnings but allow /// subsequent -W options to enable specific warnings. void setSeverityForAll(diag::Flavor Flavor, diag::Severity Map, SourceLocation Loc = SourceLocation()); bool hasErrorOccurred() const { return ErrorOccurred; } /// \brief Errors that actually prevent compilation, not those that are /// upgraded from a warning by -Werror. bool hasUncompilableErrorOccurred() const { return UncompilableErrorOccurred; } bool hasFatalErrorOccurred() const { return FatalErrorOccurred; } /// \brief Determine whether any kind of unrecoverable error has occurred. bool hasUnrecoverableErrorOccurred() const { return FatalErrorOccurred || UnrecoverableErrorOccurred; } unsigned getNumWarnings() const { return NumWarnings; } void setNumWarnings(unsigned NumWarnings) { this->NumWarnings = NumWarnings; } /// \brief Return an ID for a diagnostic with the specified format string and /// level. /// /// If this is the first request for this diagnostic, it is registered and /// created, otherwise the existing ID is returned. /// /// \param FormatString A fixed diagnostic format string that will be hashed /// and mapped to a unique DiagID. template <unsigned N> unsigned getCustomDiagID(Level L, const char (&FormatString)[N]) { return Diags->getCustomDiagID((DiagnosticIDs::Level)L, StringRef(FormatString, N - 1)); } /// \brief Converts a diagnostic argument (as an intptr_t) into the string /// that represents it. void ConvertArgToString(ArgumentKind Kind, intptr_t Val, StringRef Modifier, StringRef Argument, ArrayRef<ArgumentValue> PrevArgs, SmallVectorImpl<char> &Output, ArrayRef<intptr_t> QualTypeVals) const { ArgToStringFn(Kind, Val, Modifier, Argument, PrevArgs, Output, ArgToStringCookie, QualTypeVals); } void SetArgToStringFn(ArgToStringFnTy Fn, void *Cookie) { ArgToStringFn = Fn; ArgToStringCookie = Cookie; } /// \brief Note that the prior diagnostic was emitted by some other /// \c DiagnosticsEngine, and we may be attaching a note to that diagnostic. void notePriorDiagnosticFrom(const DiagnosticsEngine &Other) { LastDiagLevel = Other.LastDiagLevel; } /// \brief Reset the state of the diagnostic object to its initial /// configuration. void Reset(); //===--------------------------------------------------------------------===// // DiagnosticsEngine classification and reporting interfaces. // /// \brief Determine whether the diagnostic is known to be ignored. /// /// This can be used to opportunistically avoid expensive checks when it's /// known for certain that the diagnostic has been suppressed at the /// specified location \p Loc. /// /// \param Loc The source location we are interested in finding out the /// diagnostic state. Can be null in order to query the latest state. bool isIgnored(unsigned DiagID, SourceLocation Loc) const { return Diags->getDiagnosticSeverity(DiagID, Loc, *this) == diag::Severity::Ignored; } /// \brief Based on the way the client configured the DiagnosticsEngine /// object, classify the specified diagnostic ID into a Level, consumable by /// the DiagnosticConsumer. /// /// To preserve invariant assumptions, this function should not be used to /// influence parse or semantic analysis actions. Instead consider using /// \c isIgnored(). /// /// \param Loc The source location we are interested in finding out the /// diagnostic state. Can be null in order to query the latest state. Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const { return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this); } /// \brief Issue the message to the client. /// /// This actually returns an instance of DiagnosticBuilder which emits the /// diagnostics (through @c ProcessDiag) when it is destroyed. /// /// \param DiagID A member of the @c diag::kind enum. /// \param Loc Represents the source location associated with the diagnostic, /// which can be an invalid location if no position information is available. inline DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID); inline DiagnosticBuilder Report(unsigned DiagID); void Report(const StoredDiagnostic &storedDiag); /// \brief Issue the message to the client but only once. /// /// This actually returns an instance of DiagnosticBuilder which emits the /// diagnostics (through @c ProcessDiag) when it is destroyed. /// /// \param DiagID A member of the @c diag::kind enum. /// \param Loc Represents the source location associated with the diagnostic, /// which can be an invalid location if no position information is available. inline DiagnosticBuilder ReportOnce(unsigned DiagID); inline DiagnosticBuilder ReportOnce(SourceLocation Loc, unsigned DiagID); /// \brief Determine whethere there is already a diagnostic in flight. bool isDiagnosticInFlight() const { return CurDiagID != ~0U; } /// \brief Set the "delayed" diagnostic that will be emitted once /// the current diagnostic completes. /// /// If a diagnostic is already in-flight but the front end must /// report a problem (e.g., with an inconsistent file system /// state), this routine sets a "delayed" diagnostic that will be /// emitted after the current diagnostic completes. This should /// only be used for fatal errors detected at inconvenient /// times. If emitting a delayed diagnostic causes a second delayed /// diagnostic to be introduced, that second delayed diagnostic /// will be ignored. /// /// \param DiagID The ID of the diagnostic being delayed. /// /// \param Arg1 A string argument that will be provided to the /// diagnostic. A copy of this string will be stored in the /// DiagnosticsEngine object itself. /// /// \param Arg2 A string argument that will be provided to the /// diagnostic. A copy of this string will be stored in the /// DiagnosticsEngine object itself. void SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1 = "", StringRef Arg2 = ""); /// \brief Clear out the current diagnostic. void Clear() { CurDiagID = ~0U; } /// \brief Return the value associated with this diagnostic flag. StringRef getFlagValue() const { return FlagValue; } private: /// \brief Report the delayed diagnostic. void ReportDelayed(); // This is private state used by DiagnosticBuilder. We put it here instead of // in DiagnosticBuilder in order to keep DiagnosticBuilder a small lightweight // object. This implementation choice means that we can only have one // diagnostic "in flight" at a time, but this seems to be a reasonable // tradeoff to keep these objects small. Assertions verify that only one // diagnostic is in flight at a time. friend class DiagnosticIDs; friend class DiagnosticBuilder; friend class Diagnostic; friend class PartialDiagnostic; friend class DiagnosticErrorTrap; /// \brief The location of the current diagnostic that is in flight. SourceLocation CurDiagLoc; /// \brief Stores Diagnostics that should be onyl remited once. llvm::SmallVector<unsigned, 2> DiagOnceDiagnostics; /// \brief The ID of the current diagnostic that is in flight. /// /// This is set to ~0U when there is no diagnostic in flight. unsigned CurDiagID; enum { /// \brief The maximum number of arguments we can hold. /// /// We currently only support up to 10 arguments (%0-%9). A single /// diagnostic with more than that almost certainly has to be simplified /// anyway. MaxArguments = 10, }; /// \brief The number of entries in Arguments. signed char NumDiagArgs; /// \brief Specifies whether an argument is in DiagArgumentsStr or /// in DiagArguments. /// /// This is an array of ArgumentKind::ArgumentKind enum values, one for each /// argument. unsigned char DiagArgumentsKind[MaxArguments]; /// \brief Holds the values of each string argument for the current /// diagnostic. /// /// This is only used when the corresponding ArgumentKind is ak_std_string. std::string DiagArgumentsStr[MaxArguments]; /// \brief The values for the various substitution positions. /// /// This is used when the argument is not an std::string. The specific /// value is mangled into an intptr_t and the interpretation depends on /// exactly what sort of argument kind it is. intptr_t DiagArgumentsVal[MaxArguments]; /// \brief The list of ranges added to this diagnostic. SmallVector<CharSourceRange, 8> DiagRanges; /// \brief If valid, provides a hint with some code to insert, remove, /// or modify at a particular position. SmallVector<FixItHint, 8> DiagFixItHints; DiagnosticMapping makeUserMapping(diag::Severity Map, SourceLocation L) { bool isPragma = L.isValid(); DiagnosticMapping Mapping = DiagnosticMapping::Make(Map, /*IsUser=*/true, isPragma); // If this is a pragma mapping, then set the diagnostic mapping flags so // that we override command line options. if (isPragma) { Mapping.setNoWarningAsError(true); Mapping.setNoErrorAsFatal(true); } return Mapping; } /// \brief Used to report a diagnostic that is finally fully formed. /// /// \returns true if the diagnostic was emitted, false if it was suppressed. bool ProcessDiag() { return Diags->ProcessDiag(*this); } /// @name Diagnostic Emission /// @{ protected: // Sema requires access to the following functions because the current design // of SFINAE requires it to use its own SemaDiagnosticBuilder, which needs to // access us directly to ensure we minimize the emitted code for the common // Sema::Diag() patterns. friend class Sema; /// \brief Emit the current diagnostic and clear the diagnostic state. /// /// \param Force Emit the diagnostic regardless of suppression settings. bool EmitCurrentDiagnostic(bool Force = false); unsigned getCurrentDiagID() const { return CurDiagID; } SourceLocation getCurrentDiagLoc() const { return CurDiagLoc; } /// @} friend class ASTReader; friend class ASTWriter; }; /// \brief RAII class that determines when any errors have occurred /// between the time the instance was created and the time it was /// queried. class DiagnosticErrorTrap { DiagnosticsEngine &Diag; unsigned NumErrors; unsigned NumUnrecoverableErrors; public: explicit DiagnosticErrorTrap(DiagnosticsEngine &Diag) : Diag(Diag) { reset(); } /// \brief Determine whether any errors have occurred since this /// object instance was created. bool hasErrorOccurred() const { return Diag.TrapNumErrorsOccurred > NumErrors; } /// \brief Determine whether any unrecoverable errors have occurred since this /// object instance was created. bool hasUnrecoverableErrorOccurred() const { return Diag.TrapNumUnrecoverableErrorsOccurred > NumUnrecoverableErrors; } /// \brief Set to initial state of "no errors occurred". void reset() { NumErrors = Diag.TrapNumErrorsOccurred; NumUnrecoverableErrors = Diag.TrapNumUnrecoverableErrorsOccurred; } }; //===----------------------------------------------------------------------===// // DiagnosticBuilder //===----------------------------------------------------------------------===// /// \brief A little helper class used to produce diagnostics. /// /// This is constructed by the DiagnosticsEngine::Report method, and /// allows insertion of extra information (arguments and source ranges) into /// the currently "in flight" diagnostic. When the temporary for the builder /// is destroyed, the diagnostic is issued. /// /// Note that many of these will be created as temporary objects (many call /// sites), so we want them to be small and we never want their address taken. /// This ensures that compilers with somewhat reasonable optimizers will promote /// the common fields to registers, eliminating increments of the NumArgs field, /// for example. class DiagnosticBuilder { mutable DiagnosticsEngine *DiagObj; mutable unsigned NumArgs; /// \brief Status variable indicating if this diagnostic is still active. /// // NOTE: This field is redundant with DiagObj (IsActive iff (DiagObj == 0)), // but LLVM is not currently smart enough to eliminate the null check that // Emit() would end up with if we used that as our status variable. mutable bool IsActive; /// \brief Flag indicating that this diagnostic is being emitted via a /// call to ForceEmit. mutable bool IsForceEmit; void operator=(const DiagnosticBuilder &) = delete; friend class DiagnosticsEngine; DiagnosticBuilder() : DiagObj(nullptr), NumArgs(0), IsActive(false), IsForceEmit(false) {} explicit DiagnosticBuilder(DiagnosticsEngine *diagObj) : DiagObj(diagObj), NumArgs(0), IsActive(true), IsForceEmit(false) { assert(diagObj && "DiagnosticBuilder requires a valid DiagnosticsEngine!"); diagObj->DiagRanges.clear(); diagObj->DiagFixItHints.clear(); } friend class PartialDiagnostic; protected: void FlushCounts() { DiagObj->NumDiagArgs = NumArgs; } /// \brief Clear out the current diagnostic. void Clear() const { DiagObj = nullptr; IsActive = false; IsForceEmit = false; } /// \brief Determine whether this diagnostic is still active. bool isActive() const { return IsActive; } /// \brief Force the diagnostic builder to emit the diagnostic now. /// /// Once this function has been called, the DiagnosticBuilder object /// should not be used again before it is destroyed. /// /// \returns true if a diagnostic was emitted, false if the /// diagnostic was suppressed. bool Emit() { // If this diagnostic is inactive, then its soul was stolen by the copy ctor // (or by a subclass, as in SemaDiagnosticBuilder). if (!isActive()) return false; // When emitting diagnostics, we set the final argument count into // the DiagnosticsEngine object. FlushCounts(); // Process the diagnostic. bool Result = DiagObj->EmitCurrentDiagnostic(IsForceEmit); // This diagnostic is dead. Clear(); return Result; } public: /// Copy constructor. When copied, this "takes" the diagnostic info from the /// input and neuters it. DiagnosticBuilder(const DiagnosticBuilder &D) { DiagObj = D.DiagObj; IsActive = D.IsActive; IsForceEmit = D.IsForceEmit; D.Clear(); NumArgs = D.NumArgs; } /// \brief Retrieve an empty diagnostic builder. static DiagnosticBuilder getEmpty() { return DiagnosticBuilder(); } /// \brief Emits the diagnostic. ~DiagnosticBuilder() { Emit(); } /// \brief Forces the diagnostic to be emitted. const DiagnosticBuilder &setForceEmit() const { IsForceEmit = true; return *this; } /// \brief Conversion of DiagnosticBuilder to bool always returns \c true. /// /// This allows is to be used in boolean error contexts (where \c true is /// used to indicate that an error has occurred), like: /// \code /// return Diag(...); /// \endcode operator bool() const { return true; } void AddString(StringRef S) const { assert(isActive() && "Clients must not add to cleared diagnostic!"); assert(NumArgs < DiagnosticsEngine::MaxArguments && "Too many arguments to diagnostic!"); assert(NumArgs < DiagnosticsEngine::MaxArguments); DiagObj->DiagArgumentsKind[NumArgs] = DiagnosticsEngine::ak_std_string; DiagObj->DiagArgumentsStr[NumArgs++] = S; } void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const { assert(isActive() && "Clients must not add to cleared diagnostic!"); assert(NumArgs < DiagnosticsEngine::MaxArguments && "Too many arguments to diagnostic!"); assert(NumArgs < DiagnosticsEngine::MaxArguments); DiagObj->DiagArgumentsKind[NumArgs] = Kind; DiagObj->DiagArgumentsVal[NumArgs++] = V; } void AddSourceRange(const CharSourceRange &R) const { assert(isActive() && "Clients must not add to cleared diagnostic!"); DiagObj->DiagRanges.push_back(R); } void AddFixItHint(const FixItHint &Hint) const { assert(isActive() && "Clients must not add to cleared diagnostic!"); if (!Hint.isNull()) DiagObj->DiagFixItHints.push_back(Hint); } void addFlagValue(StringRef V) const { DiagObj->FlagValue = V; } }; struct AddFlagValue { explicit AddFlagValue(StringRef V) : Val(V) {} StringRef Val; }; /// \brief Register a value for the flag in the current diagnostic. This /// value will be shown as the suffix "=value" after the flag name. It is /// useful in cases where the diagnostic flag accepts values (e.g., /// -Rpass or -Wframe-larger-than). inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const AddFlagValue V) { DB.addFlagValue(V.Val); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, StringRef S) { DB.AddString(S); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const char *Str) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(Str), DiagnosticsEngine::ak_c_string); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, int I) { DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return DB; } // We use enable_if here to prevent that this overload is selected for // pointers or other arguments that are implicitly convertible to bool. template <typename T> inline typename std::enable_if<std::is_same<T, bool>::value, const DiagnosticBuilder &>::type operator<<(const DiagnosticBuilder &DB, T I) { DB.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, unsigned I) { DB.AddTaggedVal(I, DiagnosticsEngine::ak_uint); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, tok::TokenKind I) { DB.AddTaggedVal(static_cast<unsigned>(I), DiagnosticsEngine::ak_tokenkind); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const IdentifierInfo *II) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(II), DiagnosticsEngine::ak_identifierinfo); return DB; } // Adds a DeclContext to the diagnostic. The enable_if template magic is here // so that we only match those arguments that are (statically) DeclContexts; // other arguments that derive from DeclContext (e.g., RecordDecls) will not // match. template<typename T> inline typename std::enable_if<std::is_same<T, DeclContext>::value, const DiagnosticBuilder &>::type operator<<(const DiagnosticBuilder &DB, T *DC) { DB.AddTaggedVal(reinterpret_cast<intptr_t>(DC), DiagnosticsEngine::ak_declcontext); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const SourceRange &R) { DB.AddSourceRange(CharSourceRange::getTokenRange(R)); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, ArrayRef<SourceRange> Ranges) { for (const SourceRange &R: Ranges) DB.AddSourceRange(CharSourceRange::getTokenRange(R)); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const CharSourceRange &R) { DB.AddSourceRange(R); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const FixItHint &Hint) { DB.AddFixItHint(Hint); return DB; } inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, ArrayRef<FixItHint> Hints) { for (const FixItHint &Hint : Hints) DB.AddFixItHint(Hint); return DB; } /// A nullability kind paired with a bit indicating whether it used a /// context-sensitive keyword. typedef std::pair<NullabilityKind, bool> DiagNullabilityKind; const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, DiagNullabilityKind nullability); inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc, unsigned DiagID) { assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!"); CurDiagLoc = Loc; CurDiagID = DiagID; FlagValue.clear(); return DiagnosticBuilder(this); } inline DiagnosticBuilder DiagnosticsEngine::Report(unsigned DiagID) { return Report(SourceLocation(), DiagID); } inline DiagnosticBuilder DiagnosticsEngine::ReportOnce(unsigned DiagID) { return ReportOnce(SourceLocation(), DiagID); } inline DiagnosticBuilder DiagnosticsEngine::ReportOnce(SourceLocation Loc, unsigned DiagID) { if (std::find(DiagOnceDiagnostics.begin(), DiagOnceDiagnostics.end(), DiagID) != DiagOnceDiagnostics.end()) { auto DisabledDiag = DiagnosticBuilder(this); DisabledDiag.IsActive = false; return DisabledDiag; } DiagOnceDiagnostics.push_back(DiagID); return Report(Loc, DiagID); } //===----------------------------------------------------------------------===// // Diagnostic // // /////////////////////////////////////////////////////////////////////////////// /// A little helper class (which is basically a smart pointer that forwards /// info from DiagnosticsEngine) that allows clients to enquire about the /// currently in-flight diagnostic. class Diagnostic { const DiagnosticsEngine *DiagObj; StringRef StoredDiagMessage; public: explicit Diagnostic(const DiagnosticsEngine *DO) : DiagObj(DO) {} Diagnostic(const DiagnosticsEngine *DO, StringRef storedDiagMessage) : DiagObj(DO), StoredDiagMessage(storedDiagMessage) {} const DiagnosticsEngine *getDiags() const { return DiagObj; } unsigned getID() const { return DiagObj->CurDiagID; } const SourceLocation &getLocation() const { return DiagObj->CurDiagLoc; } bool hasSourceManager() const { return DiagObj->hasSourceManager(); } SourceManager &getSourceManager() const { return DiagObj->getSourceManager();} unsigned getNumArgs() const { return DiagObj->NumDiagArgs; } /// \brief Return the kind of the specified index. /// /// Based on the kind of argument, the accessors below can be used to get /// the value. /// /// \pre Idx < getNumArgs() DiagnosticsEngine::ArgumentKind getArgKind(unsigned Idx) const { assert(Idx < getNumArgs() && "Argument index out of range!"); return (DiagnosticsEngine::ArgumentKind)DiagObj->DiagArgumentsKind[Idx]; } /// \brief Return the provided argument string specified by \p Idx. /// \pre getArgKind(Idx) == DiagnosticsEngine::ak_std_string const std::string &getArgStdStr(unsigned Idx) const { assert(getArgKind(Idx) == DiagnosticsEngine::ak_std_string && "invalid argument accessor!"); return DiagObj->DiagArgumentsStr[Idx]; } /// \brief Return the specified C string argument. /// \pre getArgKind(Idx) == DiagnosticsEngine::ak_c_string const char *getArgCStr(unsigned Idx) const { assert(getArgKind(Idx) == DiagnosticsEngine::ak_c_string && "invalid argument accessor!"); return reinterpret_cast<const char*>(DiagObj->DiagArgumentsVal[Idx]); } /// \brief Return the specified signed integer argument. /// \pre getArgKind(Idx) == DiagnosticsEngine::ak_sint int getArgSInt(unsigned Idx) const { assert(getArgKind(Idx) == DiagnosticsEngine::ak_sint && "invalid argument accessor!"); return (int)DiagObj->DiagArgumentsVal[Idx]; } /// \brief Return the specified unsigned integer argument. /// \pre getArgKind(Idx) == DiagnosticsEngine::ak_uint unsigned getArgUInt(unsigned Idx) const { assert(getArgKind(Idx) == DiagnosticsEngine::ak_uint && "invalid argument accessor!"); return (unsigned)DiagObj->DiagArgumentsVal[Idx]; } /// \brief Return the specified IdentifierInfo argument. /// \pre getArgKind(Idx) == DiagnosticsEngine::ak_identifierinfo const IdentifierInfo *getArgIdentifier(unsigned Idx) const { assert(getArgKind(Idx) == DiagnosticsEngine::ak_identifierinfo && "invalid argument accessor!"); return reinterpret_cast<IdentifierInfo*>(DiagObj->DiagArgumentsVal[Idx]); } /// \brief Return the specified non-string argument in an opaque form. /// \pre getArgKind(Idx) != DiagnosticsEngine::ak_std_string intptr_t getRawArg(unsigned Idx) const { assert(getArgKind(Idx) != DiagnosticsEngine::ak_std_string && "invalid argument accessor!"); return DiagObj->DiagArgumentsVal[Idx]; } /// \brief Return the number of source ranges associated with this diagnostic. unsigned getNumRanges() const { return DiagObj->DiagRanges.size(); } /// \pre Idx < getNumRanges() const CharSourceRange &getRange(unsigned Idx) const { assert(Idx < getNumRanges() && "Invalid diagnostic range index!"); return DiagObj->DiagRanges[Idx]; } /// \brief Return an array reference for this diagnostic's ranges. ArrayRef<CharSourceRange> getRanges() const { return DiagObj->DiagRanges; } unsigned getNumFixItHints() const { return DiagObj->DiagFixItHints.size(); } const FixItHint &getFixItHint(unsigned Idx) const { assert(Idx < getNumFixItHints() && "Invalid index!"); return DiagObj->DiagFixItHints[Idx]; } ArrayRef<FixItHint> getFixItHints() const { return DiagObj->DiagFixItHints; } /// \brief Format this diagnostic into a string, substituting the /// formal arguments into the %0 slots. /// /// The result is appended onto the \p OutStr array. void FormatDiagnostic(SmallVectorImpl<char> &OutStr) const; /// \brief Format the given format-string into the output buffer using the /// arguments stored in this diagnostic. void FormatDiagnostic(const char *DiagStr, const char *DiagEnd, SmallVectorImpl<char> &OutStr) const; }; /** * \brief Represents a diagnostic in a form that can be retained until its * corresponding source manager is destroyed. */ class StoredDiagnostic { unsigned ID; DiagnosticsEngine::Level Level; FullSourceLoc Loc; std::string Message; std::vector<CharSourceRange> Ranges; std::vector<FixItHint> FixIts; public: StoredDiagnostic(); StoredDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info); StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID, StringRef Message); StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID, StringRef Message, FullSourceLoc Loc, ArrayRef<CharSourceRange> Ranges, ArrayRef<FixItHint> Fixits); ~StoredDiagnostic(); /// \brief Evaluates true when this object stores a diagnostic. explicit operator bool() const { return Message.size() > 0; } unsigned getID() const { return ID; } DiagnosticsEngine::Level getLevel() const { return Level; } const FullSourceLoc &getLocation() const { return Loc; } StringRef getMessage() const { return Message; } void setLocation(FullSourceLoc Loc) { this->Loc = Loc; } typedef std::vector<CharSourceRange>::const_iterator range_iterator; range_iterator range_begin() const { return Ranges.begin(); } range_iterator range_end() const { return Ranges.end(); } unsigned range_size() const { return Ranges.size(); } ArrayRef<CharSourceRange> getRanges() const { return llvm::makeArrayRef(Ranges); } typedef std::vector<FixItHint>::const_iterator fixit_iterator; fixit_iterator fixit_begin() const { return FixIts.begin(); } fixit_iterator fixit_end() const { return FixIts.end(); } unsigned fixit_size() const { return FixIts.size(); } ArrayRef<FixItHint> getFixIts() const { return llvm::makeArrayRef(FixIts); } }; /// \brief Abstract interface, implemented by clients of the front-end, which /// formats and prints fully processed diagnostics. class DiagnosticConsumer { protected: unsigned NumWarnings; ///< Number of warnings reported unsigned NumErrors; ///< Number of errors reported public: DiagnosticConsumer() : NumWarnings(0), NumErrors(0) { } unsigned getNumErrors() const { return NumErrors; } unsigned getNumWarnings() const { return NumWarnings; } virtual void clear() { NumWarnings = NumErrors = 0; } virtual ~DiagnosticConsumer(); /// \brief Callback to inform the diagnostic client that processing /// of a source file is beginning. /// /// Note that diagnostics may be emitted outside the processing of a source /// file, for example during the parsing of command line options. However, /// diagnostics with source range information are required to only be emitted /// in between BeginSourceFile() and EndSourceFile(). /// /// \param LangOpts The language options for the source file being processed. /// \param PP The preprocessor object being used for the source; this is /// optional, e.g., it may not be present when processing AST source files. virtual void BeginSourceFile(const LangOptions &LangOpts, const Preprocessor *PP = nullptr) {} /// \brief Callback to inform the diagnostic client that processing /// of a source file has ended. /// /// The diagnostic client should assume that any objects made available via /// BeginSourceFile() are inaccessible. virtual void EndSourceFile() {} /// \brief Callback to inform the diagnostic client that processing of all /// source files has ended. virtual void finish() {} /// \brief Indicates whether the diagnostics handled by this /// DiagnosticConsumer should be included in the number of diagnostics /// reported by DiagnosticsEngine. /// /// The default implementation returns true. virtual bool IncludeInDiagnosticCounts() const; /// \brief Handle this diagnostic, reporting it to the user or /// capturing it to a log as needed. /// /// The default implementation just keeps track of the total number of /// warnings and errors. virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info); virtual void setPrefix(std::string Value) {} // HLSL Change }; /// \brief A diagnostic client that ignores all diagnostics. class IgnoringDiagConsumer : public DiagnosticConsumer { virtual void anchor(); void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override { // Just ignore it. } }; /// \brief Diagnostic consumer that forwards diagnostics along to an /// existing, already-initialized diagnostic consumer. /// class ForwardingDiagnosticConsumer : public DiagnosticConsumer { DiagnosticConsumer &Target; public: ForwardingDiagnosticConsumer(DiagnosticConsumer &Target) : Target(Target) {} ~ForwardingDiagnosticConsumer() override; void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override; void clear() override; bool IncludeInDiagnosticCounts() const override; }; // Struct used for sending info about how a type should be printed. struct TemplateDiffTypes { intptr_t FromType; intptr_t ToType; unsigned PrintTree : 1; unsigned PrintFromType : 1; unsigned ElideType : 1; unsigned ShowColors : 1; // The printer sets this variable to true if the template diff was used. unsigned TemplateDiffUsed : 1; }; /// Special character that the diagnostic printer will use to toggle the bold /// attribute. The character itself will be not be printed. const char ToggleHighlight = 127; /// ProcessWarningOptions - Initialize the diagnostic client and process the /// warning options specified on the command line. void ProcessWarningOptions(DiagnosticsEngine &Diags, const DiagnosticOptions &Opts, bool ReportDiags = true); } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/AllDiagnostics.h
//===--- AllDiagnostics.h - Aggregate Diagnostic headers --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Includes all the separate Diagnostic headers & some related helpers. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H #define LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H #include "clang/AST/ASTDiagnostic.h" #include "clang/AST/CommentDiagnostic.h" #include "clang/Analysis/AnalysisDiagnostic.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Lex/LexDiagnostic.h" #include "clang/Parse/ParseDiagnostic.h" #include "clang/Sema/SemaDiagnostic.h" #include "clang/Serialization/SerializationDiagnostic.h" namespace clang { template <size_t SizeOfStr, typename FieldType> class StringSizerHelper { char FIELD_TOO_SMALL[SizeOfStr <= FieldType(~0U) ? 1 : -1]; public: enum { Size = SizeOfStr }; }; } // end namespace clang #define STR_SIZE(str, fieldTy) clang::StringSizerHelper<sizeof(str)-1, \ fieldTy>::Size #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/FileSystemOptions.h
//===--- FileSystemOptions.h - File System Options --------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::FileSystemOptions interface. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_FILESYSTEMOPTIONS_H #define LLVM_CLANG_BASIC_FILESYSTEMOPTIONS_H #include <string> namespace clang { /// \brief Keeps track of options that affect how file operations are performed. class FileSystemOptions { public: /// \brief If set, paths are resolved as if the working directory was /// set to the value of WorkingDir. std::string WorkingDir; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/SourceManager.h
//===--- SourceManager.h - Track and cache source files ---------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the SourceManager interface. /// /// There are three different types of locations in a %file: a spelling /// location, an expansion location, and a presumed location. /// /// Given an example of: /// \code /// #define min(x, y) x < y ? x : y /// \endcode /// /// and then later on a use of min: /// \code /// #line 17 /// return min(a, b); /// \endcode /// /// The expansion location is the line in the source code where the macro /// was expanded (the return statement), the spelling location is the /// location in the source where the macro was originally defined, /// and the presumed location is where the line directive states that /// the line is 17, or any other line. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SOURCEMANAGER_H #define LLVM_CLANG_BASIC_SOURCEMANAGER_H #include "clang/Basic/FileManager.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/Support/AlignOf.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/MemoryBuffer.h" #include <cassert> #include <map> #include <memory> #include <vector> namespace clang { class DiagnosticsEngine; class SourceManager; class FileManager; class FileEntry; class LineTableInfo; class LangOptions; class ASTWriter; class ASTReader; /// \brief Public enums and private classes that are part of the /// SourceManager implementation. /// namespace SrcMgr { /// \brief Indicates whether a file or directory holds normal user code, /// system code, or system code which is implicitly 'extern "C"' in C++ mode. /// /// Entire directories can be tagged with this (this is maintained by /// DirectoryLookup and friends) as can specific FileInfos when a \#pragma /// system_header is seen or in various other cases. /// enum CharacteristicKind { C_User, C_System, C_ExternCSystem }; /// \brief One instance of this struct is kept for every file loaded or used. /// /// This object owns the MemoryBuffer object. class LLVM_ALIGNAS(8) ContentCache { enum CCFlags { /// \brief Whether the buffer is invalid. InvalidFlag = 0x01, /// \brief Whether the buffer should not be freed on destruction. DoNotFreeFlag = 0x02 }; /// \brief The actual buffer containing the characters from the input /// file. /// /// This is owned by the ContentCache object. The bits indicate /// whether the buffer is invalid. mutable llvm::PointerIntPair<llvm::MemoryBuffer *, 2> Buffer; public: /// \brief Reference to the file entry representing this ContentCache. /// /// This reference does not own the FileEntry object. /// /// It is possible for this to be NULL if the ContentCache encapsulates /// an imaginary text buffer. const FileEntry *OrigEntry; /// \brief References the file which the contents were actually loaded from. /// /// Can be different from 'Entry' if we overridden the contents of one file /// with the contents of another file. const FileEntry *ContentsEntry; /// \brief A bump pointer allocated array of offsets for each source line. /// /// This is lazily computed. This is owned by the SourceManager /// BumpPointerAllocator object. unsigned *SourceLineCache; /// \brief The number of lines in this ContentCache. /// /// This is only valid if SourceLineCache is non-null. unsigned NumLines : 31; /// \brief Indicates whether the buffer itself was provided to override /// the actual file contents. /// /// When true, the original entry may be a virtual file that does not /// exist. unsigned BufferOverridden : 1; /// \brief True if this content cache was initially created for a source /// file considered as a system one. unsigned IsSystemFile : 1; ContentCache(const FileEntry *Ent = nullptr) : ContentCache(Ent, Ent) {} ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(contentEnt), SourceLineCache(nullptr), NumLines(0), BufferOverridden(false), IsSystemFile(false) {} ~ContentCache(); /// The copy ctor does not allow copies where source object has either /// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory /// is not transferred, so this is a logical error. ContentCache(const ContentCache &RHS) : Buffer(nullptr, false), SourceLineCache(nullptr), BufferOverridden(false), IsSystemFile(false) { OrigEntry = RHS.OrigEntry; ContentsEntry = RHS.ContentsEntry; assert(RHS.Buffer.getPointer() == nullptr && RHS.SourceLineCache == nullptr && "Passed ContentCache object cannot own a buffer."); NumLines = RHS.NumLines; } /// \brief Returns the memory buffer for the associated content. /// /// \param Diag Object through which diagnostics will be emitted if the /// buffer cannot be retrieved. /// /// \param Loc If specified, is the location that invalid file diagnostics /// will be emitted at. /// /// \param Invalid If non-NULL, will be set \c true if an error occurred. llvm::MemoryBuffer *getBuffer(DiagnosticsEngine &Diag, const SourceManager &SM, SourceLocation Loc = SourceLocation(), bool *Invalid = nullptr) const; /// \brief Returns the size of the content encapsulated by this /// ContentCache. /// /// This can be the size of the source file or the size of an /// arbitrary scratch buffer. If the ContentCache encapsulates a source /// file this size is retrieved from the file's FileEntry. unsigned getSize() const; /// \brief Returns the number of bytes actually mapped for this /// ContentCache. /// /// This can be 0 if the MemBuffer was not actually expanded. unsigned getSizeBytesMapped() const; /// Returns the kind of memory used to back the memory buffer for /// this content cache. This is used for performance analysis. llvm::MemoryBuffer::BufferKind getMemoryBufferKind() const; void setBuffer(std::unique_ptr<llvm::MemoryBuffer> B) { assert(!Buffer.getPointer() && "MemoryBuffer already set."); Buffer.setPointer(B.release()); Buffer.setInt(0); } /// \brief Get the underlying buffer, returning NULL if the buffer is not /// yet available. llvm::MemoryBuffer *getRawBuffer() const { return Buffer.getPointer(); } /// \brief Replace the existing buffer (which will be deleted) /// with the given buffer. void replaceBuffer(llvm::MemoryBuffer *B, bool DoNotFree = false); /// \brief Determine whether the buffer itself is invalid. bool isBufferInvalid() const { return Buffer.getInt() & InvalidFlag; } /// \brief Determine whether the buffer should be freed. bool shouldFreeBuffer() const { return (Buffer.getInt() & DoNotFreeFlag) == 0; } private: // Disable assignments. ContentCache &operator=(const ContentCache& RHS) = delete; }; // Assert that the \c ContentCache objects will always be 8-byte aligned so // that we can pack 3 bits of integer into pointers to such objects. static_assert(llvm::AlignOf<ContentCache>::Alignment >= 8, "ContentCache must be 8-byte aligned."); /// \brief Information about a FileID, basically just the logical file /// that it represents and include stack information. /// /// Each FileInfo has include stack information, indicating where it came /// from. This information encodes the \#include chain that a token was /// expanded from. The main include file has an invalid IncludeLoc. /// /// FileInfos contain a "ContentCache *", with the contents of the file. /// class FileInfo { /// \brief The location of the \#include that brought in this file. /// /// This is an invalid SLOC for the main file (top of the \#include chain). unsigned IncludeLoc; // Really a SourceLocation /// \brief Number of FileIDs (files and macros) that were created during /// preprocessing of this \#include, including this SLocEntry. /// /// Zero means the preprocessor didn't provide such info for this SLocEntry. unsigned NumCreatedFIDs; /// \brief Contains the ContentCache* and the bits indicating the /// characteristic of the file and whether it has \#line info, all /// bitmangled together. uintptr_t Data; friend class clang::SourceManager; friend class clang::ASTWriter; friend class clang::ASTReader; public: /// \brief Return a FileInfo object. static FileInfo get(SourceLocation IL, const ContentCache *Con, CharacteristicKind FileCharacter) { FileInfo X; X.IncludeLoc = IL.getRawEncoding(); X.NumCreatedFIDs = 0; X.Data = (uintptr_t)Con; assert((X.Data & 7) == 0 &&"ContentCache pointer insufficiently aligned"); assert((unsigned)FileCharacter < 4 && "invalid file character"); X.Data |= (unsigned)FileCharacter; return X; } SourceLocation getIncludeLoc() const { return SourceLocation::getFromRawEncoding(IncludeLoc); } const ContentCache* getContentCache() const { return reinterpret_cast<const ContentCache*>(Data & ~uintptr_t(7)); } /// \brief Return whether this is a system header or not. CharacteristicKind getFileCharacteristic() const { return (CharacteristicKind)(Data & 3); } /// \brief Return true if this FileID has \#line directives in it. bool hasLineDirectives() const { return (Data & 4) != 0; } /// \brief Set the flag that indicates that this FileID has /// line table entries associated with it. void setHasLineDirectives() { Data |= 4; } }; /// \brief Each ExpansionInfo encodes the expansion location - where /// the token was ultimately expanded, and the SpellingLoc - where the actual /// character data for the token came from. class ExpansionInfo { // Really these are all SourceLocations. /// \brief Where the spelling for the token can be found. unsigned SpellingLoc; /// In a macro expansion, ExpansionLocStart and ExpansionLocEnd /// indicate the start and end of the expansion. In object-like macros, /// they will be the same. In a function-like macro expansion, the start /// will be the identifier and the end will be the ')'. Finally, in /// macro-argument instantiations, the end will be 'SourceLocation()', an /// invalid location. unsigned ExpansionLocStart, ExpansionLocEnd; public: SourceLocation getSpellingLoc() const { return SourceLocation::getFromRawEncoding(SpellingLoc); } SourceLocation getExpansionLocStart() const { return SourceLocation::getFromRawEncoding(ExpansionLocStart); } SourceLocation getExpansionLocEnd() const { SourceLocation EndLoc = SourceLocation::getFromRawEncoding(ExpansionLocEnd); return EndLoc.isInvalid() ? getExpansionLocStart() : EndLoc; } std::pair<SourceLocation,SourceLocation> getExpansionLocRange() const { return std::make_pair(getExpansionLocStart(), getExpansionLocEnd()); } bool isMacroArgExpansion() const { // Note that this needs to return false for default constructed objects. return getExpansionLocStart().isValid() && SourceLocation::getFromRawEncoding(ExpansionLocEnd).isInvalid(); } bool isMacroBodyExpansion() const { return getExpansionLocStart().isValid() && SourceLocation::getFromRawEncoding(ExpansionLocEnd).isValid(); } bool isFunctionMacroExpansion() const { return getExpansionLocStart().isValid() && getExpansionLocStart() != getExpansionLocEnd(); } /// \brief Return a ExpansionInfo for an expansion. /// /// Start and End specify the expansion range (where the macro is /// expanded), and SpellingLoc specifies the spelling location (where /// the characters from the token come from). All three can refer to /// normal File SLocs or expansion locations. static ExpansionInfo create(SourceLocation SpellingLoc, SourceLocation Start, SourceLocation End) { ExpansionInfo X; X.SpellingLoc = SpellingLoc.getRawEncoding(); X.ExpansionLocStart = Start.getRawEncoding(); X.ExpansionLocEnd = End.getRawEncoding(); return X; } /// \brief Return a special ExpansionInfo for the expansion of /// a macro argument into a function-like macro's body. /// /// ExpansionLoc specifies the expansion location (where the macro is /// expanded). This doesn't need to be a range because a macro is always /// expanded at a macro parameter reference, and macro parameters are /// always exactly one token. SpellingLoc specifies the spelling location /// (where the characters from the token come from). ExpansionLoc and /// SpellingLoc can both refer to normal File SLocs or expansion locations. /// /// Given the code: /// \code /// #define F(x) f(x) /// F(42); /// \endcode /// /// When expanding '\c F(42)', the '\c x' would call this with an /// SpellingLoc pointing at '\c 42' and an ExpansionLoc pointing at its /// location in the definition of '\c F'. static ExpansionInfo createForMacroArg(SourceLocation SpellingLoc, SourceLocation ExpansionLoc) { // We store an intentionally invalid source location for the end of the // expansion range to mark that this is a macro argument ion rather than // a normal one. return create(SpellingLoc, ExpansionLoc, SourceLocation()); } }; /// \brief This is a discriminated union of FileInfo and ExpansionInfo. /// /// SourceManager keeps an array of these objects, and they are uniquely /// identified by the FileID datatype. class SLocEntry { unsigned Offset; // low bit is set for expansion info. union { FileInfo File; ExpansionInfo Expansion; }; public: unsigned getOffset() const { return Offset >> 1; } bool isExpansion() const { return Offset & 1; } bool isFile() const { return !isExpansion(); } const FileInfo &getFile() const { assert(isFile() && "Not a file SLocEntry!"); return File; } const ExpansionInfo &getExpansion() const { assert(isExpansion() && "Not a macro expansion SLocEntry!"); return Expansion; } static SLocEntry get(unsigned Offset, const FileInfo &FI) { SLocEntry E; E.Offset = Offset << 1; E.File = FI; return E; } static SLocEntry get(unsigned Offset, const ExpansionInfo &Expansion) { SLocEntry E; E.Offset = (Offset << 1) | 1; E.Expansion = Expansion; return E; } }; } // end SrcMgr namespace. /// \brief External source of source location entries. class ExternalSLocEntrySource { public: virtual ~ExternalSLocEntrySource(); /// \brief Read the source location entry with index ID, which will always be /// less than -1. /// /// \returns true if an error occurred that prevented the source-location /// entry from being loaded. virtual bool ReadSLocEntry(int ID) = 0; /// \brief Retrieve the module import location and name for the given ID, if /// in fact it was loaded from a module (rather than, say, a precompiled /// header). virtual std::pair<SourceLocation, StringRef> getModuleImportLoc(int ID) = 0; }; /// \brief Holds the cache used by isBeforeInTranslationUnit. /// /// The cache structure is complex enough to be worth breaking out of /// SourceManager. class InBeforeInTUCacheEntry { /// \brief The FileID's of the cached query. /// /// If these match up with a subsequent query, the result can be reused. FileID LQueryFID, RQueryFID; /// \brief True if LQueryFID was created before RQueryFID. /// /// This is used to compare macro expansion locations. bool IsLQFIDBeforeRQFID; /// \brief The file found in common between the two \#include traces, i.e., /// the nearest common ancestor of the \#include tree. FileID CommonFID; /// \brief The offset of the previous query in CommonFID. /// /// Usually, this represents the location of the \#include for QueryFID, but /// if LQueryFID is a parent of RQueryFID (or vice versa) then these can be a /// random token in the parent. unsigned LCommonOffset, RCommonOffset; public: /// \brief Return true if the currently cached values match up with /// the specified LHS/RHS query. /// /// If not, we can't use the cache. bool isCacheValid(FileID LHS, FileID RHS) const { return LQueryFID == LHS && RQueryFID == RHS; } /// \brief If the cache is valid, compute the result given the /// specified offsets in the LHS/RHS FileID's. bool getCachedResult(unsigned LOffset, unsigned ROffset) const { // If one of the query files is the common file, use the offset. Otherwise, // use the #include loc in the common file. if (LQueryFID != CommonFID) LOffset = LCommonOffset; if (RQueryFID != CommonFID) ROffset = RCommonOffset; // It is common for multiple macro expansions to be "included" from the same // location (expansion location), in which case use the order of the FileIDs // to determine which came first. This will also take care the case where // one of the locations points at the inclusion/expansion point of the other // in which case its FileID will come before the other. if (LOffset == ROffset) return IsLQFIDBeforeRQFID; return LOffset < ROffset; } /// \brief Set up a new query. void setQueryFIDs(FileID LHS, FileID RHS, bool isLFIDBeforeRFID) { assert(LHS != RHS); LQueryFID = LHS; RQueryFID = RHS; IsLQFIDBeforeRQFID = isLFIDBeforeRFID; } void clear() { LQueryFID = RQueryFID = FileID(); IsLQFIDBeforeRQFID = false; } void setCommonLoc(FileID commonFID, unsigned lCommonOffset, unsigned rCommonOffset) { CommonFID = commonFID; LCommonOffset = lCommonOffset; RCommonOffset = rCommonOffset; } }; /// \brief The stack used when building modules on demand, which is used /// to provide a link between the source managers of the different compiler /// instances. typedef ArrayRef<std::pair<std::string, FullSourceLoc> > ModuleBuildStack; /// \brief This class handles loading and caching of source files into memory. /// /// This object owns the MemoryBuffer objects for all of the loaded /// files and assigns unique FileID's for each unique \#include chain. /// /// The SourceManager can be queried for information about SourceLocation /// objects, turning them into either spelling or expansion locations. Spelling /// locations represent where the bytes corresponding to a token came from and /// expansion locations represent where the location is in the user's view. In /// the case of a macro expansion, for example, the spelling location indicates /// where the expanded token came from and the expansion location specifies /// where it was expanded. class SourceManager : public RefCountedBase<SourceManager> { /// \brief DiagnosticsEngine object. DiagnosticsEngine &Diag; FileManager &FileMgr; mutable llvm::BumpPtrAllocator ContentCacheAlloc; /// \brief Memoized information about all of the files tracked by this /// SourceManager. /// /// This map allows us to merge ContentCache entries based /// on their FileEntry*. All ContentCache objects will thus have unique, /// non-null, FileEntry pointers. llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*> FileInfos; /// \brief True if the ContentCache for files that are overridden by other /// files, should report the original file name. Defaults to true. bool OverridenFilesKeepOriginalName; /// \brief True if non-system source files should be treated as volatile /// (likely to change while trying to use them). Defaults to false. bool UserFilesAreVolatile; struct OverriddenFilesInfoTy { /// \brief Files that have been overridden with the contents from another /// file. llvm::DenseMap<const FileEntry *, const FileEntry *> OverriddenFiles; /// \brief Files that were overridden with a memory buffer. llvm::DenseSet<const FileEntry *> OverriddenFilesWithBuffer; }; /// \brief Lazily create the object keeping overridden files info, since /// it is uncommonly used. std::unique_ptr<OverriddenFilesInfoTy> OverriddenFilesInfo; OverriddenFilesInfoTy &getOverriddenFilesInfo() { if (!OverriddenFilesInfo) OverriddenFilesInfo.reset(new OverriddenFilesInfoTy); return *OverriddenFilesInfo; } /// \brief Information about various memory buffers that we have read in. /// /// All FileEntry* within the stored ContentCache objects are NULL, /// as they do not refer to a file. std::vector<SrcMgr::ContentCache*> MemBufferInfos; /// \brief The table of SLocEntries that are local to this module. /// /// Positive FileIDs are indexes into this table. Entry 0 indicates an invalid /// expansion. SmallVector<SrcMgr::SLocEntry, 0> LocalSLocEntryTable; /// \brief The table of SLocEntries that are loaded from other modules. /// /// Negative FileIDs are indexes into this table. To get from ID to an index, /// use (-ID - 2). mutable SmallVector<SrcMgr::SLocEntry, 0> LoadedSLocEntryTable; /// \brief The starting offset of the next local SLocEntry. /// /// This is LocalSLocEntryTable.back().Offset + the size of that entry. unsigned NextLocalOffset; /// \brief The starting offset of the latest batch of loaded SLocEntries. /// /// This is LoadedSLocEntryTable.back().Offset, except that that entry might /// not have been loaded, so that value would be unknown. unsigned CurrentLoadedOffset; /// \brief The highest possible offset is 2^31-1, so CurrentLoadedOffset /// starts at 2^31. static const unsigned MaxLoadedOffset = 1U << 31U; /// \brief A bitmap that indicates whether the entries of LoadedSLocEntryTable /// have already been loaded from the external source. /// /// Same indexing as LoadedSLocEntryTable. std::vector<bool> SLocEntryLoaded; /// \brief An external source for source location entries. ExternalSLocEntrySource *ExternalSLocEntries; /// \brief A one-entry cache to speed up getFileID. /// /// LastFileIDLookup records the last FileID looked up or created, because it /// is very common to look up many tokens from the same file. mutable FileID LastFileIDLookup; /// \brief Holds information for \#line directives. /// /// This is referenced by indices from SLocEntryTable. LineTableInfo *LineTable; /// \brief These ivars serve as a cache used in the getLineNumber /// method which is used to speedup getLineNumber calls to nearby locations. mutable FileID LastLineNoFileIDQuery; mutable SrcMgr::ContentCache *LastLineNoContentCache; mutable unsigned LastLineNoFilePos; mutable unsigned LastLineNoResult; /// \brief The file ID for the main source file of the translation unit. FileID MainFileID; /// \brief The file ID for the precompiled preamble there is one. FileID PreambleFileID; // Statistics for -print-stats. mutable unsigned NumLinearScans, NumBinaryProbes; /// \brief Associates a FileID with its "included/expanded in" decomposed /// location. /// /// Used to cache results from and speed-up \c getDecomposedIncludedLoc /// function. mutable llvm::DenseMap<FileID, std::pair<FileID, unsigned> > IncludedLocMap; /// The key value into the IsBeforeInTUCache table. typedef std::pair<FileID, FileID> IsBeforeInTUCacheKey; /// The IsBeforeInTranslationUnitCache is a mapping from FileID pairs /// to cache results. typedef llvm::DenseMap<IsBeforeInTUCacheKey, InBeforeInTUCacheEntry> InBeforeInTUCache; /// Cache results for the isBeforeInTranslationUnit method. mutable InBeforeInTUCache IBTUCache; mutable InBeforeInTUCacheEntry IBTUCacheOverflow; /// Return the cache entry for comparing the given file IDs /// for isBeforeInTranslationUnit. InBeforeInTUCacheEntry &getInBeforeInTUCache(FileID LFID, FileID RFID) const; // Cache for the "fake" buffer used for error-recovery purposes. mutable std::unique_ptr<llvm::MemoryBuffer> FakeBufferForRecovery; mutable std::unique_ptr<SrcMgr::ContentCache> FakeContentCacheForRecovery; /// \brief Lazily computed map of macro argument chunks to their expanded /// source location. typedef std::map<unsigned, SourceLocation> MacroArgsMap; mutable llvm::DenseMap<FileID, MacroArgsMap *> MacroArgsCacheMap; /// \brief The stack of modules being built, which is used to detect /// cycles in the module dependency graph as modules are being built, as /// well as to describe why we're rebuilding a particular module. /// /// There is no way to set this value from the command line. If we ever need /// to do so (e.g., if on-demand module construction moves out-of-process), /// we can add a cc1-level option to do so. SmallVector<std::pair<std::string, FullSourceLoc>, 2> StoredModuleBuildStack; // SourceManager doesn't support copy construction. explicit SourceManager(const SourceManager&) = delete; void operator=(const SourceManager&) = delete; public: SourceManager(DiagnosticsEngine &Diag, FileManager &FileMgr, bool UserFilesAreVolatile = false); ~SourceManager(); void clearIDTables(); DiagnosticsEngine &getDiagnostics() const { return Diag; } FileManager &getFileManager() const { return FileMgr; } unsigned getNumLineTableFilenames() const; const char * getLineTableFilename(unsigned ID) const; /// \brief Set true if the SourceManager should report the original file name /// for contents of files that were overridden by other files. Defaults to /// true. void setOverridenFilesKeepOriginalName(bool value) { OverridenFilesKeepOriginalName = value; } /// \brief True if non-system source files should be treated as volatile /// (likely to change while trying to use them). bool userFilesAreVolatile() const { return UserFilesAreVolatile; } /// \brief Retrieve the module build stack. ModuleBuildStack getModuleBuildStack() const { return StoredModuleBuildStack; } /// \brief Set the module build stack. void setModuleBuildStack(ModuleBuildStack stack) { StoredModuleBuildStack.clear(); StoredModuleBuildStack.append(stack.begin(), stack.end()); } /// \brief Push an entry to the module build stack. void pushModuleBuildStack(StringRef moduleName, FullSourceLoc importLoc) { StoredModuleBuildStack.push_back(std::make_pair(moduleName.str(),importLoc)); } //===--------------------------------------------------------------------===// // MainFileID creation and querying methods. //===--------------------------------------------------------------------===// /// \brief Returns the FileID of the main source file. FileID getMainFileID() const { return MainFileID; } /// \brief Set the file ID for the main source file. void setMainFileID(FileID FID) { MainFileID = FID; } /// \brief Set the file ID for the precompiled preamble. void setPreambleFileID(FileID Preamble) { assert(PreambleFileID.isInvalid() && "PreambleFileID already set!"); PreambleFileID = Preamble; } /// \brief Get the file ID for the precompiled preamble if there is one. FileID getPreambleFileID() const { return PreambleFileID; } //===--------------------------------------------------------------------===// // Methods to create new FileID's and macro expansions. //===--------------------------------------------------------------------===// /// \brief Create a new FileID that represents the specified file /// being \#included from the specified IncludePosition. /// /// This translates NULL into standard input. FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID = 0, unsigned LoadedOffset = 0) { const SrcMgr::ContentCache * IR = getOrCreateContentCache(SourceFile, /*isSystemFile=*/FileCharacter != SrcMgr::C_User); assert(IR && "getOrCreateContentCache() cannot return NULL"); return createFileID(IR, IncludePos, FileCharacter, LoadedID, LoadedOffset); } /// \brief Create a new FileID that represents the specified memory buffer. /// /// This does no caching of the buffer and takes ownership of the /// MemoryBuffer, so only pass a MemoryBuffer to this once. FileID createFileID(std::unique_ptr<llvm::MemoryBuffer> Buffer, SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User, int LoadedID = 0, unsigned LoadedOffset = 0, SourceLocation IncludeLoc = SourceLocation()) { return createFileID(createMemBufferContentCache(std::move(Buffer)), IncludeLoc, FileCharacter, LoadedID, LoadedOffset); } /// \brief Return a new SourceLocation that encodes the /// fact that a token from SpellingLoc should actually be referenced from /// ExpansionLoc, and that it represents the expansion of a macro argument /// into the function-like macro body. SourceLocation createMacroArgExpansionLoc(SourceLocation Loc, SourceLocation ExpansionLoc, unsigned TokLength); /// \brief Return a new SourceLocation that encodes the fact /// that a token from SpellingLoc should actually be referenced from /// ExpansionLoc. SourceLocation createExpansionLoc(SourceLocation Loc, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd, unsigned TokLength, int LoadedID = 0, unsigned LoadedOffset = 0); /// \brief Retrieve the memory buffer associated with the given file. /// /// \param Invalid If non-NULL, will be set \c true if an error /// occurs while retrieving the memory buffer. llvm::MemoryBuffer *getMemoryBufferForFile(const FileEntry *File, bool *Invalid = nullptr); /// \brief Override the contents of the given source file by providing an /// already-allocated buffer. /// /// \param SourceFile the source file whose contents will be overridden. /// /// \param Buffer the memory buffer whose contents will be used as the /// data in the given source file. /// /// \param DoNotFree If true, then the buffer will not be freed when the /// source manager is destroyed. void overrideFileContents(const FileEntry *SourceFile, llvm::MemoryBuffer *Buffer, bool DoNotFree); void overrideFileContents(const FileEntry *SourceFile, std::unique_ptr<llvm::MemoryBuffer> Buffer) { overrideFileContents(SourceFile, Buffer.release(), /*DoNotFree*/ false); } /// \brief Override the given source file with another one. /// /// \param SourceFile the source file which will be overridden. /// /// \param NewFile the file whose contents will be used as the /// data instead of the contents of the given source file. void overrideFileContents(const FileEntry *SourceFile, const FileEntry *NewFile); /// \brief Returns true if the file contents have been overridden. bool isFileOverridden(const FileEntry *File) { if (OverriddenFilesInfo) { if (OverriddenFilesInfo->OverriddenFilesWithBuffer.count(File)) return true; if (OverriddenFilesInfo->OverriddenFiles.find(File) != OverriddenFilesInfo->OverriddenFiles.end()) return true; } return false; } /// \brief Disable overridding the contents of a file, previously enabled /// with #overrideFileContents. /// /// This should be called before parsing has begun. void disableFileContentsOverride(const FileEntry *File); //===--------------------------------------------------------------------===// // FileID manipulation methods. //===--------------------------------------------------------------------===// /// \brief Return the buffer for the specified FileID. /// /// If there is an error opening this buffer the first time, this /// manufactures a temporary buffer and returns a non-empty error string. llvm::MemoryBuffer *getBuffer(FileID FID, SourceLocation Loc, bool *Invalid = nullptr) const { bool MyInvalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid); if (MyInvalid || !Entry.isFile()) { if (Invalid) *Invalid = true; return getFakeBufferForRecovery(); } return Entry.getFile().getContentCache()->getBuffer(Diag, *this, Loc, Invalid); } llvm::MemoryBuffer *getBuffer(FileID FID, bool *Invalid = nullptr) const { bool MyInvalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid); if (MyInvalid || !Entry.isFile()) { if (Invalid) *Invalid = true; return getFakeBufferForRecovery(); } return Entry.getFile().getContentCache()->getBuffer(Diag, *this, SourceLocation(), Invalid); } /// \brief Returns the FileEntry record for the provided FileID. const FileEntry *getFileEntryForID(FileID FID) const { bool MyInvalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid); if (MyInvalid || !Entry.isFile()) return nullptr; const SrcMgr::ContentCache *Content = Entry.getFile().getContentCache(); if (!Content) return nullptr; return Content->OrigEntry; } /// \brief Returns the FileEntry record for the provided SLocEntry. const FileEntry *getFileEntryForSLocEntry(const SrcMgr::SLocEntry &sloc) const { const SrcMgr::ContentCache *Content = sloc.getFile().getContentCache(); if (!Content) return nullptr; return Content->OrigEntry; } /// \brief Return a StringRef to the source buffer data for the /// specified FileID. /// /// \param FID The file ID whose contents will be returned. /// \param Invalid If non-NULL, will be set true if an error occurred. StringRef getBufferData(FileID FID, bool *Invalid = nullptr) const; /// \brief Get the number of FileIDs (files and macros) that were created /// during preprocessing of \p FID, including it. unsigned getNumCreatedFIDsForFileID(FileID FID) const { bool Invalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); if (Invalid || !Entry.isFile()) return 0; return Entry.getFile().NumCreatedFIDs; } /// \brief Set the number of FileIDs (files and macros) that were created /// during preprocessing of \p FID, including it. void setNumCreatedFIDsForFileID(FileID FID, unsigned NumFIDs) const { bool Invalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); if (Invalid || !Entry.isFile()) return; assert(Entry.getFile().NumCreatedFIDs == 0 && "Already set!"); const_cast<SrcMgr::FileInfo &>(Entry.getFile()).NumCreatedFIDs = NumFIDs; } //===--------------------------------------------------------------------===// // SourceLocation manipulation methods. //===--------------------------------------------------------------------===// /// \brief Return the FileID for a SourceLocation. /// /// This is a very hot method that is used for all SourceManager queries /// that start with a SourceLocation object. It is responsible for finding /// the entry in SLocEntryTable which contains the specified location. /// FileID getFileID(SourceLocation SpellingLoc) const { unsigned SLocOffset = SpellingLoc.getOffset(); // If our one-entry cache covers this offset, just return it. if (isOffsetInFileID(LastFileIDLookup, SLocOffset)) return LastFileIDLookup; return getFileIDSlow(SLocOffset); } /// \brief Return the filename of the file containing a SourceLocation. StringRef getFilename(SourceLocation SpellingLoc) const { if (const FileEntry *F = getFileEntryForID(getFileID(SpellingLoc))) return F->getName(); return StringRef(); } /// \brief Return the source location corresponding to the first byte of /// the specified file. SourceLocation getLocForStartOfFile(FileID FID) const { bool Invalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); if (Invalid || !Entry.isFile()) return SourceLocation(); unsigned FileOffset = Entry.getOffset(); return SourceLocation::getFileLoc(FileOffset); } /// \brief Return the source location corresponding to the last byte of the /// specified file. SourceLocation getLocForEndOfFile(FileID FID) const { bool Invalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); if (Invalid || !Entry.isFile()) return SourceLocation(); unsigned FileOffset = Entry.getOffset(); return SourceLocation::getFileLoc(FileOffset + getFileIDSize(FID)); } /// \brief Returns the include location if \p FID is a \#include'd file /// otherwise it returns an invalid location. SourceLocation getIncludeLoc(FileID FID) const { bool Invalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); if (Invalid || !Entry.isFile()) return SourceLocation(); return Entry.getFile().getIncludeLoc(); } // \brief Returns the import location if the given source location is // located within a module, or an invalid location if the source location // is within the current translation unit. std::pair<SourceLocation, StringRef> getModuleImportLoc(SourceLocation Loc) const { FileID FID = getFileID(Loc); // Positive file IDs are in the current translation unit, and -1 is a // placeholder. if (FID.ID >= -1) return std::make_pair(SourceLocation(), ""); return ExternalSLocEntries->getModuleImportLoc(FID.ID); } /// \brief Given a SourceLocation object \p Loc, return the expansion /// location referenced by the ID. SourceLocation getExpansionLoc(SourceLocation Loc) const { // Handle the non-mapped case inline, defer to out of line code to handle // expansions. if (Loc.isFileID()) return Loc; return getExpansionLocSlowCase(Loc); } /// \brief Given \p Loc, if it is a macro location return the expansion /// location or the spelling location, depending on if it comes from a /// macro argument or not. SourceLocation getFileLoc(SourceLocation Loc) const { if (Loc.isFileID()) return Loc; return getFileLocSlowCase(Loc); } /// \brief Return the start/end of the expansion information for an /// expansion location. /// /// \pre \p Loc is required to be an expansion location. std::pair<SourceLocation,SourceLocation> getImmediateExpansionRange(SourceLocation Loc) const; /// \brief Given a SourceLocation object, return the range of /// tokens covered by the expansion in the ultimate file. std::pair<SourceLocation,SourceLocation> getExpansionRange(SourceLocation Loc) const; /// \brief Given a SourceRange object, return the range of /// tokens covered by the expansion in the ultimate file. SourceRange getExpansionRange(SourceRange Range) const { return SourceRange(getExpansionRange(Range.getBegin()).first, getExpansionRange(Range.getEnd()).second); } /// \brief Given a SourceLocation object, return the spelling /// location referenced by the ID. /// /// This is the place where the characters that make up the lexed token /// can be found. SourceLocation getSpellingLoc(SourceLocation Loc) const { // Handle the non-mapped case inline, defer to out of line code to handle // expansions. if (Loc.isFileID()) return Loc; return getSpellingLocSlowCase(Loc); } /// \brief Given a SourceLocation object, return the spelling location /// referenced by the ID. /// /// This is the first level down towards the place where the characters /// that make up the lexed token can be found. This should not generally /// be used by clients. SourceLocation getImmediateSpellingLoc(SourceLocation Loc) const; /// \brief Decompose the specified location into a raw FileID + Offset pair. /// /// The first element is the FileID, the second is the offset from the /// start of the buffer of the location. std::pair<FileID, unsigned> getDecomposedLoc(SourceLocation Loc) const { FileID FID = getFileID(Loc); bool Invalid = false; const SrcMgr::SLocEntry &E = getSLocEntry(FID, &Invalid); if (Invalid) return std::make_pair(FileID(), 0); return std::make_pair(FID, Loc.getOffset()-E.getOffset()); } /// \brief Decompose the specified location into a raw FileID + Offset pair. /// /// If the location is an expansion record, walk through it until we find /// the final location expanded. std::pair<FileID, unsigned> getDecomposedExpansionLoc(SourceLocation Loc) const { FileID FID = getFileID(Loc); bool Invalid = false; const SrcMgr::SLocEntry *E = &getSLocEntry(FID, &Invalid); if (Invalid) return std::make_pair(FileID(), 0); unsigned Offset = Loc.getOffset()-E->getOffset(); if (Loc.isFileID()) return std::make_pair(FID, Offset); return getDecomposedExpansionLocSlowCase(E); } /// \brief Decompose the specified location into a raw FileID + Offset pair. /// /// If the location is an expansion record, walk through it until we find /// its spelling record. std::pair<FileID, unsigned> getDecomposedSpellingLoc(SourceLocation Loc) const { FileID FID = getFileID(Loc); bool Invalid = false; const SrcMgr::SLocEntry *E = &getSLocEntry(FID, &Invalid); if (Invalid) return std::make_pair(FileID(), 0); unsigned Offset = Loc.getOffset()-E->getOffset(); if (Loc.isFileID()) return std::make_pair(FID, Offset); return getDecomposedSpellingLocSlowCase(E, Offset); } /// \brief Returns the "included/expanded in" decomposed location of the given /// FileID. std::pair<FileID, unsigned> getDecomposedIncludedLoc(FileID FID) const; /// \brief Returns the offset from the start of the file that the /// specified SourceLocation represents. /// /// This is not very meaningful for a macro ID. unsigned getFileOffset(SourceLocation SpellingLoc) const { return getDecomposedLoc(SpellingLoc).second; } /// \brief Tests whether the given source location represents a macro /// argument's expansion into the function-like macro definition. /// /// Such source locations only appear inside of the expansion /// locations representing where a particular function-like macro was /// expanded. bool isMacroArgExpansion(SourceLocation Loc) const; /// \brief Tests whether the given source location represents the expansion of /// a macro body. /// /// This is equivalent to testing whether the location is part of a macro /// expansion but not the expansion of an argument to a function-like macro. bool isMacroBodyExpansion(SourceLocation Loc) const; /// \brief Returns true if the given MacroID location points at the beginning /// of the immediate macro expansion. /// /// \param MacroBegin If non-null and function returns true, it is set to the /// begin location of the immediate macro expansion. bool isAtStartOfImmediateMacroExpansion(SourceLocation Loc, SourceLocation *MacroBegin = nullptr) const; /// \brief Returns true if the given MacroID location points at the character /// end of the immediate macro expansion. /// /// \param MacroEnd If non-null and function returns true, it is set to the /// character end location of the immediate macro expansion. bool isAtEndOfImmediateMacroExpansion(SourceLocation Loc, SourceLocation *MacroEnd = nullptr) const; /// \brief Returns true if \p Loc is inside the [\p Start, +\p Length) /// chunk of the source location address space. /// /// If it's true and \p RelativeOffset is non-null, it will be set to the /// relative offset of \p Loc inside the chunk. bool isInSLocAddrSpace(SourceLocation Loc, SourceLocation Start, unsigned Length, unsigned *RelativeOffset = nullptr) const { assert(((Start.getOffset() < NextLocalOffset && Start.getOffset()+Length <= NextLocalOffset) || (Start.getOffset() >= CurrentLoadedOffset && Start.getOffset()+Length < MaxLoadedOffset)) && "Chunk is not valid SLoc address space"); unsigned LocOffs = Loc.getOffset(); unsigned BeginOffs = Start.getOffset(); unsigned EndOffs = BeginOffs + Length; if (LocOffs >= BeginOffs && LocOffs < EndOffs) { if (RelativeOffset) *RelativeOffset = LocOffs - BeginOffs; return true; } return false; } /// \brief Return true if both \p LHS and \p RHS are in the local source /// location address space or the loaded one. /// /// If it's true and \p RelativeOffset is non-null, it will be set to the /// offset of \p RHS relative to \p LHS. bool isInSameSLocAddrSpace(SourceLocation LHS, SourceLocation RHS, int *RelativeOffset) const { unsigned LHSOffs = LHS.getOffset(), RHSOffs = RHS.getOffset(); bool LHSLoaded = LHSOffs >= CurrentLoadedOffset; bool RHSLoaded = RHSOffs >= CurrentLoadedOffset; if (LHSLoaded == RHSLoaded) { if (RelativeOffset) *RelativeOffset = RHSOffs - LHSOffs; return true; } return false; } //===--------------------------------------------------------------------===// // Queries about the code at a SourceLocation. //===--------------------------------------------------------------------===// /// \brief Return a pointer to the start of the specified location /// in the appropriate spelling MemoryBuffer. /// /// \param Invalid If non-NULL, will be set \c true if an error occurs. const char *getCharacterData(SourceLocation SL, bool *Invalid = nullptr) const; /// \brief Return the column # for the specified file position. /// /// This is significantly cheaper to compute than the line number. This /// returns zero if the column number isn't known. This may only be called /// on a file sloc, so you must choose a spelling or expansion location /// before calling this method. unsigned getColumnNumber(FileID FID, unsigned FilePos, bool *Invalid = nullptr) const; unsigned getSpellingColumnNumber(SourceLocation Loc, bool *Invalid = nullptr) const; unsigned getExpansionColumnNumber(SourceLocation Loc, bool *Invalid = nullptr) const; unsigned getPresumedColumnNumber(SourceLocation Loc, bool *Invalid = nullptr) const; /// \brief Given a SourceLocation, return the spelling line number /// for the position indicated. /// /// This requires building and caching a table of line offsets for the /// MemoryBuffer, so this is not cheap: use only when about to emit a /// diagnostic. unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid = nullptr) const; unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid = nullptr) const; unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid = nullptr) const; unsigned getPresumedLineNumber(SourceLocation Loc, bool *Invalid = nullptr) const; /// \brief Return the filename or buffer identifier of the buffer the /// location is in. /// /// Note that this name does not respect \#line directives. Use /// getPresumedLoc for normal clients. const char *getBufferName(SourceLocation Loc, bool *Invalid = nullptr) const; /// \brief Return the file characteristic of the specified source /// location, indicating whether this is a normal file, a system /// header, or an "implicit extern C" system header. /// /// This state can be modified with flags on GNU linemarker directives like: /// \code /// # 4 "foo.h" 3 /// \endcode /// which changes all source locations in the current file after that to be /// considered to be from a system header. SrcMgr::CharacteristicKind getFileCharacteristic(SourceLocation Loc) const; /// \brief Returns the "presumed" location of a SourceLocation specifies. /// /// A "presumed location" can be modified by \#line or GNU line marker /// directives. This provides a view on the data that a user should see /// in diagnostics, for example. /// /// Note that a presumed location is always given as the expansion point of /// an expansion location, not at the spelling location. /// /// \returns The presumed location of the specified SourceLocation. If the /// presumed location cannot be calculated (e.g., because \p Loc is invalid /// or the file containing \p Loc has changed on disk), returns an invalid /// presumed location. PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives = true) const; /// \brief Returns whether the PresumedLoc for a given SourceLocation is /// in the main file. /// /// This computes the "presumed" location for a SourceLocation, then checks /// whether it came from a file other than the main file. This is different /// from isWrittenInMainFile() because it takes line marker directives into /// account. bool isInMainFile(SourceLocation Loc) const; /// \brief Returns true if the spelling locations for both SourceLocations /// are part of the same file buffer. /// /// This check ignores line marker directives. bool isWrittenInSameFile(SourceLocation Loc1, SourceLocation Loc2) const { return getFileID(Loc1) == getFileID(Loc2); } /// \brief Returns true if the spelling location for the given location /// is in the main file buffer. /// /// This check ignores line marker directives. bool isWrittenInMainFile(SourceLocation Loc) const { return getFileID(Loc) == getMainFileID(); } /// \brief Returns if a SourceLocation is in a system header. bool isInSystemHeader(SourceLocation Loc) const { return getFileCharacteristic(Loc) != SrcMgr::C_User; } /// \brief Returns if a SourceLocation is in an "extern C" system header. bool isInExternCSystemHeader(SourceLocation Loc) const { return getFileCharacteristic(Loc) == SrcMgr::C_ExternCSystem; } /// \brief Returns whether \p Loc is expanded from a macro in a system header. bool isInSystemMacro(SourceLocation loc) { return loc.isMacroID() && isInSystemHeader(getSpellingLoc(loc)); } /// \brief The size of the SLocEntry that \p FID represents. unsigned getFileIDSize(FileID FID) const; /// \brief Given a specific FileID, returns true if \p Loc is inside that /// FileID chunk and sets relative offset (offset of \p Loc from beginning /// of FileID) to \p relativeOffset. bool isInFileID(SourceLocation Loc, FileID FID, unsigned *RelativeOffset = nullptr) const { unsigned Offs = Loc.getOffset(); if (isOffsetInFileID(FID, Offs)) { if (RelativeOffset) *RelativeOffset = Offs - getSLocEntry(FID).getOffset(); return true; } return false; } //===--------------------------------------------------------------------===// // Line Table Manipulation Routines //===--------------------------------------------------------------------===// /// \brief Return the uniqued ID for the specified filename. /// unsigned getLineTableFilenameID(StringRef Str); /// \brief Add a line note to the line table for the FileID and offset /// specified by Loc. /// /// If FilenameID is -1, it is considered to be unspecified. void AddLineNote(SourceLocation Loc, unsigned LineNo, int FilenameID); void AddLineNote(SourceLocation Loc, unsigned LineNo, int FilenameID, bool IsFileEntry, bool IsFileExit, bool IsSystemHeader, bool IsExternCHeader); /// \brief Determine if the source manager has a line table. bool hasLineTable() const { return LineTable != nullptr; } /// \brief Retrieve the stored line table. LineTableInfo &getLineTable(); //===--------------------------------------------------------------------===// // Queries for performance analysis. //===--------------------------------------------------------------------===// /// \brief Return the total amount of physical memory allocated by the /// ContentCache allocator. size_t getContentCacheSize() const { return ContentCacheAlloc.getTotalMemory(); } struct MemoryBufferSizes { const size_t malloc_bytes; const size_t mmap_bytes; MemoryBufferSizes(size_t malloc_bytes, size_t mmap_bytes) : malloc_bytes(malloc_bytes), mmap_bytes(mmap_bytes) {} }; /// \brief Return the amount of memory used by memory buffers, breaking down /// by heap-backed versus mmap'ed memory. MemoryBufferSizes getMemoryBufferSizes() const; /// \brief Return the amount of memory used for various side tables and /// data structures in the SourceManager. size_t getDataStructureSizes() const; //===--------------------------------------------------------------------===// // Other miscellaneous methods. //===--------------------------------------------------------------------===// /// \brief Get the source location for the given file:line:col triplet. /// /// If the source file is included multiple times, the source location will /// be based upon the first inclusion. SourceLocation translateFileLineCol(const FileEntry *SourceFile, unsigned Line, unsigned Col) const; /// \brief Get the FileID for the given file. /// /// If the source file is included multiple times, the FileID will be the /// first inclusion. FileID translateFile(const FileEntry *SourceFile) const; /// \brief Get the source location in \p FID for the given line:col. /// Returns null location if \p FID is not a file SLocEntry. SourceLocation translateLineCol(FileID FID, unsigned Line, unsigned Col) const; /// \brief If \p Loc points inside a function macro argument, the returned /// location will be the macro location in which the argument was expanded. /// If a macro argument is used multiple times, the expanded location will /// be at the first expansion of the argument. /// e.g. /// MY_MACRO(foo); /// ^ /// Passing a file location pointing at 'foo', will yield a macro location /// where 'foo' was expanded into. SourceLocation getMacroArgExpandedLocation(SourceLocation Loc) const; /// \brief Determines the order of 2 source locations in the translation unit. /// /// \returns true if LHS source location comes before RHS, false otherwise. bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const; /// \brief Determines the order of 2 source locations in the "source location /// address space". bool isBeforeInSLocAddrSpace(SourceLocation LHS, SourceLocation RHS) const { return isBeforeInSLocAddrSpace(LHS, RHS.getOffset()); } /// \brief Determines the order of a source location and a source location /// offset in the "source location address space". /// /// Note that we always consider source locations loaded from bool isBeforeInSLocAddrSpace(SourceLocation LHS, unsigned RHS) const { unsigned LHSOffset = LHS.getOffset(); bool LHSLoaded = LHSOffset >= CurrentLoadedOffset; bool RHSLoaded = RHS >= CurrentLoadedOffset; if (LHSLoaded == RHSLoaded) return LHSOffset < RHS; return LHSLoaded; } // Iterators over FileInfos. typedef llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*> ::const_iterator fileinfo_iterator; fileinfo_iterator fileinfo_begin() const { return FileInfos.begin(); } fileinfo_iterator fileinfo_end() const { return FileInfos.end(); } bool hasFileInfo(const FileEntry *File) const { return FileInfos.find(File) != FileInfos.end(); } /// \brief Print statistics to stderr. /// void PrintStats() const; /// \brief Get the number of local SLocEntries we have. unsigned local_sloc_entry_size() const { return LocalSLocEntryTable.size(); } /// \brief Get a local SLocEntry. This is exposed for indexing. const SrcMgr::SLocEntry &getLocalSLocEntry(unsigned Index, bool *Invalid = nullptr) const { assert(Index < LocalSLocEntryTable.size() && "Invalid index"); return LocalSLocEntryTable[Index]; } /// \brief Get the number of loaded SLocEntries we have. unsigned loaded_sloc_entry_size() const { return LoadedSLocEntryTable.size();} /// \brief Get a loaded SLocEntry. This is exposed for indexing. const SrcMgr::SLocEntry &getLoadedSLocEntry(unsigned Index, bool *Invalid = nullptr) const { assert(Index < LoadedSLocEntryTable.size() && "Invalid index"); if (SLocEntryLoaded[Index]) return LoadedSLocEntryTable[Index]; return loadSLocEntry(Index, Invalid); } const SrcMgr::SLocEntry &getSLocEntry(FileID FID, bool *Invalid = nullptr) const { if (FID.ID == 0 || FID.ID == -1) { if (Invalid) *Invalid = true; return LocalSLocEntryTable[0]; } return getSLocEntryByID(FID.ID, Invalid); } unsigned getNextLocalOffset() const { return NextLocalOffset; } void setExternalSLocEntrySource(ExternalSLocEntrySource *Source) { assert(LoadedSLocEntryTable.empty() && "Invalidating existing loaded entries"); ExternalSLocEntries = Source; } /// \brief Allocate a number of loaded SLocEntries, which will be actually /// loaded on demand from the external source. /// /// NumSLocEntries will be allocated, which occupy a total of TotalSize space /// in the global source view. The lowest ID and the base offset of the /// entries will be returned. std::pair<int, unsigned> AllocateLoadedSLocEntries(unsigned NumSLocEntries, unsigned TotalSize); /// \brief Returns true if \p Loc came from a PCH/Module. bool isLoadedSourceLocation(SourceLocation Loc) const { return Loc.getOffset() >= CurrentLoadedOffset; } /// \brief Returns true if \p Loc did not come from a PCH/Module. bool isLocalSourceLocation(SourceLocation Loc) const { return Loc.getOffset() < NextLocalOffset; } /// \brief Returns true if \p FID came from a PCH/Module. bool isLoadedFileID(FileID FID) const { assert(FID.ID != -1 && "Using FileID sentinel value"); return FID.ID < 0; } /// \brief Returns true if \p FID did not come from a PCH/Module. bool isLocalFileID(FileID FID) const { return !isLoadedFileID(FID); } /// Gets the location of the immediate macro caller, one level up the stack /// toward the initial macro typed into the source. SourceLocation getImmediateMacroCallerLoc(SourceLocation Loc) const { if (!Loc.isMacroID()) return Loc; // When we have the location of (part of) an expanded parameter, its // spelling location points to the argument as expanded in the macro call, // and therefore is used to locate the macro caller. if (isMacroArgExpansion(Loc)) return getImmediateSpellingLoc(Loc); // Otherwise, the caller of the macro is located where this macro is // expanded (while the spelling is part of the macro definition). return getImmediateExpansionRange(Loc).first; } private: llvm::MemoryBuffer *getFakeBufferForRecovery() const; const SrcMgr::ContentCache *getFakeContentCacheForRecovery() const; const SrcMgr::SLocEntry &loadSLocEntry(unsigned Index, bool *Invalid) const; /// \brief Get the entry with the given unwrapped FileID. const SrcMgr::SLocEntry &getSLocEntryByID(int ID, bool *Invalid = nullptr) const { assert(ID != -1 && "Using FileID sentinel value"); if (ID < 0) return getLoadedSLocEntryByID(ID, Invalid); return getLocalSLocEntry(static_cast<unsigned>(ID), Invalid); } const SrcMgr::SLocEntry & getLoadedSLocEntryByID(int ID, bool *Invalid = nullptr) const { return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2), Invalid); } /// Implements the common elements of storing an expansion info struct into /// the SLocEntry table and producing a source location that refers to it. SourceLocation createExpansionLocImpl(const SrcMgr::ExpansionInfo &Expansion, unsigned TokLength, int LoadedID = 0, unsigned LoadedOffset = 0); /// \brief Return true if the specified FileID contains the /// specified SourceLocation offset. This is a very hot method. inline bool isOffsetInFileID(FileID FID, unsigned SLocOffset) const { const SrcMgr::SLocEntry &Entry = getSLocEntry(FID); // If the entry is after the offset, it can't contain it. if (SLocOffset < Entry.getOffset()) return false; // If this is the very last entry then it does. if (FID.ID == -2) return true; // If it is the last local entry, then it does if the location is local. if (FID.ID+1 == static_cast<int>(LocalSLocEntryTable.size())) return SLocOffset < NextLocalOffset; // Otherwise, the entry after it has to not include it. This works for both // local and loaded entries. return SLocOffset < getSLocEntryByID(FID.ID+1).getOffset(); } /// \brief Returns the previous in-order FileID or an invalid FileID if there /// is no previous one. FileID getPreviousFileID(FileID FID) const; /// \brief Returns the next in-order FileID or an invalid FileID if there is /// no next one. FileID getNextFileID(FileID FID) const; /// \brief Create a new fileID for the specified ContentCache and /// include position. /// /// This works regardless of whether the ContentCache corresponds to a /// file or some other input source. FileID createFileID(const SrcMgr::ContentCache* File, SourceLocation IncludePos, SrcMgr::CharacteristicKind DirCharacter, int LoadedID, unsigned LoadedOffset); const SrcMgr::ContentCache * getOrCreateContentCache(const FileEntry *SourceFile, bool isSystemFile = false); /// \brief Create a new ContentCache for the specified memory buffer. const SrcMgr::ContentCache * createMemBufferContentCache(std::unique_ptr<llvm::MemoryBuffer> Buf); FileID getFileIDSlow(unsigned SLocOffset) const; FileID getFileIDLocal(unsigned SLocOffset) const; FileID getFileIDLoaded(unsigned SLocOffset) const; SourceLocation getExpansionLocSlowCase(SourceLocation Loc) const; SourceLocation getSpellingLocSlowCase(SourceLocation Loc) const; SourceLocation getFileLocSlowCase(SourceLocation Loc) const; std::pair<FileID, unsigned> getDecomposedExpansionLocSlowCase(const SrcMgr::SLocEntry *E) const; std::pair<FileID, unsigned> getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E, unsigned Offset) const; void computeMacroArgsCache(MacroArgsMap *&MacroArgsCache, FileID FID) const; void associateFileChunkWithMacroArgExp(MacroArgsMap &MacroArgsCache, FileID FID, SourceLocation SpellLoc, SourceLocation ExpansionLoc, unsigned ExpansionLength) const; friend class ASTReader; friend class ASTWriter; }; /// \brief Comparison function object. template<typename T> class BeforeThanCompare; /// \brief Compare two source locations. template<> class BeforeThanCompare<SourceLocation> { SourceManager &SM; public: explicit BeforeThanCompare(SourceManager &SM) : SM(SM) { } bool operator()(SourceLocation LHS, SourceLocation RHS) const { return SM.isBeforeInTranslationUnit(LHS, RHS); } }; /// \brief Compare two non-overlapping source ranges. template<> class BeforeThanCompare<SourceRange> { SourceManager &SM; public: explicit BeforeThanCompare(SourceManager &SM) : SM(SM) { } bool operator()(SourceRange LHS, SourceRange RHS) const { return SM.isBeforeInTranslationUnit(LHS.getBegin(), RHS.getBegin()); } }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsNVPTX.def
//===--- BuiltinsPTX.def - PTX Builtin function database ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the PTX-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // Builtins retained from previous PTX back-end BUILTIN(__builtin_ptx_read_tid_x, "i", "nc") BUILTIN(__builtin_ptx_read_tid_y, "i", "nc") BUILTIN(__builtin_ptx_read_tid_z, "i", "nc") BUILTIN(__builtin_ptx_read_tid_w, "i", "nc") BUILTIN(__builtin_ptx_read_ntid_x, "i", "nc") BUILTIN(__builtin_ptx_read_ntid_y, "i", "nc") BUILTIN(__builtin_ptx_read_ntid_z, "i", "nc") BUILTIN(__builtin_ptx_read_ntid_w, "i", "nc") BUILTIN(__builtin_ptx_read_ctaid_x, "i", "nc") BUILTIN(__builtin_ptx_read_ctaid_y, "i", "nc") BUILTIN(__builtin_ptx_read_ctaid_z, "i", "nc") BUILTIN(__builtin_ptx_read_ctaid_w, "i", "nc") BUILTIN(__builtin_ptx_read_nctaid_x, "i", "nc") BUILTIN(__builtin_ptx_read_nctaid_y, "i", "nc") BUILTIN(__builtin_ptx_read_nctaid_z, "i", "nc") BUILTIN(__builtin_ptx_read_nctaid_w, "i", "nc") BUILTIN(__builtin_ptx_read_laneid, "i", "nc") BUILTIN(__builtin_ptx_read_warpid, "i", "nc") BUILTIN(__builtin_ptx_read_nwarpid, "i", "nc") BUILTIN(__builtin_ptx_read_smid, "i", "nc") BUILTIN(__builtin_ptx_read_nsmid, "i", "nc") BUILTIN(__builtin_ptx_read_gridid, "i", "nc") BUILTIN(__builtin_ptx_read_lanemask_eq, "i", "nc") BUILTIN(__builtin_ptx_read_lanemask_le, "i", "nc") BUILTIN(__builtin_ptx_read_lanemask_lt, "i", "nc") BUILTIN(__builtin_ptx_read_lanemask_ge, "i", "nc") BUILTIN(__builtin_ptx_read_lanemask_gt, "i", "nc") BUILTIN(__builtin_ptx_read_clock, "i", "n") BUILTIN(__builtin_ptx_read_clock64, "Li", "n") BUILTIN(__builtin_ptx_read_pm0, "i", "n") BUILTIN(__builtin_ptx_read_pm1, "i", "n") BUILTIN(__builtin_ptx_read_pm2, "i", "n") BUILTIN(__builtin_ptx_read_pm3, "i", "n") BUILTIN(__builtin_ptx_bar_sync, "vi", "n") // Builtins exposed as part of NVVM // MISC BUILTIN(__nvvm_clz_i, "ii", "") BUILTIN(__nvvm_clz_ll, "iLLi", "") BUILTIN(__nvvm_popc_i, "ii", "") BUILTIN(__nvvm_popc_ll, "iLLi", "") BUILTIN(__nvvm_prmt, "UiUiUiUi", "") // Min Max BUILTIN(__nvvm_min_i, "iii", "") BUILTIN(__nvvm_min_ui, "UiUiUi", "") BUILTIN(__nvvm_min_ll, "LLiLLiLLi", "") BUILTIN(__nvvm_min_ull, "ULLiULLiULLi", "") BUILTIN(__nvvm_max_i, "iii", "") BUILTIN(__nvvm_max_ui, "UiUiUi", "") BUILTIN(__nvvm_max_ll, "LLiLLiLLi", "") BUILTIN(__nvvm_max_ull, "ULLiULLiULLi", "") BUILTIN(__nvvm_fmax_ftz_f, "fff", "") BUILTIN(__nvvm_fmax_f, "fff", "") BUILTIN(__nvvm_fmin_ftz_f, "fff", "") BUILTIN(__nvvm_fmin_f, "fff", "") BUILTIN(__nvvm_fmax_d, "ddd", "") BUILTIN(__nvvm_fmin_d, "ddd", "") // Multiplication BUILTIN(__nvvm_mulhi_i, "iii", "") BUILTIN(__nvvm_mulhi_ui, "UiUiUi", "") BUILTIN(__nvvm_mulhi_ll, "LLiLLiLLi", "") BUILTIN(__nvvm_mulhi_ull, "ULLiULLiULLi", "") BUILTIN(__nvvm_mul_rn_ftz_f, "fff", "") BUILTIN(__nvvm_mul_rn_f, "fff", "") BUILTIN(__nvvm_mul_rz_ftz_f, "fff", "") BUILTIN(__nvvm_mul_rz_f, "fff", "") BUILTIN(__nvvm_mul_rm_ftz_f, "fff", "") BUILTIN(__nvvm_mul_rm_f, "fff", "") BUILTIN(__nvvm_mul_rp_ftz_f, "fff", "") BUILTIN(__nvvm_mul_rp_f, "fff", "") BUILTIN(__nvvm_mul_rn_d, "ddd", "") BUILTIN(__nvvm_mul_rz_d, "ddd", "") BUILTIN(__nvvm_mul_rm_d, "ddd", "") BUILTIN(__nvvm_mul_rp_d, "ddd", "") BUILTIN(__nvvm_mul24_i, "iii", "") BUILTIN(__nvvm_mul24_ui, "UiUiUi", "") // Div BUILTIN(__nvvm_div_approx_ftz_f, "fff", "") BUILTIN(__nvvm_div_approx_f, "fff", "") BUILTIN(__nvvm_div_rn_ftz_f, "fff", "") BUILTIN(__nvvm_div_rn_f, "fff", "") BUILTIN(__nvvm_div_rz_ftz_f, "fff", "") BUILTIN(__nvvm_div_rz_f, "fff", "") BUILTIN(__nvvm_div_rm_ftz_f, "fff", "") BUILTIN(__nvvm_div_rm_f, "fff", "") BUILTIN(__nvvm_div_rp_ftz_f, "fff", "") BUILTIN(__nvvm_div_rp_f, "fff", "") BUILTIN(__nvvm_div_rn_d, "ddd", "") BUILTIN(__nvvm_div_rz_d, "ddd", "") BUILTIN(__nvvm_div_rm_d, "ddd", "") BUILTIN(__nvvm_div_rp_d, "ddd", "") // Brev BUILTIN(__nvvm_brev32, "UiUi", "") BUILTIN(__nvvm_brev64, "ULLiULLi", "") // Sad BUILTIN(__nvvm_sad_i, "iiii", "") BUILTIN(__nvvm_sad_ui, "UiUiUiUi", "") // Floor, Ceil BUILTIN(__nvvm_floor_ftz_f, "ff", "") BUILTIN(__nvvm_floor_f, "ff", "") BUILTIN(__nvvm_floor_d, "dd", "") BUILTIN(__nvvm_ceil_ftz_f, "ff", "") BUILTIN(__nvvm_ceil_f, "ff", "") BUILTIN(__nvvm_ceil_d, "dd", "") // Abs BUILTIN(__nvvm_abs_i, "ii", "") BUILTIN(__nvvm_abs_ll, "LLiLLi", "") BUILTIN(__nvvm_fabs_ftz_f, "ff", "") BUILTIN(__nvvm_fabs_f, "ff", "") BUILTIN(__nvvm_fabs_d, "dd", "") // Round BUILTIN(__nvvm_round_ftz_f, "ff", "") BUILTIN(__nvvm_round_f, "ff", "") BUILTIN(__nvvm_round_d, "dd", "") // Trunc BUILTIN(__nvvm_trunc_ftz_f, "ff", "") BUILTIN(__nvvm_trunc_f, "ff", "") BUILTIN(__nvvm_trunc_d, "dd", "") // Saturate BUILTIN(__nvvm_saturate_ftz_f, "ff", "") BUILTIN(__nvvm_saturate_f, "ff", "") BUILTIN(__nvvm_saturate_d, "dd", "") // Exp2, Log2 BUILTIN(__nvvm_ex2_approx_ftz_f, "ff", "") BUILTIN(__nvvm_ex2_approx_f, "ff", "") BUILTIN(__nvvm_ex2_approx_d, "dd", "") BUILTIN(__nvvm_lg2_approx_ftz_f, "ff", "") BUILTIN(__nvvm_lg2_approx_f, "ff", "") BUILTIN(__nvvm_lg2_approx_d, "dd", "") // Sin, Cos BUILTIN(__nvvm_sin_approx_ftz_f, "ff", "") BUILTIN(__nvvm_sin_approx_f, "ff", "") BUILTIN(__nvvm_cos_approx_ftz_f, "ff", "") BUILTIN(__nvvm_cos_approx_f, "ff", "") // Fma BUILTIN(__nvvm_fma_rn_ftz_f, "ffff", "") BUILTIN(__nvvm_fma_rn_f, "ffff", "") BUILTIN(__nvvm_fma_rz_ftz_f, "ffff", "") BUILTIN(__nvvm_fma_rz_f, "ffff", "") BUILTIN(__nvvm_fma_rm_ftz_f, "ffff", "") BUILTIN(__nvvm_fma_rm_f, "ffff", "") BUILTIN(__nvvm_fma_rp_ftz_f, "ffff", "") BUILTIN(__nvvm_fma_rp_f, "ffff", "") BUILTIN(__nvvm_fma_rn_d, "dddd", "") BUILTIN(__nvvm_fma_rz_d, "dddd", "") BUILTIN(__nvvm_fma_rm_d, "dddd", "") BUILTIN(__nvvm_fma_rp_d, "dddd", "") // Rcp BUILTIN(__nvvm_rcp_rn_ftz_f, "ff", "") BUILTIN(__nvvm_rcp_rn_f, "ff", "") BUILTIN(__nvvm_rcp_rz_ftz_f, "ff", "") BUILTIN(__nvvm_rcp_rz_f, "ff", "") BUILTIN(__nvvm_rcp_rm_ftz_f, "ff", "") BUILTIN(__nvvm_rcp_rm_f, "ff", "") BUILTIN(__nvvm_rcp_rp_ftz_f, "ff", "") BUILTIN(__nvvm_rcp_rp_f, "ff", "") BUILTIN(__nvvm_rcp_rn_d, "dd", "") BUILTIN(__nvvm_rcp_rz_d, "dd", "") BUILTIN(__nvvm_rcp_rm_d, "dd", "") BUILTIN(__nvvm_rcp_rp_d, "dd", "") BUILTIN(__nvvm_rcp_approx_ftz_d, "dd", "") // Sqrt BUILTIN(__nvvm_sqrt_rn_ftz_f, "ff", "") BUILTIN(__nvvm_sqrt_rn_f, "ff", "") BUILTIN(__nvvm_sqrt_rz_ftz_f, "ff", "") BUILTIN(__nvvm_sqrt_rz_f, "ff", "") BUILTIN(__nvvm_sqrt_rm_ftz_f, "ff", "") BUILTIN(__nvvm_sqrt_rm_f, "ff", "") BUILTIN(__nvvm_sqrt_rp_ftz_f, "ff", "") BUILTIN(__nvvm_sqrt_rp_f, "ff", "") BUILTIN(__nvvm_sqrt_approx_ftz_f, "ff", "") BUILTIN(__nvvm_sqrt_approx_f, "ff", "") BUILTIN(__nvvm_sqrt_rn_d, "dd", "") BUILTIN(__nvvm_sqrt_rz_d, "dd", "") BUILTIN(__nvvm_sqrt_rm_d, "dd", "") BUILTIN(__nvvm_sqrt_rp_d, "dd", "") // Rsqrt BUILTIN(__nvvm_rsqrt_approx_ftz_f, "ff", "") BUILTIN(__nvvm_rsqrt_approx_f, "ff", "") BUILTIN(__nvvm_rsqrt_approx_d, "dd", "") // Add BUILTIN(__nvvm_add_rn_ftz_f, "fff", "") BUILTIN(__nvvm_add_rn_f, "fff", "") BUILTIN(__nvvm_add_rz_ftz_f, "fff", "") BUILTIN(__nvvm_add_rz_f, "fff", "") BUILTIN(__nvvm_add_rm_ftz_f, "fff", "") BUILTIN(__nvvm_add_rm_f, "fff", "") BUILTIN(__nvvm_add_rp_ftz_f, "fff", "") BUILTIN(__nvvm_add_rp_f, "fff", "") BUILTIN(__nvvm_add_rn_d, "ddd", "") BUILTIN(__nvvm_add_rz_d, "ddd", "") BUILTIN(__nvvm_add_rm_d, "ddd", "") BUILTIN(__nvvm_add_rp_d, "ddd", "") // Convert BUILTIN(__nvvm_d2f_rn_ftz, "fd", "") BUILTIN(__nvvm_d2f_rn, "fd", "") BUILTIN(__nvvm_d2f_rz_ftz, "fd", "") BUILTIN(__nvvm_d2f_rz, "fd", "") BUILTIN(__nvvm_d2f_rm_ftz, "fd", "") BUILTIN(__nvvm_d2f_rm, "fd", "") BUILTIN(__nvvm_d2f_rp_ftz, "fd", "") BUILTIN(__nvvm_d2f_rp, "fd", "") BUILTIN(__nvvm_d2i_rn, "id", "") BUILTIN(__nvvm_d2i_rz, "id", "") BUILTIN(__nvvm_d2i_rm, "id", "") BUILTIN(__nvvm_d2i_rp, "id", "") BUILTIN(__nvvm_d2ui_rn, "Uid", "") BUILTIN(__nvvm_d2ui_rz, "Uid", "") BUILTIN(__nvvm_d2ui_rm, "Uid", "") BUILTIN(__nvvm_d2ui_rp, "Uid", "") BUILTIN(__nvvm_i2d_rn, "di", "") BUILTIN(__nvvm_i2d_rz, "di", "") BUILTIN(__nvvm_i2d_rm, "di", "") BUILTIN(__nvvm_i2d_rp, "di", "") BUILTIN(__nvvm_ui2d_rn, "dUi", "") BUILTIN(__nvvm_ui2d_rz, "dUi", "") BUILTIN(__nvvm_ui2d_rm, "dUi", "") BUILTIN(__nvvm_ui2d_rp, "dUi", "") BUILTIN(__nvvm_f2i_rn_ftz, "if", "") BUILTIN(__nvvm_f2i_rn, "if", "") BUILTIN(__nvvm_f2i_rz_ftz, "if", "") BUILTIN(__nvvm_f2i_rz, "if", "") BUILTIN(__nvvm_f2i_rm_ftz, "if", "") BUILTIN(__nvvm_f2i_rm, "if", "") BUILTIN(__nvvm_f2i_rp_ftz, "if", "") BUILTIN(__nvvm_f2i_rp, "if", "") BUILTIN(__nvvm_f2ui_rn_ftz, "Uif", "") BUILTIN(__nvvm_f2ui_rn, "Uif", "") BUILTIN(__nvvm_f2ui_rz_ftz, "Uif", "") BUILTIN(__nvvm_f2ui_rz, "Uif", "") BUILTIN(__nvvm_f2ui_rm_ftz, "Uif", "") BUILTIN(__nvvm_f2ui_rm, "Uif", "") BUILTIN(__nvvm_f2ui_rp_ftz, "Uif", "") BUILTIN(__nvvm_f2ui_rp, "Uif", "") BUILTIN(__nvvm_i2f_rn, "fi", "") BUILTIN(__nvvm_i2f_rz, "fi", "") BUILTIN(__nvvm_i2f_rm, "fi", "") BUILTIN(__nvvm_i2f_rp, "fi", "") BUILTIN(__nvvm_ui2f_rn, "fUi", "") BUILTIN(__nvvm_ui2f_rz, "fUi", "") BUILTIN(__nvvm_ui2f_rm, "fUi", "") BUILTIN(__nvvm_ui2f_rp, "fUi", "") BUILTIN(__nvvm_lohi_i2d, "dii", "") BUILTIN(__nvvm_d2i_lo, "id", "") BUILTIN(__nvvm_d2i_hi, "id", "") BUILTIN(__nvvm_f2ll_rn_ftz, "LLif", "") BUILTIN(__nvvm_f2ll_rn, "LLif", "") BUILTIN(__nvvm_f2ll_rz_ftz, "LLif", "") BUILTIN(__nvvm_f2ll_rz, "LLif", "") BUILTIN(__nvvm_f2ll_rm_ftz, "LLif", "") BUILTIN(__nvvm_f2ll_rm, "LLif", "") BUILTIN(__nvvm_f2ll_rp_ftz, "LLif", "") BUILTIN(__nvvm_f2ll_rp, "LLif", "") BUILTIN(__nvvm_f2ull_rn_ftz, "ULLif", "") BUILTIN(__nvvm_f2ull_rn, "ULLif", "") BUILTIN(__nvvm_f2ull_rz_ftz, "ULLif", "") BUILTIN(__nvvm_f2ull_rz, "ULLif", "") BUILTIN(__nvvm_f2ull_rm_ftz, "ULLif", "") BUILTIN(__nvvm_f2ull_rm, "ULLif", "") BUILTIN(__nvvm_f2ull_rp_ftz, "ULLif", "") BUILTIN(__nvvm_f2ull_rp, "ULLif", "") BUILTIN(__nvvm_d2ll_rn, "LLid", "") BUILTIN(__nvvm_d2ll_rz, "LLid", "") BUILTIN(__nvvm_d2ll_rm, "LLid", "") BUILTIN(__nvvm_d2ll_rp, "LLid", "") BUILTIN(__nvvm_d2ull_rn, "ULLid", "") BUILTIN(__nvvm_d2ull_rz, "ULLid", "") BUILTIN(__nvvm_d2ull_rm, "ULLid", "") BUILTIN(__nvvm_d2ull_rp, "ULLid", "") BUILTIN(__nvvm_ll2f_rn, "fLLi", "") BUILTIN(__nvvm_ll2f_rz, "fLLi", "") BUILTIN(__nvvm_ll2f_rm, "fLLi", "") BUILTIN(__nvvm_ll2f_rp, "fLLi", "") BUILTIN(__nvvm_ull2f_rn, "fULLi", "") BUILTIN(__nvvm_ull2f_rz, "fULLi", "") BUILTIN(__nvvm_ull2f_rm, "fULLi", "") BUILTIN(__nvvm_ull2f_rp, "fULLi", "") BUILTIN(__nvvm_ll2d_rn, "dLLi", "") BUILTIN(__nvvm_ll2d_rz, "dLLi", "") BUILTIN(__nvvm_ll2d_rm, "dLLi", "") BUILTIN(__nvvm_ll2d_rp, "dLLi", "") BUILTIN(__nvvm_ull2d_rn, "dULLi", "") BUILTIN(__nvvm_ull2d_rz, "dULLi", "") BUILTIN(__nvvm_ull2d_rm, "dULLi", "") BUILTIN(__nvvm_ull2d_rp, "dULLi", "") BUILTIN(__nvvm_f2h_rn_ftz, "Usf", "") BUILTIN(__nvvm_f2h_rn, "Usf", "") BUILTIN(__nvvm_h2f, "fUs", "") // Bitcast BUILTIN(__nvvm_bitcast_f2i, "if", "") BUILTIN(__nvvm_bitcast_i2f, "fi", "") BUILTIN(__nvvm_bitcast_ll2d, "dLLi", "") BUILTIN(__nvvm_bitcast_d2ll, "LLid", "") // Sync BUILTIN(__syncthreads, "v", "") BUILTIN(__nvvm_bar0, "v", "") BUILTIN(__nvvm_bar0_popc, "ii", "") BUILTIN(__nvvm_bar0_and, "ii", "") BUILTIN(__nvvm_bar0_or, "ii", "") // Membar BUILTIN(__nvvm_membar_cta, "v", "") BUILTIN(__nvvm_membar_gl, "v", "") BUILTIN(__nvvm_membar_sys, "v", "") // Memcpy, Memset BUILTIN(__nvvm_memcpy, "vUc*Uc*zi","") BUILTIN(__nvvm_memset, "vUc*Uczi","") // Image BUILTIN(__builtin_ptx_read_image2Dfi_, "V4fiiii", "") BUILTIN(__builtin_ptx_read_image2Dff_, "V4fiiff", "") BUILTIN(__builtin_ptx_read_image2Dii_, "V4iiiii", "") BUILTIN(__builtin_ptx_read_image2Dif_, "V4iiiff", "") BUILTIN(__builtin_ptx_read_image3Dfi_, "V4fiiiiii", "") BUILTIN(__builtin_ptx_read_image3Dff_, "V4fiiffff", "") BUILTIN(__builtin_ptx_read_image3Dii_, "V4iiiiiii", "") BUILTIN(__builtin_ptx_read_image3Dif_, "V4iiiffff", "") BUILTIN(__builtin_ptx_write_image2Df_, "viiiffff", "") BUILTIN(__builtin_ptx_write_image2Di_, "viiiiiii", "") BUILTIN(__builtin_ptx_write_image2Dui_, "viiiUiUiUiUi", "") BUILTIN(__builtin_ptx_get_image_depthi_, "ii", "") BUILTIN(__builtin_ptx_get_image_heighti_, "ii", "") BUILTIN(__builtin_ptx_get_image_widthi_, "ii", "") BUILTIN(__builtin_ptx_get_image_channel_data_typei_, "ii", "") BUILTIN(__builtin_ptx_get_image_channel_orderi_, "ii", "") // Atomic // // We need the atom intrinsics because // - they are used in converging analysis // - they are used in address space analysis and optimization // So it does not hurt to expose them as builtins. // BUILTIN(__nvvm_atom_add_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_add_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_add_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_add_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_add_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_add_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_add_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_add_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_add_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_add_g_f, "ffD*1f", "n") BUILTIN(__nvvm_atom_add_s_f, "ffD*3f", "n") BUILTIN(__nvvm_atom_add_gen_f, "ffD*f", "n") BUILTIN(__nvvm_atom_sub_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_sub_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_sub_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_sub_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_sub_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_sub_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_sub_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_sub_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_sub_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_xchg_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_xchg_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_xchg_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_xchg_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_xchg_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_xchg_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_xchg_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_xchg_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_xchg_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_max_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_max_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_max_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_max_g_ui, "UiUiD*1Ui", "n") BUILTIN(__nvvm_atom_max_s_ui, "UiUiD*3Ui", "n") BUILTIN(__nvvm_atom_max_gen_ui, "UiUiD*Ui", "n") BUILTIN(__nvvm_atom_max_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_max_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_max_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_max_g_ul, "ULiULiD*1ULi", "n") BUILTIN(__nvvm_atom_max_s_ul, "ULiULiD*3ULi", "n") BUILTIN(__nvvm_atom_max_gen_ul, "ULiULiD*ULi", "n") BUILTIN(__nvvm_atom_max_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_max_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_max_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_max_g_ull, "ULLiULLiD*1ULLi", "n") BUILTIN(__nvvm_atom_max_s_ull, "ULLiULLiD*3ULLi", "n") BUILTIN(__nvvm_atom_max_gen_ull, "ULLiULLiD*ULLi", "n") BUILTIN(__nvvm_atom_min_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_min_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_min_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_min_g_ui, "UiUiD*1Ui", "n") BUILTIN(__nvvm_atom_min_s_ui, "UiUiD*3Ui", "n") BUILTIN(__nvvm_atom_min_gen_ui, "UiUiD*Ui", "n") BUILTIN(__nvvm_atom_min_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_min_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_min_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_min_g_ul, "ULiULiD*1ULi", "n") BUILTIN(__nvvm_atom_min_s_ul, "ULiULiD*3ULi", "n") BUILTIN(__nvvm_atom_min_gen_ul, "ULiULiD*ULi", "n") BUILTIN(__nvvm_atom_min_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_min_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_min_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_min_g_ull, "ULLiULLiD*1ULLi", "n") BUILTIN(__nvvm_atom_min_s_ull, "ULLiULLiD*3ULLi", "n") BUILTIN(__nvvm_atom_min_gen_ull, "ULLiULLiD*ULLi", "n") BUILTIN(__nvvm_atom_inc_g_ui, "UiUiD*1Ui", "n") BUILTIN(__nvvm_atom_inc_s_ui, "UiUiD*3Ui", "n") BUILTIN(__nvvm_atom_inc_gen_ui, "UiUiD*Ui", "n") BUILTIN(__nvvm_atom_dec_g_ui, "UiUiD*1Ui", "n") BUILTIN(__nvvm_atom_dec_s_ui, "UiUiD*3Ui", "n") BUILTIN(__nvvm_atom_dec_gen_ui, "UiUiD*Ui", "n") BUILTIN(__nvvm_atom_and_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_and_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_and_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_and_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_and_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_and_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_and_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_and_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_and_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_or_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_or_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_or_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_or_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_or_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_or_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_or_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_or_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_or_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_xor_g_i, "iiD*1i", "n") BUILTIN(__nvvm_atom_xor_s_i, "iiD*3i", "n") BUILTIN(__nvvm_atom_xor_gen_i, "iiD*i", "n") BUILTIN(__nvvm_atom_xor_g_l, "LiLiD*1Li", "n") BUILTIN(__nvvm_atom_xor_s_l, "LiLiD*3Li", "n") BUILTIN(__nvvm_atom_xor_gen_l, "LiLiD*Li", "n") BUILTIN(__nvvm_atom_xor_g_ll, "LLiLLiD*1LLi", "n") BUILTIN(__nvvm_atom_xor_s_ll, "LLiLLiD*3LLi", "n") BUILTIN(__nvvm_atom_xor_gen_ll, "LLiLLiD*LLi", "n") BUILTIN(__nvvm_atom_cas_g_i, "iiD*1ii", "n") BUILTIN(__nvvm_atom_cas_s_i, "iiD*3ii", "n") BUILTIN(__nvvm_atom_cas_gen_i, "iiD*ii", "n") BUILTIN(__nvvm_atom_cas_g_l, "LiLiD*1LiLi", "n") BUILTIN(__nvvm_atom_cas_s_l, "LiLiD*3LiLi", "n") BUILTIN(__nvvm_atom_cas_gen_l, "LiLiD*LiLi", "n") BUILTIN(__nvvm_atom_cas_g_ll, "LLiLLiD*1LLiLLi", "n") BUILTIN(__nvvm_atom_cas_s_ll, "LLiLLiD*3LLiLLi", "n") BUILTIN(__nvvm_atom_cas_gen_ll, "LLiLLiD*LLiLLi", "n") // Compiler Error Warn BUILTIN(__nvvm_compiler_error, "vcC*4", "n") BUILTIN(__nvvm_compiler_warn, "vcC*4", "n") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TargetBuiltins.h
//===--- TargetBuiltins.h - Target specific builtin IDs ---------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Enumerates target-specific builtins in their own namespaces within /// namespace ::clang. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TARGETBUILTINS_H #define LLVM_CLANG_BASIC_TARGETBUILTINS_H #include <stdint.h> #include "clang/Basic/Builtins.h" #undef PPC namespace clang { #if 0 // HLSL Change Starts - remove unused builtins namespace NEON { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsNEON.def" FirstTSBuiltin }; } /// \brief ARM builtins namespace ARM { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, LastNEONBuiltin = NEON::FirstTSBuiltin - 1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsARM.def" LastTSBuiltin }; } /// \brief AArch64 builtins namespace AArch64 { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, LastNEONBuiltin = NEON::FirstTSBuiltin - 1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsAArch64.def" LastTSBuiltin }; } /// \brief PPC builtins namespace PPC { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsPPC.def" LastTSBuiltin }; } /// \brief NVPTX builtins namespace NVPTX { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsNVPTX.def" LastTSBuiltin }; } /// \brief AMDGPU builtins namespace AMDGPU { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsAMDGPU.def" LastTSBuiltin }; } /// \brief X86 builtins namespace X86 { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsX86.def" LastTSBuiltin }; } /// \brief Flags to identify the types for overloaded Neon builtins. /// /// These must be kept in sync with the flags in utils/TableGen/NeonEmitter.h. class NeonTypeFlags { enum { EltTypeMask = 0xf, UnsignedFlag = 0x10, QuadFlag = 0x20 }; uint32_t Flags; public: enum EltType { Int8, Int16, Int32, Int64, Poly8, Poly16, Poly64, Poly128, Float16, Float32, Float64 }; NeonTypeFlags(unsigned F) : Flags(F) {} NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) { if (IsUnsigned) Flags |= UnsignedFlag; if (IsQuad) Flags |= QuadFlag; } EltType getEltType() const { return (EltType)(Flags & EltTypeMask); } bool isPoly() const { EltType ET = getEltType(); return ET == Poly8 || ET == Poly16; } bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; } bool isQuad() const { return (Flags & QuadFlag) != 0; } }; /// \brief Hexagon builtins namespace Hexagon { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsHexagon.def" LastTSBuiltin }; } /// \brief MIPS builtins namespace Mips { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsMips.def" LastTSBuiltin }; } /// \brief XCore builtins namespace XCore { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsXCore.def" LastTSBuiltin }; } /// \brief Le64 builtins namespace Le64 { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsLe64.def" LastTSBuiltin }; } /// \brief SystemZ builtins namespace SystemZ { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsSystemZ.def" LastTSBuiltin }; } #endif // HLSL Change Ends - remove unused builtins /// \brief DXIL builtins namespace DXIL { enum { LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/BuiltinsDXIL.def" LastTSBuiltin }; } } // end namespace clang. #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TemplateKinds.h
//===--- TemplateKinds.h - Enum values for C++ Template Kinds ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::TemplateNameKind enum. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TEMPLATEKINDS_H #define LLVM_CLANG_BASIC_TEMPLATEKINDS_H namespace clang { /// \brief Specifies the kind of template name that an identifier refers to. /// Be careful when changing this: this enumeration is used in diagnostics. enum TemplateNameKind { /// The name does not refer to a template. TNK_Non_template = 0, /// The name refers to a function template or a set of overloaded /// functions that includes at least one function template. TNK_Function_template, /// The name refers to a template whose specialization produces a /// type. The template itself could be a class template, template /// template parameter, or C++0x template alias. TNK_Type_template, /// The name refers to a variable template whose specialization produces a /// variable. TNK_Var_template, /// The name refers to a dependent template name. Whether the /// template name is assumed to refer to a type template or a /// function template depends on the context in which the template /// name occurs. TNK_Dependent_template_name }; } #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/CommentOptions.h
//===--- CommentOptions.h - Options for parsing comments -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::CommentOptions interface. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_COMMENTOPTIONS_H #define LLVM_CLANG_BASIC_COMMENTOPTIONS_H #include <string> #include <vector> namespace clang { /// \brief Options for controlling comment parsing. struct CommentOptions { typedef std::vector<std::string> BlockCommandNamesTy; /// \brief Command names to treat as block commands in comments. /// Should not include the leading backslash. BlockCommandNamesTy BlockCommandNames; /// \brief Treat ordinary comments as documentation comments. bool ParseAllComments; CommentOptions() : ParseAllComments(false) { } }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/ExceptionSpecificationType.h
//===--- ExceptionSpecificationType.h ---------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the ExceptionSpecificationType enumeration and various /// utility functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H #define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H namespace clang { /// \brief The various types of exception specifications that exist in C++11. enum ExceptionSpecificationType { EST_None, ///< no exception specification EST_DynamicNone, ///< throw() EST_Dynamic, ///< throw(T1, T2) EST_MSAny, ///< Microsoft throw(...) extension EST_BasicNoexcept, ///< noexcept EST_ComputedNoexcept, ///< noexcept(expression) EST_Unevaluated, ///< not evaluated yet, for special member function EST_Uninstantiated, ///< not instantiated yet EST_Unparsed ///< not parsed yet }; inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) { return ESpecType >= EST_DynamicNone && ESpecType <= EST_MSAny; } inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) { return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept; } inline bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType) { return ESpecType == EST_Unevaluated || ESpecType == EST_Uninstantiated; } /// \brief Possible results from evaluation of a noexcept expression. enum CanThrowResult { CT_Cannot, CT_Dependent, CT_Can }; inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) { // CanThrowResult constants are ordered so that the maximum is the correct // merge result. return CT1 > CT2 ? CT1 : CT2; } } // end namespace clang #endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsPPC.def
//===--- BuiltinsPPC.def - PowerPC Builtin function database ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the PowerPC-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // The format of this database matches clang/Basic/Builtins.def. // This is just a placeholder, the types and attributes are wrong. BUILTIN(__builtin_altivec_vaddcuw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vaddsbs, "V16ScV16ScV16Sc", "") BUILTIN(__builtin_altivec_vaddubs, "V16UcV16UcV16Uc", "") BUILTIN(__builtin_altivec_vaddshs, "V8SsV8SsV8Ss", "") BUILTIN(__builtin_altivec_vadduhs, "V8UsV8UsV8Us", "") BUILTIN(__builtin_altivec_vaddsws, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vadduws, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vaddeuqm, "V1ULLLiV1ULLLiV1ULLLiV1ULLLi","") BUILTIN(__builtin_altivec_vaddcuq, "V1ULLLiV1ULLLiV1ULLLi","") BUILTIN(__builtin_altivec_vaddecuq, "V1ULLLiV1ULLLiV1ULLLiV1ULLLi","") BUILTIN(__builtin_altivec_vsubsbs, "V16ScV16ScV16Sc", "") BUILTIN(__builtin_altivec_vsububs, "V16UcV16UcV16Uc", "") BUILTIN(__builtin_altivec_vsubshs, "V8SsV8SsV8Ss", "") BUILTIN(__builtin_altivec_vsubuhs, "V8UsV8UsV8Us", "") BUILTIN(__builtin_altivec_vsubsws, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vsubuws, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vsubeuqm, "V1ULLLiV1ULLLiV1ULLLiV1ULLLi","") BUILTIN(__builtin_altivec_vsubcuq, "V1ULLLiV1ULLLiV1ULLLi","") BUILTIN(__builtin_altivec_vsubecuq, "V1ULLLiV1ULLLiV1ULLLiV1ULLLi","") BUILTIN(__builtin_altivec_vavgsb, "V16ScV16ScV16Sc", "") BUILTIN(__builtin_altivec_vavgub, "V16UcV16UcV16Uc", "") BUILTIN(__builtin_altivec_vavgsh, "V8SsV8SsV8Ss", "") BUILTIN(__builtin_altivec_vavguh, "V8UsV8UsV8Us", "") BUILTIN(__builtin_altivec_vavgsw, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vrfip, "V4fV4f", "") BUILTIN(__builtin_altivec_vcfsx, "V4fV4ii", "") BUILTIN(__builtin_altivec_vcfux, "V4fV4ii", "") BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fi", "") BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fi", "") BUILTIN(__builtin_altivec_dss, "vUi", "") BUILTIN(__builtin_altivec_dssall, "v", "") BUILTIN(__builtin_altivec_dst, "vvC*iUi", "") BUILTIN(__builtin_altivec_dstt, "vvC*iUi", "") BUILTIN(__builtin_altivec_dstst, "vvC*iUi", "") BUILTIN(__builtin_altivec_dststt, "vvC*iUi", "") BUILTIN(__builtin_altivec_vexptefp, "V4fV4f", "") BUILTIN(__builtin_altivec_vrfim, "V4fV4f", "") BUILTIN(__builtin_altivec_lvx, "V4iivC*", "") BUILTIN(__builtin_altivec_lvxl, "V4iivC*", "") BUILTIN(__builtin_altivec_lvebx, "V16civC*", "") BUILTIN(__builtin_altivec_lvehx, "V8sivC*", "") BUILTIN(__builtin_altivec_lvewx, "V4iivC*", "") BUILTIN(__builtin_altivec_vlogefp, "V4fV4f", "") BUILTIN(__builtin_altivec_lvsl, "V16cUcvC*", "") BUILTIN(__builtin_altivec_lvsr, "V16cUcvC*", "") BUILTIN(__builtin_altivec_vmaddfp, "V4fV4fV4fV4f", "") BUILTIN(__builtin_altivec_vmhaddshs, "V8sV8sV8sV8s", "") BUILTIN(__builtin_altivec_vmhraddshs, "V8sV8sV8sV8s", "") BUILTIN(__builtin_altivec_vmsumubm, "V4UiV16UcV16UcV4Ui", "") BUILTIN(__builtin_altivec_vmsummbm, "V4SiV16ScV16UcV4Si", "") BUILTIN(__builtin_altivec_vmsumuhm, "V4UiV8UsV8UsV4Ui", "") BUILTIN(__builtin_altivec_vmsumshm, "V4SiV8SsV8SsV4Si", "") BUILTIN(__builtin_altivec_vmsumuhs, "V4UiV8UsV8UsV4Ui", "") BUILTIN(__builtin_altivec_vmsumshs, "V4SiV8SsV8SsV4Si", "") BUILTIN(__builtin_altivec_vmuleub, "V8UsV16UcV16Uc", "") BUILTIN(__builtin_altivec_vmulesb, "V8SsV16ScV16Sc", "") BUILTIN(__builtin_altivec_vmuleuh, "V4UiV8UsV8Us", "") BUILTIN(__builtin_altivec_vmulesh, "V4SiV8SsV8Ss", "") BUILTIN(__builtin_altivec_vmuleuw, "V2ULLiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vmulesw, "V2SLLiV4SiV4Si", "") BUILTIN(__builtin_altivec_vmuloub, "V8UsV16UcV16Uc", "") BUILTIN(__builtin_altivec_vmulosb, "V8SsV16ScV16Sc", "") BUILTIN(__builtin_altivec_vmulouh, "V4UiV8UsV8Us", "") BUILTIN(__builtin_altivec_vmulosh, "V4SiV8SsV8Ss", "") BUILTIN(__builtin_altivec_vmulouw, "V2ULLiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vmulosw, "V2SLLiV4SiV4Si", "") BUILTIN(__builtin_altivec_vnmsubfp, "V4fV4fV4fV4f", "") BUILTIN(__builtin_altivec_vpkpx, "V8sV4UiV4Ui", "") BUILTIN(__builtin_altivec_vpkuhus, "V16UcV8UsV8Us", "") BUILTIN(__builtin_altivec_vpkshss, "V16ScV8SsV8Ss", "") BUILTIN(__builtin_altivec_vpkuwus, "V8UsV4UiV4Ui", "") BUILTIN(__builtin_altivec_vpkswss, "V8SsV4SiV4Si", "") BUILTIN(__builtin_altivec_vpkshus, "V16UcV8SsV8Ss", "") BUILTIN(__builtin_altivec_vpkswus, "V8UsV4SiV4Si", "") BUILTIN(__builtin_altivec_vpksdss, "V4SiV2SLLiV2SLLi", "") BUILTIN(__builtin_altivec_vpksdus, "V4UiV2SLLiV2SLLi", "") BUILTIN(__builtin_altivec_vpkudus, "V4UiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_vpkudum, "V4UiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_vperm_4si, "V4iV4iV4iV16Uc", "") BUILTIN(__builtin_altivec_stvx, "vV4iiv*", "") BUILTIN(__builtin_altivec_stvxl, "vV4iiv*", "") BUILTIN(__builtin_altivec_stvebx, "vV16civ*", "") BUILTIN(__builtin_altivec_stvehx, "vV8siv*", "") BUILTIN(__builtin_altivec_stvewx, "vV4iiv*", "") BUILTIN(__builtin_altivec_vcmpbfp, "V4iV4fV4f", "") BUILTIN(__builtin_altivec_vcmpgefp, "V4iV4fV4f", "") BUILTIN(__builtin_altivec_vcmpequb, "V16cV16cV16c", "") BUILTIN(__builtin_altivec_vcmpequh, "V8sV8sV8s", "") BUILTIN(__builtin_altivec_vcmpequw, "V4iV4iV4i", "") BUILTIN(__builtin_altivec_vcmpequd, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_altivec_vcmpeqfp, "V4iV4fV4f", "") BUILTIN(__builtin_altivec_vcmpgtsb, "V16cV16ScV16Sc", "") BUILTIN(__builtin_altivec_vcmpgtub, "V16cV16UcV16Uc", "") BUILTIN(__builtin_altivec_vcmpgtsh, "V8sV8SsV8Ss", "") BUILTIN(__builtin_altivec_vcmpgtuh, "V8sV8UsV8Us", "") BUILTIN(__builtin_altivec_vcmpgtsw, "V4iV4SiV4Si", "") BUILTIN(__builtin_altivec_vcmpgtuw, "V4iV4UiV4Ui", "") BUILTIN(__builtin_altivec_vcmpgtsd, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_altivec_vcmpgtud, "V2LLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_vcmpgtfp, "V4iV4fV4f", "") BUILTIN(__builtin_altivec_vmaxsb, "V16ScV16ScV16Sc", "") BUILTIN(__builtin_altivec_vmaxub, "V16UcV16UcV16Uc", "") BUILTIN(__builtin_altivec_vmaxsh, "V8SsV8SsV8Ss", "") BUILTIN(__builtin_altivec_vmaxuh, "V8UsV8UsV8Us", "") BUILTIN(__builtin_altivec_vmaxsw, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vmaxuw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vmaxsd, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_altivec_vmaxud, "V2ULLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_vmaxfp, "V4fV4fV4f", "") BUILTIN(__builtin_altivec_mfvscr, "V8Us", "") BUILTIN(__builtin_altivec_vminsb, "V16ScV16ScV16Sc", "") BUILTIN(__builtin_altivec_vminub, "V16UcV16UcV16Uc", "") BUILTIN(__builtin_altivec_vminsh, "V8SsV8SsV8Ss", "") BUILTIN(__builtin_altivec_vminuh, "V8UsV8UsV8Us", "") BUILTIN(__builtin_altivec_vminsw, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vminuw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vminsd, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_altivec_vminud, "V2ULLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_vminfp, "V4fV4fV4f", "") BUILTIN(__builtin_altivec_mtvscr, "vV4i", "") BUILTIN(__builtin_altivec_vrefp, "V4fV4f", "") BUILTIN(__builtin_altivec_vrlb, "V16cV16cV16Uc", "") BUILTIN(__builtin_altivec_vrlh, "V8sV8sV8Us", "") BUILTIN(__builtin_altivec_vrlw, "V4iV4iV4Ui", "") BUILTIN(__builtin_altivec_vrld, "V2LLiV2LLiV2ULLi", "") BUILTIN(__builtin_altivec_vsel_4si, "V4iV4iV4iV4Ui", "") BUILTIN(__builtin_altivec_vsl, "V4iV4iV4i", "") BUILTIN(__builtin_altivec_vslo, "V4iV4iV4i", "") BUILTIN(__builtin_altivec_vsrab, "V16cV16cV16Uc", "") BUILTIN(__builtin_altivec_vsrah, "V8sV8sV8Us", "") BUILTIN(__builtin_altivec_vsraw, "V4iV4iV4Ui", "") BUILTIN(__builtin_altivec_vsr, "V4iV4iV4i", "") BUILTIN(__builtin_altivec_vsro, "V4iV4iV4i", "") BUILTIN(__builtin_altivec_vrfin, "V4fV4f", "") BUILTIN(__builtin_altivec_vrsqrtefp, "V4fV4f", "") BUILTIN(__builtin_altivec_vsubcuw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vsum4sbs, "V4SiV16ScV4Si", "") BUILTIN(__builtin_altivec_vsum4ubs, "V4UiV16UcV4Ui", "") BUILTIN(__builtin_altivec_vsum4shs, "V4SiV8SsV4Si", "") BUILTIN(__builtin_altivec_vsum2sws, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vsumsws, "V4SiV4SiV4Si", "") BUILTIN(__builtin_altivec_vrfiz, "V4fV4f", "") BUILTIN(__builtin_altivec_vupkhsb, "V8sV16c", "") BUILTIN(__builtin_altivec_vupkhpx, "V4UiV8s", "") BUILTIN(__builtin_altivec_vupkhsh, "V4iV8s", "") BUILTIN(__builtin_altivec_vupkhsw, "V2LLiV4i", "") BUILTIN(__builtin_altivec_vupklsb, "V8sV16c", "") BUILTIN(__builtin_altivec_vupklpx, "V4UiV8s", "") BUILTIN(__builtin_altivec_vupklsh, "V4iV8s", "") BUILTIN(__builtin_altivec_vupklsw, "V2LLiV4i", "") BUILTIN(__builtin_altivec_vcmpbfp_p, "iiV4fV4f", "") BUILTIN(__builtin_altivec_vcmpgefp_p, "iiV4fV4f", "") BUILTIN(__builtin_altivec_vcmpequb_p, "iiV16cV16c", "") BUILTIN(__builtin_altivec_vcmpequh_p, "iiV8sV8s", "") BUILTIN(__builtin_altivec_vcmpequw_p, "iiV4iV4i", "") BUILTIN(__builtin_altivec_vcmpequd_p, "iiV2LLiV2LLi", "") BUILTIN(__builtin_altivec_vcmpeqfp_p, "iiV4fV4f", "") BUILTIN(__builtin_altivec_vcmpgtsb_p, "iiV16ScV16Sc", "") BUILTIN(__builtin_altivec_vcmpgtub_p, "iiV16UcV16Uc", "") BUILTIN(__builtin_altivec_vcmpgtsh_p, "iiV8SsV8Ss", "") BUILTIN(__builtin_altivec_vcmpgtuh_p, "iiV8UsV8Us", "") BUILTIN(__builtin_altivec_vcmpgtsw_p, "iiV4SiV4Si", "") BUILTIN(__builtin_altivec_vcmpgtuw_p, "iiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vcmpgtsd_p, "iiV2LLiV2LLi", "") BUILTIN(__builtin_altivec_vcmpgtud_p, "iiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_vcmpgtfp_p, "iiV4fV4f", "") BUILTIN(__builtin_altivec_vgbbd, "V16UcV16Uc", "") BUILTIN(__builtin_altivec_vbpermq, "V2ULLiV16UcV16Uc", "") // P8 Crypto built-ins. BUILTIN(__builtin_altivec_crypto_vsbox, "V2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_crypto_vpermxor, "V16UcV16UcV16UcV16Uc", "") BUILTIN(__builtin_altivec_crypto_vshasigmaw, "V4UiV4UiIiIi", "") BUILTIN(__builtin_altivec_crypto_vshasigmad, "V2ULLiV2ULLiIiIi", "") BUILTIN(__builtin_altivec_crypto_vcipher, "V2ULLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_crypto_vcipherlast, "V2ULLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_crypto_vncipher, "V2ULLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_crypto_vncipherlast, "V2ULLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_crypto_vpmsumb, "V16UcV16UcV16Uc", "") BUILTIN(__builtin_altivec_crypto_vpmsumh, "V8UsV8UsV8Us", "") BUILTIN(__builtin_altivec_crypto_vpmsumw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_crypto_vpmsumd, "V2ULLiV2ULLiV2ULLi", "") BUILTIN(__builtin_altivec_vclzb, "V16UcV16Uc", "") BUILTIN(__builtin_altivec_vclzh, "V8UsV8Us", "") BUILTIN(__builtin_altivec_vclzw, "V4UiV4Ui", "") BUILTIN(__builtin_altivec_vclzd, "V2ULLiV2ULLi", "") // VSX built-ins. BUILTIN(__builtin_vsx_lxvd2x, "V2divC*", "") BUILTIN(__builtin_vsx_lxvw4x, "V4iivC*", "") BUILTIN(__builtin_vsx_stxvd2x, "vV2div*", "") BUILTIN(__builtin_vsx_stxvw4x, "vV4iiv*", "") BUILTIN(__builtin_vsx_xvmaxdp, "V2dV2dV2d", "") BUILTIN(__builtin_vsx_xvmaxsp, "V4fV4fV4f", "") BUILTIN(__builtin_vsx_xsmaxdp, "ddd", "") BUILTIN(__builtin_vsx_xvmindp, "V2dV2dV2d", "") BUILTIN(__builtin_vsx_xvminsp, "V4fV4fV4f", "") BUILTIN(__builtin_vsx_xsmindp, "ddd", "") BUILTIN(__builtin_vsx_xvdivdp, "V2dV2dV2d", "") BUILTIN(__builtin_vsx_xvdivsp, "V4fV4fV4f", "") BUILTIN(__builtin_vsx_xvrdpip, "V2dV2d", "") BUILTIN(__builtin_vsx_xvrspip, "V4fV4f", "") BUILTIN(__builtin_vsx_xvcmpeqdp, "V2ULLiV2dV2d", "") BUILTIN(__builtin_vsx_xvcmpeqsp, "V4UiV4fV4f", "") BUILTIN(__builtin_vsx_xvcmpgedp, "V2ULLiV2dV2d", "") BUILTIN(__builtin_vsx_xvcmpgesp, "V4UiV4fV4f", "") BUILTIN(__builtin_vsx_xvcmpgtdp, "V2ULLiV2dV2d", "") BUILTIN(__builtin_vsx_xvcmpgtsp, "V4UiV4fV4f", "") BUILTIN(__builtin_vsx_xvrdpim, "V2dV2d", "") BUILTIN(__builtin_vsx_xvrspim, "V4fV4f", "") BUILTIN(__builtin_vsx_xvrdpi, "V2dV2d", "") BUILTIN(__builtin_vsx_xvrspi, "V4fV4f", "") BUILTIN(__builtin_vsx_xvrdpic, "V2dV2d", "") BUILTIN(__builtin_vsx_xvrspic, "V4fV4f", "") BUILTIN(__builtin_vsx_xvrdpiz, "V2dV2d", "") BUILTIN(__builtin_vsx_xvrspiz, "V4fV4f", "") BUILTIN(__builtin_vsx_xvmaddadp, "V2dV2dV2dV2d", "") BUILTIN(__builtin_vsx_xvmaddasp, "V4fV4fV4fV4f", "") BUILTIN(__builtin_vsx_xvmsubadp, "V2dV2dV2dV2d", "") BUILTIN(__builtin_vsx_xvmsubasp, "V4fV4fV4fV4f", "") BUILTIN(__builtin_vsx_xvmuldp, "V2dV2dV2d", "") BUILTIN(__builtin_vsx_xvmulsp, "V4fV4fV4f", "") BUILTIN(__builtin_vsx_xvnmaddadp, "V2dV2dV2dV2d", "") BUILTIN(__builtin_vsx_xvnmaddasp, "V4fV4fV4fV4f", "") BUILTIN(__builtin_vsx_xvnmsubadp, "V2dV2dV2dV2d", "") BUILTIN(__builtin_vsx_xvnmsubasp, "V4fV4fV4fV4f", "") BUILTIN(__builtin_vsx_xvredp, "V2dV2d", "") BUILTIN(__builtin_vsx_xvresp, "V4fV4f", "") BUILTIN(__builtin_vsx_xvrsqrtedp, "V2dV2d", "") BUILTIN(__builtin_vsx_xvrsqrtesp, "V4fV4f", "") BUILTIN(__builtin_vsx_xvsqrtdp, "V2dV2d", "") BUILTIN(__builtin_vsx_xvsqrtsp, "V4fV4f", "") BUILTIN(__builtin_vsx_xxleqv, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_vsx_xvcpsgndp, "V2dV2dV2d", "") BUILTIN(__builtin_vsx_xvcpsgnsp, "V4fV4fV4f", "") // HTM builtins BUILTIN(__builtin_tbegin, "UiUIi", "") BUILTIN(__builtin_tend, "UiUIi", "") BUILTIN(__builtin_tabort, "UiUi", "") BUILTIN(__builtin_tabortdc, "UiUiUiUi", "") BUILTIN(__builtin_tabortdci, "UiUiUii", "") BUILTIN(__builtin_tabortwc, "UiUiUiUi", "") BUILTIN(__builtin_tabortwci, "UiUiUii", "") BUILTIN(__builtin_tcheck, "Ui", "") BUILTIN(__builtin_treclaim, "UiUi", "") BUILTIN(__builtin_trechkpt, "Ui", "") BUILTIN(__builtin_tsr, "UiUi", "") BUILTIN(__builtin_tendall, "Ui", "") BUILTIN(__builtin_tresume, "Ui", "") BUILTIN(__builtin_tsuspend, "Ui", "") BUILTIN(__builtin_get_texasr, "LUi", "c") BUILTIN(__builtin_get_texasru, "LUi", "c") BUILTIN(__builtin_get_tfhar, "LUi", "c") BUILTIN(__builtin_get_tfiar, "LUi", "c") BUILTIN(__builtin_set_texasr, "vLUi", "c") BUILTIN(__builtin_set_texasru, "vLUi", "c") BUILTIN(__builtin_set_tfhar, "vLUi", "c") BUILTIN(__builtin_set_tfiar, "vLUi", "c") BUILTIN(__builtin_ttest, "LUi", "") // Scalar built-ins BUILTIN(__builtin_divwe, "SiSiSi", "") BUILTIN(__builtin_divweu, "UiUiUi", "") BUILTIN(__builtin_divde, "SLLiSLLiSLLi", "") BUILTIN(__builtin_divdeu, "ULLiULLiULLi", "") BUILTIN(__builtin_bpermd, "SLLiSLLiSLLi", "") // FIXME: Obviously incomplete. #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/FileSystemStatCache.h
//===--- FileSystemStatCache.h - Caching for 'stat' calls -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the FileSystemStatCache interface. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_FILESYSTEMSTATCACHE_H #define LLVM_CLANG_BASIC_FILESYSTEMSTATCACHE_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/FileSystem.h" #include <memory> namespace clang { namespace vfs { class File; class FileSystem; } // FIXME: should probably replace this with vfs::Status struct FileData { std::string Name; uint64_t Size; time_t ModTime; llvm::sys::fs::UniqueID UniqueID; bool IsDirectory; bool IsNamedPipe; bool InPCH; bool IsVFSMapped; // FIXME: remove this when files support multiple names FileData() : Size(0), ModTime(0), IsDirectory(false), IsNamedPipe(false), InPCH(false), IsVFSMapped(false) {} }; /// \brief Abstract interface for introducing a FileManager cache for 'stat' /// system calls, which is used by precompiled and pretokenized headers to /// improve performance. class FileSystemStatCache { virtual void anchor(); protected: std::unique_ptr<FileSystemStatCache> NextStatCache; public: virtual ~FileSystemStatCache() {} enum LookupResult { CacheExists, ///< We know the file exists and its cached stat data. CacheMissing ///< We know that the file doesn't exist. }; /// \brief Get the 'stat' information for the specified path, using the cache /// to accelerate it if possible. /// /// \returns \c true if the path does not exist or \c false if it exists. /// /// If isFile is true, then this lookup should only return success for files /// (not directories). If it is false this lookup should only return /// success for directories (not files). On a successful file lookup, the /// implementation can optionally fill in \p F with a valid \p File object and /// the client guarantees that it will close it. static bool get(const char *Path, FileData &Data, bool isFile, std::unique_ptr<vfs::File> *F, FileSystemStatCache *Cache, vfs::FileSystem &FS); /// \brief Sets the next stat call cache in the chain of stat caches. /// Takes ownership of the given stat cache. void setNextStatCache(std::unique_ptr<FileSystemStatCache> Cache) { NextStatCache = std::move(Cache); } /// \brief Retrieve the next stat call cache in the chain. FileSystemStatCache *getNextStatCache() { return NextStatCache.get(); } /// \brief Retrieve the next stat call cache in the chain, transferring /// ownership of this cache (and, transitively, all of the remaining caches) /// to the caller. std::unique_ptr<FileSystemStatCache> takeNextStatCache() { return std::move(NextStatCache); } protected: // FIXME: The pointer here is a non-owning/optional reference to the // unique_ptr. Optional<unique_ptr<vfs::File>&> might be nicer, but // Optional needs some work to support references so this isn't possible yet. virtual LookupResult getStat(const char *Path, FileData &Data, bool isFile, std::unique_ptr<vfs::File> *F, vfs::FileSystem &FS) = 0; LookupResult statChained(const char *Path, FileData &Data, bool isFile, std::unique_ptr<vfs::File> *F, vfs::FileSystem &FS) { if (FileSystemStatCache *Next = getNextStatCache()) return Next->getStat(Path, Data, isFile, F, FS); // If we hit the end of the list of stat caches to try, just compute and // return it without a cache. return get(Path, Data, isFile, F, nullptr, FS) ? CacheMissing : CacheExists; } }; /// \brief A stat "cache" that can be used by FileManager to keep /// track of the results of stat() calls that occur throughout the /// execution of the front end. class MemorizeStatCalls : public FileSystemStatCache { public: /// \brief The set of stat() calls that have been seen. llvm::StringMap<FileData, llvm::BumpPtrAllocator> StatCalls; typedef llvm::StringMap<FileData, llvm::BumpPtrAllocator>::const_iterator iterator; iterator begin() const { return StatCalls.begin(); } iterator end() const { return StatCalls.end(); } LookupResult getStat(const char *Path, FileData &Data, bool isFile, std::unique_ptr<vfs::File> *F, vfs::FileSystem &FS) override; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TargetOptions.h
//===--- TargetOptions.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::TargetOptions class. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TARGETOPTIONS_H #define LLVM_CLANG_BASIC_TARGETOPTIONS_H #include <string> #include <vector> namespace clang { /// \brief Options for controlling the target. class TargetOptions { public: /// If given, the name of the target triple to compile for. If not given the /// target will be selected to match the host. std::string Triple; /// If given, the name of the target CPU to generate code for. std::string CPU; /// If given, the unit to use for floating point math. std::string FPMath; /// If given, the name of the target ABI to use. std::string ABI; /// If given, the version string of the linker in use. std::string LinkerVersion; /// \brief The list of target specific features to enable or disable, as written on the command line. std::vector<std::string> FeaturesAsWritten; /// The list of target specific features to enable or disable -- this should /// be a list of strings starting with by '+' or '-'. std::vector<std::string> Features; std::vector<std::string> Reciprocals; // HLSL Change: Target layout can change by min precision option const char *DescriptionString; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/OperatorKinds.h
//===--- OperatorKinds.h - C++ Overloaded Operators -------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines an enumeration for C++ overloaded operators. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_OPERATORKINDS_H #define LLVM_CLANG_BASIC_OPERATORKINDS_H namespace clang { /// \brief Enumeration specifying the different kinds of C++ overloaded /// operators. enum OverloadedOperatorKind : int { OO_None, ///< Not an overloaded operator #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \ OO_##Name, #include "clang/Basic/OperatorKinds.def" NUM_OVERLOADED_OPERATORS }; /// \brief Retrieve the spelling of the given overloaded operator, without /// the preceding "operator" keyword. const char *getOperatorSpelling(OverloadedOperatorKind Operator); } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsAMDGPU.def
//==- BuiltinsAMDGPU.def - AMDGPU Builtin function database ------*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the R600-specific builtin function database. Users of this // file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// BUILTIN(__builtin_amdgpu_div_scale, "dddbb*", "n") BUILTIN(__builtin_amdgpu_div_scalef, "fffbb*", "n") BUILTIN(__builtin_amdgpu_div_fmas, "ddddb", "nc") BUILTIN(__builtin_amdgpu_div_fmasf, "ffffb", "nc") BUILTIN(__builtin_amdgpu_div_fixup, "dddd", "nc") BUILTIN(__builtin_amdgpu_div_fixupf, "ffff", "nc") BUILTIN(__builtin_amdgpu_trig_preop, "ddi", "nc") BUILTIN(__builtin_amdgpu_trig_preopf, "ffi", "nc") BUILTIN(__builtin_amdgpu_rcp, "dd", "nc") BUILTIN(__builtin_amdgpu_rcpf, "ff", "nc") BUILTIN(__builtin_amdgpu_rsq, "dd", "nc") BUILTIN(__builtin_amdgpu_rsqf, "ff", "nc") BUILTIN(__builtin_amdgpu_rsq_clamped, "dd", "nc") BUILTIN(__builtin_amdgpu_rsq_clampedf, "ff", "nc") BUILTIN(__builtin_amdgpu_ldexp, "ddi", "nc") BUILTIN(__builtin_amdgpu_ldexpf, "ffi", "nc") BUILTIN(__builtin_amdgpu_class, "bdi", "nc") BUILTIN(__builtin_amdgpu_classf, "bfi", "nc") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Builtins.def
//===--- Builtins.def - Builtin function info database ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the standard builtin function database. Users of this file // must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // The first value provided to the macro specifies the function name of the // builtin, and results in a clang::builtin::BIXX enum value for XX. // The second value provided to the macro specifies the type of the function // (result value, then each argument) as follows: // v -> void // b -> boolean // c -> char // s -> short // i -> int // h -> half // f -> float // d -> double // z -> size_t // F -> constant CFString // G -> id // H -> SEL // M -> struct objc_super // a -> __builtin_va_list // A -> "reference" to __builtin_va_list // V -> Vector, followed by the number of elements and the base type. // E -> ext_vector, followed by the number of elements and the base type. // X -> _Complex, followed by the base type. // Y -> ptrdiff_t // P -> FILE // J -> jmp_buf // SJ -> sigjmp_buf // K -> ucontext_t // p -> pid_t // . -> "...". This may only occur at the end of the function list. // // Types may be prefixed with the following modifiers: // L -> long (e.g. Li for 'long int') // LL -> long long // LLL -> __int128_t (e.g. LLLi) // W -> int64_t // S -> signed // U -> unsigned // I -> Required to constant fold to an integer constant expression. // // Types may be postfixed with the following modifiers: // * -> pointer (optionally followed by an address space number, if no address // space is specified than any address space will be accepted) // & -> reference (optionally followed by an address space number) // C -> const // D -> volatile // The third value provided to the macro specifies information about attributes // of the function. These must be kept in sync with the predicates in the // Builtin::Context class. Currently we have: // n -> nothrow // r -> noreturn // c -> const // t -> signature is meaningless, use custom typechecking // F -> this is a libc/libm function with a '__builtin_' prefix added. // f -> this is a libc/libm function without the '__builtin_' prefix. It can // be followed by ':headername:' to state which header this function // comes from. // i -> this is a runtime library implemented function without the // '__builtin_' prefix. It will be implemented in compiler-rt or libgcc. // p:N: -> this is a printf-like function whose Nth argument is the format // string. // P:N: -> similar to the p:N: attribute, but the function is like vprintf // in that it accepts its arguments as a va_list rather than // through an ellipsis // s:N: -> this is a scanf-like function whose Nth argument is the format // string. // S:N: -> similar to the s:N: attribute, but the function is like vscanf // in that it accepts its arguments as a va_list rather than // through an ellipsis // e -> const, but only when -fmath-errno=0 // j -> returns_twice (like setjmp) // u -> arguments are not evaluated for their side-effects // FIXME: gcc has nonnull #if defined(BUILTIN) && !defined(LIBBUILTIN) # define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) #endif #if defined(BUILTIN) && !defined(LANGBUILTIN) # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) #endif // Standard libc/libm functions: BUILTIN(__builtin_atan2 , "ddd" , "Fnc") BUILTIN(__builtin_atan2f, "fff" , "Fnc") BUILTIN(__builtin_atan2l, "LdLdLd", "Fnc") BUILTIN(__builtin_abs , "ii" , "ncF") BUILTIN(__builtin_copysign, "ddd", "ncF") BUILTIN(__builtin_copysignf, "fff", "ncF") BUILTIN(__builtin_copysignl, "LdLdLd", "ncF") BUILTIN(__builtin_fabs , "dd" , "ncF") BUILTIN(__builtin_fabsf, "ff" , "ncF") BUILTIN(__builtin_fabsl, "LdLd", "ncF") BUILTIN(__builtin_fmod , "ddd" , "Fnc") BUILTIN(__builtin_fmodf, "fff" , "Fnc") BUILTIN(__builtin_fmodl, "LdLdLd", "Fnc") BUILTIN(__builtin_frexp , "ddi*" , "Fn") BUILTIN(__builtin_frexpf, "ffi*" , "Fn") BUILTIN(__builtin_frexpl, "LdLdi*", "Fn") BUILTIN(__builtin_huge_val, "d", "nc") BUILTIN(__builtin_huge_valf, "f", "nc") BUILTIN(__builtin_huge_vall, "Ld", "nc") BUILTIN(__builtin_inf , "d" , "nc") BUILTIN(__builtin_inff , "f" , "nc") BUILTIN(__builtin_infl , "Ld" , "nc") BUILTIN(__builtin_labs , "LiLi" , "Fnc") BUILTIN(__builtin_llabs, "LLiLLi", "Fnc") BUILTIN(__builtin_ldexp , "ddi" , "Fnc") BUILTIN(__builtin_ldexpf, "ffi" , "Fnc") BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc") BUILTIN(__builtin_modf , "ddd*" , "Fn") BUILTIN(__builtin_modff, "fff*" , "Fn") BUILTIN(__builtin_modfl, "LdLdLd*", "Fn") BUILTIN(__builtin_nan, "dcC*" , "ncF") BUILTIN(__builtin_nanf, "fcC*" , "ncF") BUILTIN(__builtin_nanl, "LdcC*", "ncF") BUILTIN(__builtin_nans, "dcC*" , "ncF") BUILTIN(__builtin_nansf, "fcC*" , "ncF") BUILTIN(__builtin_nansl, "LdcC*", "ncF") BUILTIN(__builtin_powi , "ddi" , "Fnc") BUILTIN(__builtin_powif, "ffi" , "Fnc") BUILTIN(__builtin_powil, "LdLdi", "Fnc") BUILTIN(__builtin_pow , "ddd" , "Fnc") BUILTIN(__builtin_powf, "fff" , "Fnc") BUILTIN(__builtin_powl, "LdLdLd", "Fnc") // Standard unary libc/libm functions with double/float/long double variants: BUILTIN(__builtin_acos , "dd" , "Fnc") BUILTIN(__builtin_acosf, "ff" , "Fnc") BUILTIN(__builtin_acosl, "LdLd", "Fnc") BUILTIN(__builtin_acosh , "dd" , "Fnc") BUILTIN(__builtin_acoshf, "ff" , "Fnc") BUILTIN(__builtin_acoshl, "LdLd", "Fnc") BUILTIN(__builtin_asin , "dd" , "Fnc") BUILTIN(__builtin_asinf, "ff" , "Fnc") BUILTIN(__builtin_asinl, "LdLd", "Fnc") BUILTIN(__builtin_asinh , "dd" , "Fnc") BUILTIN(__builtin_asinhf, "ff" , "Fnc") BUILTIN(__builtin_asinhl, "LdLd", "Fnc") BUILTIN(__builtin_atan , "dd" , "Fnc") BUILTIN(__builtin_atanf, "ff" , "Fnc") BUILTIN(__builtin_atanl, "LdLd", "Fnc") BUILTIN(__builtin_atanh , "dd", "Fnc") BUILTIN(__builtin_atanhf, "ff", "Fnc") BUILTIN(__builtin_atanhl, "LdLd", "Fnc") BUILTIN(__builtin_cbrt , "dd", "Fnc") BUILTIN(__builtin_cbrtf, "ff", "Fnc") BUILTIN(__builtin_cbrtl, "LdLd", "Fnc") BUILTIN(__builtin_ceil , "dd" , "Fnc") BUILTIN(__builtin_ceilf, "ff" , "Fnc") BUILTIN(__builtin_ceill, "LdLd", "Fnc") BUILTIN(__builtin_cos , "dd" , "Fnc") BUILTIN(__builtin_cosf, "ff" , "Fnc") BUILTIN(__builtin_cosh , "dd" , "Fnc") BUILTIN(__builtin_coshf, "ff" , "Fnc") BUILTIN(__builtin_coshl, "LdLd", "Fnc") BUILTIN(__builtin_cosl, "LdLd", "Fnc") BUILTIN(__builtin_erf , "dd", "Fnc") BUILTIN(__builtin_erff, "ff", "Fnc") BUILTIN(__builtin_erfl, "LdLd", "Fnc") BUILTIN(__builtin_erfc , "dd", "Fnc") BUILTIN(__builtin_erfcf, "ff", "Fnc") BUILTIN(__builtin_erfcl, "LdLd", "Fnc") BUILTIN(__builtin_exp , "dd" , "Fnc") BUILTIN(__builtin_expf, "ff" , "Fnc") BUILTIN(__builtin_expl, "LdLd", "Fnc") BUILTIN(__builtin_exp2 , "dd" , "Fnc") BUILTIN(__builtin_exp2f, "ff" , "Fnc") BUILTIN(__builtin_exp2l, "LdLd", "Fnc") BUILTIN(__builtin_expm1 , "dd", "Fnc") BUILTIN(__builtin_expm1f, "ff", "Fnc") BUILTIN(__builtin_expm1l, "LdLd", "Fnc") BUILTIN(__builtin_fdim, "ddd", "Fnc") BUILTIN(__builtin_fdimf, "fff", "Fnc") BUILTIN(__builtin_fdiml, "LdLdLd", "Fnc") BUILTIN(__builtin_floor , "dd" , "Fnc") BUILTIN(__builtin_floorf, "ff" , "Fnc") BUILTIN(__builtin_floorl, "LdLd", "Fnc") BUILTIN(__builtin_fma, "dddd", "Fnc") BUILTIN(__builtin_fmaf, "ffff", "Fnc") BUILTIN(__builtin_fmal, "LdLdLdLd", "Fnc") BUILTIN(__builtin_fmax, "ddd", "Fnc") BUILTIN(__builtin_fmaxf, "fff", "Fnc") BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc") BUILTIN(__builtin_fmin, "ddd", "Fnc") BUILTIN(__builtin_fminf, "fff", "Fnc") BUILTIN(__builtin_fminl, "LdLdLd", "Fnc") BUILTIN(__builtin_hypot , "ddd" , "Fnc") BUILTIN(__builtin_hypotf, "fff" , "Fnc") BUILTIN(__builtin_hypotl, "LdLdLd", "Fnc") BUILTIN(__builtin_ilogb , "id", "Fnc") BUILTIN(__builtin_ilogbf, "if", "Fnc") BUILTIN(__builtin_ilogbl, "iLd", "Fnc") BUILTIN(__builtin_lgamma , "dd", "Fnc") BUILTIN(__builtin_lgammaf, "ff", "Fnc") BUILTIN(__builtin_lgammal, "LdLd", "Fnc") BUILTIN(__builtin_llrint, "LLid", "Fnc") BUILTIN(__builtin_llrintf, "LLif", "Fnc") BUILTIN(__builtin_llrintl, "LLiLd", "Fnc") BUILTIN(__builtin_llround , "LLid", "Fnc") BUILTIN(__builtin_llroundf, "LLif", "Fnc") BUILTIN(__builtin_llroundl, "LLiLd", "Fnc") BUILTIN(__builtin_log , "dd" , "Fnc") BUILTIN(__builtin_log10 , "dd" , "Fnc") BUILTIN(__builtin_log10f, "ff" , "Fnc") BUILTIN(__builtin_log10l, "LdLd", "Fnc") BUILTIN(__builtin_log1p , "dd" , "Fnc") BUILTIN(__builtin_log1pf, "ff" , "Fnc") BUILTIN(__builtin_log1pl, "LdLd", "Fnc") BUILTIN(__builtin_log2, "dd" , "Fnc") BUILTIN(__builtin_log2f, "ff" , "Fnc") BUILTIN(__builtin_log2l, "LdLd" , "Fnc") BUILTIN(__builtin_logb , "dd", "Fnc") BUILTIN(__builtin_logbf, "ff", "Fnc") BUILTIN(__builtin_logbl, "LdLd", "Fnc") BUILTIN(__builtin_logf, "ff" , "Fnc") BUILTIN(__builtin_logl, "LdLd", "Fnc") BUILTIN(__builtin_lrint , "Lid", "Fnc") BUILTIN(__builtin_lrintf, "Lif", "Fnc") BUILTIN(__builtin_lrintl, "LiLd", "Fnc") BUILTIN(__builtin_lround , "Lid", "Fnc") BUILTIN(__builtin_lroundf, "Lif", "Fnc") BUILTIN(__builtin_lroundl, "LiLd", "Fnc") BUILTIN(__builtin_nearbyint , "dd", "Fnc") BUILTIN(__builtin_nearbyintf, "ff", "Fnc") BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc") BUILTIN(__builtin_nextafter , "ddd", "Fnc") BUILTIN(__builtin_nextafterf, "fff", "Fnc") BUILTIN(__builtin_nextafterl, "LdLdLd", "Fnc") BUILTIN(__builtin_nexttoward , "ddLd", "Fnc") BUILTIN(__builtin_nexttowardf, "ffLd", "Fnc") BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fnc") BUILTIN(__builtin_remainder , "ddd", "Fnc") BUILTIN(__builtin_remainderf, "fff", "Fnc") BUILTIN(__builtin_remainderl, "LdLdLd", "Fnc") BUILTIN(__builtin_remquo , "dddi*", "Fn") BUILTIN(__builtin_remquof, "fffi*", "Fn") BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn") BUILTIN(__builtin_rint , "dd", "Fnc") BUILTIN(__builtin_rintf, "ff", "Fnc") BUILTIN(__builtin_rintl, "LdLd", "Fnc") BUILTIN(__builtin_round, "dd" , "Fnc") BUILTIN(__builtin_roundf, "ff" , "Fnc") BUILTIN(__builtin_roundl, "LdLd" , "Fnc") BUILTIN(__builtin_scalbln , "ddLi", "Fnc") BUILTIN(__builtin_scalblnf, "ffLi", "Fnc") BUILTIN(__builtin_scalblnl, "LdLdLi", "Fnc") BUILTIN(__builtin_scalbn , "ddi", "Fnc") BUILTIN(__builtin_scalbnf, "ffi", "Fnc") BUILTIN(__builtin_scalbnl, "LdLdi", "Fnc") BUILTIN(__builtin_sin , "dd" , "Fnc") BUILTIN(__builtin_sinf, "ff" , "Fnc") BUILTIN(__builtin_sinh , "dd" , "Fnc") BUILTIN(__builtin_sinhf, "ff" , "Fnc") BUILTIN(__builtin_sinhl, "LdLd", "Fnc") BUILTIN(__builtin_sinl, "LdLd", "Fnc") BUILTIN(__builtin_sqrt , "dd" , "Fnc") BUILTIN(__builtin_sqrtf, "ff" , "Fnc") BUILTIN(__builtin_sqrtl, "LdLd", "Fnc") BUILTIN(__builtin_tan , "dd" , "Fnc") BUILTIN(__builtin_tanf, "ff" , "Fnc") BUILTIN(__builtin_tanh , "dd" , "Fnc") BUILTIN(__builtin_tanhf, "ff" , "Fnc") BUILTIN(__builtin_tanhl, "LdLd", "Fnc") BUILTIN(__builtin_tanl, "LdLd", "Fnc") BUILTIN(__builtin_tgamma , "dd", "Fnc") BUILTIN(__builtin_tgammaf, "ff", "Fnc") BUILTIN(__builtin_tgammal, "LdLd", "Fnc") BUILTIN(__builtin_trunc , "dd", "Fnc") BUILTIN(__builtin_truncf, "ff", "Fnc") BUILTIN(__builtin_truncl, "LdLd", "Fnc") // C99 complex builtins BUILTIN(__builtin_cabs, "dXd", "Fnc") BUILTIN(__builtin_cabsf, "fXf", "Fnc") BUILTIN(__builtin_cabsl, "LdXLd", "Fnc") BUILTIN(__builtin_cacos, "XdXd", "Fnc") BUILTIN(__builtin_cacosf, "XfXf", "Fnc") BUILTIN(__builtin_cacosh, "XdXd", "Fnc") BUILTIN(__builtin_cacoshf, "XfXf", "Fnc") BUILTIN(__builtin_cacoshl, "XLdXLd", "Fnc") BUILTIN(__builtin_cacosl, "XLdXLd", "Fnc") BUILTIN(__builtin_carg, "dXd", "Fnc") BUILTIN(__builtin_cargf, "fXf", "Fnc") BUILTIN(__builtin_cargl, "LdXLd", "Fnc") BUILTIN(__builtin_casin, "XdXd", "Fnc") BUILTIN(__builtin_casinf, "XfXf", "Fnc") BUILTIN(__builtin_casinh, "XdXd", "Fnc") BUILTIN(__builtin_casinhf, "XfXf", "Fnc") BUILTIN(__builtin_casinhl, "XLdXLd", "Fnc") BUILTIN(__builtin_casinl, "XLdXLd", "Fnc") BUILTIN(__builtin_catan, "XdXd", "Fnc") BUILTIN(__builtin_catanf, "XfXf", "Fnc") BUILTIN(__builtin_catanh, "XdXd", "Fnc") BUILTIN(__builtin_catanhf, "XfXf", "Fnc") BUILTIN(__builtin_catanhl, "XLdXLd", "Fnc") BUILTIN(__builtin_catanl, "XLdXLd", "Fnc") BUILTIN(__builtin_ccos, "XdXd", "Fnc") BUILTIN(__builtin_ccosf, "XfXf", "Fnc") BUILTIN(__builtin_ccosl, "XLdXLd", "Fnc") BUILTIN(__builtin_ccosh, "XdXd", "Fnc") BUILTIN(__builtin_ccoshf, "XfXf", "Fnc") BUILTIN(__builtin_ccoshl, "XLdXLd", "Fnc") BUILTIN(__builtin_cexp, "XdXd", "Fnc") BUILTIN(__builtin_cexpf, "XfXf", "Fnc") BUILTIN(__builtin_cexpl, "XLdXLd", "Fnc") BUILTIN(__builtin_cimag, "dXd", "Fnc") BUILTIN(__builtin_cimagf, "fXf", "Fnc") BUILTIN(__builtin_cimagl, "LdXLd", "Fnc") BUILTIN(__builtin_conj, "XdXd", "Fnc") BUILTIN(__builtin_conjf, "XfXf", "Fnc") BUILTIN(__builtin_conjl, "XLdXLd", "Fnc") BUILTIN(__builtin_clog, "XdXd", "Fnc") BUILTIN(__builtin_clogf, "XfXf", "Fnc") BUILTIN(__builtin_clogl, "XLdXLd", "Fnc") BUILTIN(__builtin_cproj, "XdXd", "Fnc") BUILTIN(__builtin_cprojf, "XfXf", "Fnc") BUILTIN(__builtin_cprojl, "XLdXLd", "Fnc") BUILTIN(__builtin_cpow, "XdXdXd", "Fnc") BUILTIN(__builtin_cpowf, "XfXfXf", "Fnc") BUILTIN(__builtin_cpowl, "XLdXLdXLd", "Fnc") BUILTIN(__builtin_creal, "dXd", "Fnc") BUILTIN(__builtin_crealf, "fXf", "Fnc") BUILTIN(__builtin_creall, "LdXLd", "Fnc") BUILTIN(__builtin_csin, "XdXd", "Fnc") BUILTIN(__builtin_csinf, "XfXf", "Fnc") BUILTIN(__builtin_csinl, "XLdXLd", "Fnc") BUILTIN(__builtin_csinh, "XdXd", "Fnc") BUILTIN(__builtin_csinhf, "XfXf", "Fnc") BUILTIN(__builtin_csinhl, "XLdXLd", "Fnc") BUILTIN(__builtin_csqrt, "XdXd", "Fnc") BUILTIN(__builtin_csqrtf, "XfXf", "Fnc") BUILTIN(__builtin_csqrtl, "XLdXLd", "Fnc") BUILTIN(__builtin_ctan, "XdXd", "Fnc") BUILTIN(__builtin_ctanf, "XfXf", "Fnc") BUILTIN(__builtin_ctanl, "XLdXLd", "Fnc") BUILTIN(__builtin_ctanh, "XdXd", "Fnc") BUILTIN(__builtin_ctanhf, "XfXf", "Fnc") BUILTIN(__builtin_ctanhl, "XLdXLd", "Fnc") // FP Comparisons. BUILTIN(__builtin_isgreater , "i.", "nc") BUILTIN(__builtin_isgreaterequal, "i.", "nc") BUILTIN(__builtin_isless , "i.", "nc") BUILTIN(__builtin_islessequal , "i.", "nc") BUILTIN(__builtin_islessgreater , "i.", "nc") BUILTIN(__builtin_isunordered , "i.", "nc") // Unary FP classification BUILTIN(__builtin_fpclassify, "iiiii.", "nc") BUILTIN(__builtin_isfinite, "i.", "nc") BUILTIN(__builtin_isinf, "i.", "nc") BUILTIN(__builtin_isinf_sign, "i.", "nc") BUILTIN(__builtin_isnan, "i.", "nc") BUILTIN(__builtin_isnormal, "i.", "nc") // FP signbit builtins BUILTIN(__builtin_signbit, "id", "nc") BUILTIN(__builtin_signbitf, "if", "nc") BUILTIN(__builtin_signbitl, "iLd", "nc") // Builtins for arithmetic. BUILTIN(__builtin_clzs , "iUs" , "nc") BUILTIN(__builtin_clz , "iUi" , "nc") BUILTIN(__builtin_clzl , "iULi" , "nc") BUILTIN(__builtin_clzll, "iULLi", "nc") // TODO: int clzimax(uintmax_t) BUILTIN(__builtin_ctzs , "iUs" , "nc") BUILTIN(__builtin_ctz , "iUi" , "nc") BUILTIN(__builtin_ctzl , "iULi" , "nc") BUILTIN(__builtin_ctzll, "iULLi", "nc") // TODO: int ctzimax(uintmax_t) BUILTIN(__builtin_ffs , "ii" , "nc") BUILTIN(__builtin_ffsl , "iLi" , "nc") BUILTIN(__builtin_ffsll, "iLLi", "nc") BUILTIN(__builtin_parity , "iUi" , "nc") BUILTIN(__builtin_parityl , "iULi" , "nc") BUILTIN(__builtin_parityll, "iULLi", "nc") BUILTIN(__builtin_popcount , "iUi" , "nc") BUILTIN(__builtin_popcountl , "iULi" , "nc") BUILTIN(__builtin_popcountll, "iULLi", "nc") // FIXME: These type signatures are not correct for targets with int != 32-bits // or with ULL != 64-bits. BUILTIN(__builtin_bswap16, "UsUs", "nc") BUILTIN(__builtin_bswap32, "UiUi", "nc") BUILTIN(__builtin_bswap64, "ULLiULLi", "nc") // Random GCC builtins BUILTIN(__builtin_constant_p, "i.", "nctu") BUILTIN(__builtin_classify_type, "i.", "nctu") BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc") BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc") BUILTIN(__builtin_va_start, "vA.", "nt") BUILTIN(__builtin_va_end, "vA", "n") BUILTIN(__builtin_va_copy, "vAA", "n") BUILTIN(__builtin_stdarg_start, "vA.", "n") BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc") BUILTIN(__builtin_bcmp, "iv*v*z", "n") BUILTIN(__builtin_bcopy, "vv*v*z", "n") BUILTIN(__builtin_bzero, "vv*z", "nF") BUILTIN(__builtin_fprintf, "iP*cC*.", "Fp:1:") BUILTIN(__builtin_memchr, "v*vC*iz", "nF") BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF") BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF") BUILTIN(__builtin_memmove, "v*v*vC*z", "nF") BUILTIN(__builtin_mempcpy, "v*v*vC*z", "nF") BUILTIN(__builtin_memset, "v*v*iz", "nF") BUILTIN(__builtin_printf, "icC*.", "Fp:0:") BUILTIN(__builtin_stpcpy, "c*c*cC*", "nF") BUILTIN(__builtin_stpncpy, "c*c*cC*z", "nF") BUILTIN(__builtin_strcasecmp, "icC*cC*", "nF") BUILTIN(__builtin_strcat, "c*c*cC*", "nF") BUILTIN(__builtin_strchr, "c*cC*i", "nF") BUILTIN(__builtin_strcmp, "icC*cC*", "nF") BUILTIN(__builtin_strcpy, "c*c*cC*", "nF") BUILTIN(__builtin_strcspn, "zcC*cC*", "nF") BUILTIN(__builtin_strdup, "c*cC*", "nF") BUILTIN(__builtin_strlen, "zcC*", "nF") BUILTIN(__builtin_strncasecmp, "icC*cC*z", "nF") BUILTIN(__builtin_strncat, "c*c*cC*z", "nF") BUILTIN(__builtin_strncmp, "icC*cC*z", "nF") BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF") BUILTIN(__builtin_strndup, "c*cC*z", "nF") BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF") BUILTIN(__builtin_strrchr, "c*cC*i", "nF") BUILTIN(__builtin_strspn, "zcC*cC*", "nF") BUILTIN(__builtin_strstr, "c*cC*cC*", "nF") BUILTIN(__builtin_return_address, "v*IUi", "n") BUILTIN(__builtin_extract_return_addr, "v*v*", "n") BUILTIN(__builtin_frame_address, "v*IUi", "n") BUILTIN(__builtin___clear_cache, "vc*c*", "n") BUILTIN(__builtin_flt_rounds, "i", "nc") BUILTIN(__builtin_setjmp, "iv**", "j") BUILTIN(__builtin_longjmp, "vv**i", "r") BUILTIN(__builtin_unwind_init, "v", "") BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc") BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") // GCC exception builtins BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t! BUILTIN(__builtin_frob_return_addr, "v*v*", "n") BUILTIN(__builtin_dwarf_cfa, "v*", "n") BUILTIN(__builtin_init_dwarf_reg_size_table, "vv*", "n") BUILTIN(__builtin_dwarf_sp_column, "Ui", "n") BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t // GCC Object size checking builtins BUILTIN(__builtin_object_size, "zvC*i", "nu") BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF") BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF") BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF") BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF") BUILTIN(__builtin___memset_chk, "v*v*izz", "nF") BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF") BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF") BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF") BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF") BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF") BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___snprintf_chk, "ic*zizcC*.", "Fp:4:") BUILTIN(__builtin___sprintf_chk, "ic*izcC*.", "Fp:3:") BUILTIN(__builtin___vsnprintf_chk, "ic*zizcC*a", "FP:4:") BUILTIN(__builtin___vsprintf_chk, "ic*izcC*a", "FP:3:") BUILTIN(__builtin___fprintf_chk, "iP*icC*.", "Fp:2:") BUILTIN(__builtin___printf_chk, "iicC*.", "Fp:1:") BUILTIN(__builtin___vfprintf_chk, "iP*icC*a", "FP:2:") BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:") BUILTIN(__builtin_expect, "LiLiLi" , "nc") BUILTIN(__builtin_prefetch, "vvC*.", "nc") BUILTIN(__builtin_readcyclecounter, "ULLi", "n") BUILTIN(__builtin_trap, "v", "nr") BUILTIN(__builtin_debugtrap, "v", "n") BUILTIN(__builtin_unreachable, "v", "nr") BUILTIN(__builtin_shufflevector, "v." , "nc") BUILTIN(__builtin_convertvector, "v." , "nct") BUILTIN(__builtin_alloca, "v*z" , "n") BUILTIN(__builtin_call_with_static_chain, "v.", "nt") // "Overloaded" Atomic operator builtins. These are overloaded to support data // types of i8, i16, i32, i64, and i128. The front-end sees calls to the // non-suffixed version of these (which has a bogus type) and transforms them to // the right overloaded version in Sema (plus casts). // FIXME: These assume that char -> i8, short -> i16, int -> i32, // long long -> i64. BUILTIN(__sync_fetch_and_add, "v.", "t") BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt") BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt") BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt") BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt") BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt") BUILTIN(__sync_fetch_and_sub, "v.", "t") BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt") BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt") BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt") BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt") BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt") BUILTIN(__sync_fetch_and_or, "v.", "t") BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt") BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt") BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt") BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt") BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt") BUILTIN(__sync_fetch_and_and, "v.", "t") BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn") BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn") BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn") BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_fetch_and_xor, "v.", "t") BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn") BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn") BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn") BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_fetch_and_nand, "v.", "t") BUILTIN(__sync_fetch_and_nand_1, "ccD*c.", "tn") BUILTIN(__sync_fetch_and_nand_2, "ssD*s.", "tn") BUILTIN(__sync_fetch_and_nand_4, "iiD*i.", "tn") BUILTIN(__sync_fetch_and_nand_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_fetch_and_nand_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_add_and_fetch, "v.", "t") BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn") BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn") BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn") BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_sub_and_fetch, "v.", "t") BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn") BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn") BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn") BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_or_and_fetch, "v.", "t") BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn") BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn") BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn") BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_and_and_fetch, "v.", "t") BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn") BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn") BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn") BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_xor_and_fetch, "v.", "t") BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn") BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn") BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn") BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_nand_and_fetch, "v.", "t") BUILTIN(__sync_nand_and_fetch_1, "ccD*c.", "tn") BUILTIN(__sync_nand_and_fetch_2, "ssD*s.", "tn") BUILTIN(__sync_nand_and_fetch_4, "iiD*i.", "tn") BUILTIN(__sync_nand_and_fetch_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_bool_compare_and_swap, "v.", "t") BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn") BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn") BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn") BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn") BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn") BUILTIN(__sync_val_compare_and_swap, "v.", "t") BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn") BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn") BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn") BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn") BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn") BUILTIN(__sync_lock_test_and_set, "v.", "t") BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn") BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn") BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn") BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_lock_release, "v.", "t") BUILTIN(__sync_lock_release_1, "vcD*.", "tn") BUILTIN(__sync_lock_release_2, "vsD*.", "tn") BUILTIN(__sync_lock_release_4, "viD*.", "tn") BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn") BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn") BUILTIN(__sync_swap, "v.", "t") BUILTIN(__sync_swap_1, "ccD*c.", "tn") BUILTIN(__sync_swap_2, "ssD*s.", "tn") BUILTIN(__sync_swap_4, "iiD*i.", "tn") BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn") // Some of our atomics builtins are handled by AtomicExpr rather than // as normal builtin CallExprs. This macro is used for such builtins. #ifndef ATOMIC_BUILTIN #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS) #endif // C11 _Atomic operations for <stdatomic.h>. ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t") ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t") BUILTIN(__c11_atomic_thread_fence, "vi", "n") BUILTIN(__c11_atomic_signal_fence, "vi", "n") BUILTIN(__c11_atomic_is_lock_free, "iz", "n") // GNU atomic builtins. ATOMIC_BUILTIN(__atomic_load, "v.", "t") ATOMIC_BUILTIN(__atomic_load_n, "v.", "t") ATOMIC_BUILTIN(__atomic_store, "v.", "t") ATOMIC_BUILTIN(__atomic_store_n, "v.", "t") ATOMIC_BUILTIN(__atomic_exchange, "v.", "t") ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t") ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t") ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t") ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t") ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t") ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t") ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t") ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t") ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t") ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t") ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t") ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t") ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t") ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t") ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t") BUILTIN(__atomic_test_and_set, "bvD*i", "n") BUILTIN(__atomic_clear, "vvD*i", "n") BUILTIN(__atomic_thread_fence, "vi", "n") BUILTIN(__atomic_signal_fence, "vi", "n") BUILTIN(__atomic_always_lock_free, "izvCD*", "n") BUILTIN(__atomic_is_lock_free, "izvCD*", "n") #undef ATOMIC_BUILTIN // Non-overloaded atomic builtins. BUILTIN(__sync_synchronize, "v.", "n") // GCC does not support these, they are a Clang extension. BUILTIN(__sync_fetch_and_min, "iiD*i", "n") BUILTIN(__sync_fetch_and_max, "iiD*i", "n") BUILTIN(__sync_fetch_and_umin, "UiUiD*Ui", "n") BUILTIN(__sync_fetch_and_umax, "UiUiD*Ui", "n") // Random libc builtins. BUILTIN(__builtin_abort, "v", "Fnr") BUILTIN(__builtin_index, "c*cC*i", "Fn") BUILTIN(__builtin_rindex, "c*cC*i", "Fn") // Microsoft builtins. These are only active with -fms-extensions. LANGBUILTIN(_alloca, "v*z", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__assume, "vb", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__debugbreak, "v", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__exception_code, "ULi", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_exception_code, "ULi", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__exception_info, "v*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_exception_info, "v*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__abnormal_termination, "i", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_abnormal_termination, "i", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__GetExceptionInfo, "v*.", "ntu", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedCompareExchange, "LiLiD*LiLi", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedCompareExchangePointer, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedDecrement, "LiLiD*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedExchangeAdd, "LiLiD*Li", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedExchange, "LiLiD*Li", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedExchangePointer, "v*v*D*v*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedIncrement, "LiLiD*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__noop, "i.", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__readfsdword, "ULiULi", "n", ALL_MS_LANGUAGES) LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES) // Microsoft library builtins. LIBBUILTIN(_setjmpex, "iJ", "fj", "setjmpex.h", ALL_MS_LANGUAGES) // C99 library functions // C99 stdlib.h LIBBUILTIN(abort, "v", "fr", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(malloc, "v*z", "f", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h", ALL_LANGUAGES) // C99 string.h LIBBUILTIN(memcpy, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(memcmp, "ivC*vC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(memmove, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcmp, "icC*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strncmp, "icC*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strncat, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(memchr, "v*vC*iz", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strpbrk, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strrchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strstr, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strtok, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(memset, "v*v*iz", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strerror, "c*i", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strlen, "zcC*", "f", "string.h", ALL_LANGUAGES) // C99 stdio.h LIBBUILTIN(printf, "icC*.", "fp:0:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(fprintf, "iP*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(snprintf, "ic*zcC*.", "fp:2:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(sprintf, "ic*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vfprintf, "i.", "fP:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(scanf, "icC*R.", "fs:0:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(fscanf, "iP*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(sscanf, "icC*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vscanf, "icC*Ra", "fS:0:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vfscanf, "iP*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) // C99 // In some systems setjmp is a macro that expands to _setjmp. We undefine // it here to avoid having two identical LIBBUILTIN entries. #undef setjmp LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) // Non-C library functions, active in GNU mode only. // Functions with (returns_twice) attribute (marked as "j") are still active in // all languages, because losing this attribute would result in miscompilation // when these functions are used in non-GNU mode. PR16138. LIBBUILTIN(alloca, "v*z", "f", "stdlib.h", ALL_GNU_LANGUAGES) // POSIX string.h LIBBUILTIN(stpcpy, "c*c*cC*", "f", "string.h", ALL_GNU_LANGUAGES) LIBBUILTIN(stpncpy, "c*c*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) LIBBUILTIN(strdup, "c*cC*", "f", "string.h", ALL_GNU_LANGUAGES) LIBBUILTIN(strndup, "c*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) // POSIX strings.h LIBBUILTIN(index, "c*cC*i", "f", "strings.h", ALL_GNU_LANGUAGES) LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_GNU_LANGUAGES) LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_GNU_LANGUAGES) // In some systems str[n]casejmp is a macro that expands to _str[n]icmp. // We undefine then here to avoid wrong name. #undef strcasecmp #undef strncasecmp LIBBUILTIN(strcasecmp, "icC*cC*", "f", "strings.h", ALL_GNU_LANGUAGES) LIBBUILTIN(strncasecmp, "icC*cC*z", "f", "strings.h", ALL_GNU_LANGUAGES) // POSIX unistd.h LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_GNU_LANGUAGES) LIBBUILTIN(vfork, "p", "fj", "unistd.h", ALL_LANGUAGES) // POSIX setjmp.h LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES) LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES) // non-standard but very common LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES) // id objc_msgSend(id, SEL, ...) LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG) // long double objc_msgSend_fpret(id self, SEL op, ...) LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG) // _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...) LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG) // void objc_msgSend_stret (id, SEL, ...) LIBBUILTIN(objc_msgSend_stret, "vGH.", "f", "objc/message.h", OBJC_LANG) // id objc_msgSendSuper(struct objc_super *super, SEL op, ...) LIBBUILTIN(objc_msgSendSuper, "GM*H.", "f", "objc/message.h", OBJC_LANG) // void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...) LIBBUILTIN(objc_msgSendSuper_stret, "vM*H.", "f", "objc/message.h", OBJC_LANG) // id objc_getClass(const char *name) LIBBUILTIN(objc_getClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) // id objc_getMetaClass(const char *name) LIBBUILTIN(objc_getMetaClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) // void objc_enumerationMutation(id) LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG) // id objc_read_weak(id *location) LIBBUILTIN(objc_read_weak, "GG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_weak(id value, id *location) LIBBUILTIN(objc_assign_weak, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_ivar(id value, id dest, ptrdiff_t offset) LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_global(id val, id *dest) LIBBUILTIN(objc_assign_global, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_strongCast(id val, id *dest LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_exception_extract(void *localExceptionData) LIBBUILTIN(objc_exception_extract, "Gv*", "f", "objc/objc-exception.h", OBJC_LANG) // void objc_exception_try_enter(void *localExceptionData) LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) // void objc_exception_try_exit(void *localExceptionData) LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) // int objc_exception_match(Class exceptionClass, id exception) LIBBUILTIN(objc_exception_match, "iGG", "f", "objc/objc-exception.h", OBJC_LANG) // void objc_exception_throw(id exception) LIBBUILTIN(objc_exception_throw, "vG", "f", "objc/objc-exception.h", OBJC_LANG) // int objc_sync_enter(id obj) LIBBUILTIN(objc_sync_enter, "iG", "f", "objc/objc-sync.h", OBJC_LANG) // int objc_sync_exit(id obj) LIBBUILTIN(objc_sync_exit, "iG", "f", "objc/objc-sync.h", OBJC_LANG) BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF") // void NSLog(NSString *fmt, ...) LIBBUILTIN(NSLog, "vG.", "fp:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) // void NSLogv(NSString *fmt, va_list args) LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) // Builtin math library functions LIBBUILTIN(atan2, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atan2f, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atan2l, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(abs, "ii", "fnc", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(labs, "LiLi", "fnc", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(llabs, "LLiLLi", "fnc", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(copysign, "ddd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(copysignf, "fff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(copysignl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fabs, "dd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fabsf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fabsl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmod, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmodf, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmodl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(frexp, "ddi*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(frexpf, "ffi*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(frexpl, "LdLdi*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(ldexp, "ddi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(ldexpf, "ffi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(ldexpl, "LdLdi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(modf, "ddd*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(modff, "fff*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(modfl, "LdLdLd*", "fn", "math.h", ALL_LANGUAGES) LIBBUILTIN(nan, "dcC*", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(nanf, "fcC*", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(nanl, "LdcC*", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(pow, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(powf, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(powl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(acos, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(acosf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(acosl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(acosh, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(acoshf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(acoshl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(asin, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(asinf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(asinl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(asinh, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(asinhf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(asinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atan, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atanf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atanl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atanh, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atanhf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(atanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(cbrt, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(cbrtf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(cbrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(ceil, "dd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(ceilf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(ceill, "LdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(cos, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(cosf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(cosl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(cosh, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(coshf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(coshl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(erf, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(erff, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(erfl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(erfc, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(erfcf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(erfcl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(exp, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(expf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(expl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(exp2, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(exp2f, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(exp2l, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(expm1, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(expm1f, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(expm1l, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fdim, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fdimf, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fdiml, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(floor, "dd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(floorf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(floorl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fma, "dddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmaf, "ffff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmal, "LdLdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmax, "ddd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmaxf, "fff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmaxl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fmin, "ddd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fminf, "fff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(fminl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(hypot, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(hypotf, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(hypotl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(ilogb, "id", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(ilogbf, "if", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(ilogbl, "iLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lgamma, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lgammaf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(llrint, "LLid", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(llrintf, "LLif", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(llrintl, "LLiLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(llround, "LLid", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(llroundf, "LLif", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(llroundl, "LLiLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(logf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(logl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log10, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log10f, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log10l, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log1p, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log1pf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log1pl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log2, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log2f, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(log2l, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(logb, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(logbf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(logbl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lrint, "Lid", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lrintf, "Lif", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lrintl, "LiLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lround, "Lid", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lroundf, "Lif", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(lroundl, "LiLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(nearbyint, "dd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(nearbyintf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(nearbyintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(nextafter, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(nextafterf, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(nextafterl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(nexttoward, "ddLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(nexttowardf, "ffLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(nexttowardl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(remainder, "ddd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(remainderf, "fff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(remainderl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(rint, "dd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(rintf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(rintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(round, "dd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(roundf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(roundl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(scalbln, "ddLi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(scalblnf, "ffLi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(scalblnl, "LdLdLi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(scalbn, "ddi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(scalbnf, "ffi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(scalbnl, "LdLdi", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sin, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sinf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sinl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sinh, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sinhf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sqrt, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sqrtf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(sqrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tan, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tanf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tanl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tanh, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tanhf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tgamma, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tgammaf, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(tgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(trunc, "dd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(truncf, "ff", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(truncl, "LdLd", "fnc", "math.h", ALL_LANGUAGES) LIBBUILTIN(cabs, "dXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cabsf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cabsl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cacos, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cacosf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cacosl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cacosh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cacoshf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cacoshl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(carg, "dXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cargf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cargl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(casin, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(casinf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(casinl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(casinh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(casinhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(casinhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(catan, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(catanf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(catanl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(catanh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(catanhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(catanhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ccos, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ccosf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ccosl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ccosh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ccoshf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ccoshl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cexp, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cexpf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cexpl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cimag, "dXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cimagf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cimagl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(conj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(conjf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(conjl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(clog, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(clogf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(clogl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cproj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cprojf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cprojl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cpow, "XdXdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cpowf, "XfXfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(cpowl, "XLdXLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(creal, "dXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(crealf, "fXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(creall, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csin, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csinf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csinl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csinh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csinhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csinhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csqrt, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csqrtf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(csqrtl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ctan, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ctanf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ctanl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ctanh, "XdXd", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ctanhf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES) LIBBUILTIN(ctanhl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES) // __sinpi and friends are OS X specific library functions, but otherwise much // like the standard (non-complex) sin (etc). LIBBUILTIN(__sinpi, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(__sinpif, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(__cospi, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(__cospif, "ff", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(__tanpi, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(__tanpif, "ff", "fne", "math.h", ALL_LANGUAGES) // Similarly, __exp10 is OS X only LIBBUILTIN(__exp10, "dd", "fne", "math.h", ALL_LANGUAGES) LIBBUILTIN(__exp10f, "ff", "fne", "math.h", ALL_LANGUAGES) // Blocks runtime Builtin math library functions LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES) LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES) // FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock. // Annotation function BUILTIN(__builtin_annotation, "v.", "tn") // Invariants BUILTIN(__builtin_assume, "vb", "n") // Multiprecision Arithmetic Builtins. BUILTIN(__builtin_addcb, "UcUcCUcCUcCUc*", "n") BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n") BUILTIN(__builtin_addc, "UiUiCUiCUiCUi*", "n") BUILTIN(__builtin_addcl, "ULiULiCULiCULiCULi*", "n") BUILTIN(__builtin_addcll, "ULLiULLiCULLiCULLiCULLi*", "n") BUILTIN(__builtin_subcb, "UcUcCUcCUcCUc*", "n") BUILTIN(__builtin_subcs, "UsUsCUsCUsCUs*", "n") BUILTIN(__builtin_subc, "UiUiCUiCUiCUi*", "n") BUILTIN(__builtin_subcl, "ULiULiCULiCULiCULi*", "n") BUILTIN(__builtin_subcll, "ULLiULLiCULLiCULLiCULLi*", "n") // Checked Arithmetic Builtins for Security. BUILTIN(__builtin_uadd_overflow, "bUiCUiCUi*", "n") BUILTIN(__builtin_uaddl_overflow, "bULiCULiCULi*", "n") BUILTIN(__builtin_uaddll_overflow, "bULLiCULLiCULLi*", "n") BUILTIN(__builtin_usub_overflow, "bUiCUiCUi*", "n") BUILTIN(__builtin_usubl_overflow, "bULiCULiCULi*", "n") BUILTIN(__builtin_usubll_overflow, "bULLiCULLiCULLi*", "n") BUILTIN(__builtin_umul_overflow, "bUiCUiCUi*", "n") BUILTIN(__builtin_umull_overflow, "bULiCULiCULi*", "n") BUILTIN(__builtin_umulll_overflow, "bULLiCULLiCULLi*", "n") BUILTIN(__builtin_sadd_overflow, "bSiCSiCSi*", "n") BUILTIN(__builtin_saddl_overflow, "bSLiCSLiCSLi*", "n") BUILTIN(__builtin_saddll_overflow, "bSLLiCSLLiCSLLi*", "n") BUILTIN(__builtin_ssub_overflow, "bSiCSiCSi*", "n") BUILTIN(__builtin_ssubl_overflow, "bSLiCSLiCSLi*", "n") BUILTIN(__builtin_ssubll_overflow, "bSLLiCSLLiCSLLi*", "n") BUILTIN(__builtin_smul_overflow, "bSiCSiCSi*", "n") BUILTIN(__builtin_smull_overflow, "bSLiCSLiCSLi*", "n") BUILTIN(__builtin_smulll_overflow, "bSLLiCSLLiCSLLi*", "n") // Clang builtins (not available in GCC). BUILTIN(__builtin_addressof, "v*v&", "nct") BUILTIN(__builtin_operator_new, "v*z", "c") BUILTIN(__builtin_operator_delete, "vv*", "n") // Safestack builtins BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn") BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn") #undef BUILTIN #undef LIBBUILTIN #undef LANGBUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/ExpressionTraits.h
//===- ExpressionTraits.h - C++ Expression Traits Support Enums -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines enumerations for expression traits intrinsics. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_EXPRESSIONTRAITS_H #define LLVM_CLANG_BASIC_EXPRESSIONTRAITS_H namespace clang { enum ExpressionTrait { ET_IsLValueExpr, ET_IsRValueExpr }; } #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/PartialDiagnostic.h
//===--- PartialDiagnostic.h - Diagnostic "closures" ------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Implements a partial diagnostic that can be emitted anwyhere /// in a DiagnosticBuilder stream. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_PARTIALDIAGNOSTIC_H #define LLVM_CLANG_BASIC_PARTIALDIAGNOSTIC_H #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" #include <cassert> namespace clang { class PartialDiagnostic { public: enum { // The MaxArguments and MaxFixItHints member enum values from // DiagnosticsEngine are private but DiagnosticsEngine declares // PartialDiagnostic a friend. These enum values are redeclared // here so that the nested Storage class below can access them. MaxArguments = DiagnosticsEngine::MaxArguments }; struct Storage { Storage() : NumDiagArgs(0) { } enum { /// \brief The maximum number of arguments we can hold. We /// currently only support up to 10 arguments (%0-%9). /// /// A single diagnostic with more than that almost certainly has to /// be simplified anyway. MaxArguments = PartialDiagnostic::MaxArguments }; /// \brief The number of entries in Arguments. unsigned char NumDiagArgs; /// \brief Specifies for each argument whether it is in DiagArgumentsStr /// or in DiagArguments. unsigned char DiagArgumentsKind[MaxArguments]; /// \brief The values for the various substitution positions. /// /// This is used when the argument is not an std::string. The specific value /// is mangled into an intptr_t and the interpretation depends on exactly /// what sort of argument kind it is. intptr_t DiagArgumentsVal[MaxArguments]; /// \brief The values for the various substitution positions that have /// string arguments. std::string DiagArgumentsStr[MaxArguments]; /// \brief The list of ranges added to this diagnostic. SmallVector<CharSourceRange, 8> DiagRanges; /// \brief If valid, provides a hint with some code to insert, remove, or /// modify at a particular position. SmallVector<FixItHint, 6> FixItHints; }; /// \brief An allocator for Storage objects, which uses a small cache to /// objects, used to reduce malloc()/free() traffic for partial diagnostics. class StorageAllocator { static const unsigned NumCached = 16; Storage Cached[NumCached]; Storage *FreeList[NumCached]; unsigned NumFreeListEntries; public: StorageAllocator(); ~StorageAllocator(); /// \brief Allocate new storage. Storage *Allocate() { if (NumFreeListEntries == 0) return new Storage; Storage *Result = FreeList[--NumFreeListEntries]; Result->NumDiagArgs = 0; Result->DiagRanges.clear(); Result->FixItHints.clear(); return Result; } /// \brief Free the given storage object. void Deallocate(Storage *S) { if (S >= Cached && S <= Cached + NumCached) { FreeList[NumFreeListEntries++] = S; return; } delete S; } }; private: // NOTE: Sema assumes that PartialDiagnostic is location-invariant // in the sense that its bits can be safely memcpy'ed and destructed // in the new location. /// \brief The diagnostic ID. mutable unsigned DiagID; /// \brief Storage for args and ranges. mutable Storage *DiagStorage; /// \brief Allocator used to allocate storage for this diagnostic. StorageAllocator *Allocator; /// \brief Retrieve storage for this particular diagnostic. Storage *getStorage() const { if (DiagStorage) return DiagStorage; if (Allocator) DiagStorage = Allocator->Allocate(); else { assert(Allocator != reinterpret_cast<StorageAllocator *>(~uintptr_t(0))); DiagStorage = new Storage; } return DiagStorage; } void freeStorage() { if (!DiagStorage) return; // The hot path for PartialDiagnostic is when we just used it to wrap an ID // (typically so we have the flexibility of passing a more complex // diagnostic into the callee, but that does not commonly occur). // // Split this out into a slow function for silly compilers (*cough*) which // can't do decent partial inlining. freeStorageSlow(); } void freeStorageSlow() { if (Allocator) Allocator->Deallocate(DiagStorage); else if (Allocator != reinterpret_cast<StorageAllocator *>(~uintptr_t(0))) delete DiagStorage; DiagStorage = nullptr; } void AddSourceRange(const CharSourceRange &R) const { if (!DiagStorage) DiagStorage = getStorage(); DiagStorage->DiagRanges.push_back(R); } void AddFixItHint(const FixItHint &Hint) const { if (Hint.isNull()) return; if (!DiagStorage) DiagStorage = getStorage(); DiagStorage->FixItHints.push_back(Hint); } public: struct NullDiagnostic {}; /// \brief Create a null partial diagnostic, which cannot carry a payload, /// and only exists to be swapped with a real partial diagnostic. PartialDiagnostic(NullDiagnostic) : DiagID(0), DiagStorage(nullptr), Allocator(nullptr) { } PartialDiagnostic(unsigned DiagID, StorageAllocator &Allocator) : DiagID(DiagID), DiagStorage(nullptr), Allocator(&Allocator) { } PartialDiagnostic(const PartialDiagnostic &Other) : DiagID(Other.DiagID), DiagStorage(nullptr), Allocator(Other.Allocator) { if (Other.DiagStorage) { DiagStorage = getStorage(); *DiagStorage = *Other.DiagStorage; } } PartialDiagnostic(PartialDiagnostic &&Other) : DiagID(Other.DiagID), DiagStorage(Other.DiagStorage), Allocator(Other.Allocator) { Other.DiagStorage = nullptr; } PartialDiagnostic(const PartialDiagnostic &Other, Storage *DiagStorage) : DiagID(Other.DiagID), DiagStorage(DiagStorage), Allocator(reinterpret_cast<StorageAllocator *>(~uintptr_t(0))) { if (Other.DiagStorage) *this->DiagStorage = *Other.DiagStorage; } PartialDiagnostic(const Diagnostic &Other, StorageAllocator &Allocator) : DiagID(Other.getID()), DiagStorage(nullptr), Allocator(&Allocator) { // Copy arguments. for (unsigned I = 0, N = Other.getNumArgs(); I != N; ++I) { if (Other.getArgKind(I) == DiagnosticsEngine::ak_std_string) AddString(Other.getArgStdStr(I)); else AddTaggedVal(Other.getRawArg(I), Other.getArgKind(I)); } // Copy source ranges. for (unsigned I = 0, N = Other.getNumRanges(); I != N; ++I) AddSourceRange(Other.getRange(I)); // Copy fix-its. for (unsigned I = 0, N = Other.getNumFixItHints(); I != N; ++I) AddFixItHint(Other.getFixItHint(I)); } PartialDiagnostic &operator=(const PartialDiagnostic &Other) { DiagID = Other.DiagID; if (Other.DiagStorage) { if (!DiagStorage) DiagStorage = getStorage(); *DiagStorage = *Other.DiagStorage; } else { freeStorage(); } return *this; } PartialDiagnostic &operator=(PartialDiagnostic &&Other) { freeStorage(); DiagID = Other.DiagID; DiagStorage = Other.DiagStorage; Allocator = Other.Allocator; Other.DiagStorage = nullptr; return *this; } ~PartialDiagnostic() { freeStorage(); } void swap(PartialDiagnostic &PD) { std::swap(DiagID, PD.DiagID); std::swap(DiagStorage, PD.DiagStorage); std::swap(Allocator, PD.Allocator); } unsigned getDiagID() const { return DiagID; } void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const { if (!DiagStorage) DiagStorage = getStorage(); assert(DiagStorage->NumDiagArgs < Storage::MaxArguments && "Too many arguments to diagnostic!"); assert(DiagStorage->NumDiagArgs < Storage::MaxArguments); DiagStorage->DiagArgumentsKind[DiagStorage->NumDiagArgs] = Kind; DiagStorage->DiagArgumentsVal[DiagStorage->NumDiagArgs++] = V; } void AddString(StringRef V) const { if (!DiagStorage) DiagStorage = getStorage(); assert(DiagStorage->NumDiagArgs < Storage::MaxArguments && "Too many arguments to diagnostic!"); assert(DiagStorage->NumDiagArgs < Storage::MaxArguments); DiagStorage->DiagArgumentsKind[DiagStorage->NumDiagArgs] = DiagnosticsEngine::ak_std_string; DiagStorage->DiagArgumentsStr[DiagStorage->NumDiagArgs++] = V; } void Emit(const DiagnosticBuilder &DB) const { if (!DiagStorage) return; // Add all arguments. for (unsigned i = 0, e = DiagStorage->NumDiagArgs; i != e; ++i) { if ((DiagnosticsEngine::ArgumentKind)DiagStorage->DiagArgumentsKind[i] == DiagnosticsEngine::ak_std_string) DB.AddString(DiagStorage->DiagArgumentsStr[i]); else DB.AddTaggedVal(DiagStorage->DiagArgumentsVal[i], (DiagnosticsEngine::ArgumentKind)DiagStorage->DiagArgumentsKind[i]); } // Add all ranges. for (const CharSourceRange &Range : DiagStorage->DiagRanges) DB.AddSourceRange(Range); // Add all fix-its. for (const FixItHint &Fix : DiagStorage->FixItHints) DB.AddFixItHint(Fix); } void EmitToString(DiagnosticsEngine &Diags, SmallVectorImpl<char> &Buf) const { // FIXME: It should be possible to render a diagnostic to a string without // messing with the state of the diagnostics engine. DiagnosticBuilder DB(Diags.Report(getDiagID())); Emit(DB); DB.FlushCounts(); Diagnostic(&Diags).FormatDiagnostic(Buf); DB.Clear(); Diags.Clear(); } /// \brief Clear out this partial diagnostic, giving it a new diagnostic ID /// and removing all of its arguments, ranges, and fix-it hints. void Reset(unsigned DiagID = 0) { this->DiagID = DiagID; freeStorage(); } bool hasStorage() const { return DiagStorage != nullptr; } friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, unsigned I) { PD.AddTaggedVal(I, DiagnosticsEngine::ak_uint); return PD; } friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, int I) { PD.AddTaggedVal(I, DiagnosticsEngine::ak_sint); return PD; } friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const char *S) { PD.AddTaggedVal(reinterpret_cast<intptr_t>(S), DiagnosticsEngine::ak_c_string); return PD; } friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, StringRef S) { PD.AddString(S); return PD; } friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const IdentifierInfo *II) { PD.AddTaggedVal(reinterpret_cast<intptr_t>(II), DiagnosticsEngine::ak_identifierinfo); return PD; } // Adds a DeclContext to the diagnostic. The enable_if template magic is here // so that we only match those arguments that are (statically) DeclContexts; // other arguments that derive from DeclContext (e.g., RecordDecls) will not // match. template<typename T> friend inline typename std::enable_if<std::is_same<T, DeclContext>::value, const PartialDiagnostic &>::type operator<<(const PartialDiagnostic &PD, T *DC) { PD.AddTaggedVal(reinterpret_cast<intptr_t>(DC), DiagnosticsEngine::ak_declcontext); return PD; } friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const SourceRange &R) { PD.AddSourceRange(CharSourceRange::getTokenRange(R)); return PD; } friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const CharSourceRange &R) { PD.AddSourceRange(R); return PD; } friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const FixItHint &Hint) { PD.AddFixItHint(Hint); return PD; } }; inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const PartialDiagnostic &PD) { PD.Emit(DB); return DB; } /// \brief A partial diagnostic along with the source location where this /// diagnostic occurs. typedef std::pair<SourceLocation, PartialDiagnostic> PartialDiagnosticAt; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/DiagnosticOptions.def
//===--- DiagOptions.def - Diagnostic option database ------------- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the diagnostic options. Users of this file // must define the DIAGOPT macro to make use of this information. // Optionally, the user may also define ENUM_DIAGOPT (for options // that have enumeration type and VALUE_DIAGOPT (for options that // describe a value rather than a flag). The SEMANTIC_* variants of these macros // indicate options that affect the processing of the program, rather than // simply the output. // //===----------------------------------------------------------------------===// #ifndef DIAGOPT # error Define the DIAGOPT macro to handle language options #endif // // /////////////////////////////////////////////////////////////////////////////// #ifndef VALUE_DIAGOPT # define VALUE_DIAGOPT(Name, Bits, Default) \ DIAGOPT(Name, Bits, Default) #endif #ifndef ENUM_DIAGOPT # define ENUM_DIAGOPT(Name, Type, Bits, Default) \ DIAGOPT(Name, Bits, Default) #endif #ifndef SEMANTIC_DIAGOPT # define SEMANTIC_DIAGOPT(Name, Bits, Default) DIAGOPT(Name, Bits, Default) #endif #ifndef SEMANTIC_VALUE_DIAGOPT # define SEMANTIC_VALUE_DIAGOPT(Name, Bits, Default) \ VALUE_DIAGOPT(Name, Bits, Default) #endif #ifndef SEMANTIC_ENUM_DIAGOPT # define SEMANTIC_ENUM_DIAGOPT(Name, Type, Bits, Default) \ ENUM_DIAGOPT(Name, Type, Bits, Default) #endif SEMANTIC_DIAGOPT(IgnoreWarnings, 1, 0) /// -w DIAGOPT(NoRewriteMacros, 1, 0) /// -Wno-rewrite-macros DIAGOPT(Pedantic, 1, 0) /// -pedantic DIAGOPT(PedanticErrors, 1, 0) /// -pedantic-errors DIAGOPT(ShowColumn, 1, 1) /// Show column number on diagnostics. DIAGOPT(ShowLocation, 1, 1) /// Show source location information. DIAGOPT(ShowCarets, 1, 1) /// Show carets in diagnostics. DIAGOPT(ShowFixits, 1, 1) /// Show fixit information. DIAGOPT(ShowSourceRanges, 1, 0) /// Show source ranges in numeric form. DIAGOPT(ShowParseableFixits, 1, 0) /// Show machine parseable fix-its. DIAGOPT(ShowPresumedLoc, 1, 1) /// Show presumed location for diagnostics. DIAGOPT(ShowOptionNames, 1, 0) /// Show the option name for mappable /// diagnostics. DIAGOPT(ShowNoteIncludeStack, 1, 0) /// Show include stacks for notes. VALUE_DIAGOPT(ShowCategories, 2, 0) /// Show categories: 0 -> none, 1 -> Number, /// 2 -> Full Name. ENUM_DIAGOPT(Format, TextDiagnosticFormat, 2, Clang) /// Format for diagnostics: DIAGOPT(ShowColors, 1, 0) /// Show diagnostics with ANSI color sequences. ENUM_DIAGOPT(ShowOverloads, OverloadsShown, 1, Ovl_All) /// Overload candidates to show. DIAGOPT(VerifyDiagnostics, 1, 0) /// Check that diagnostics match the expected /// diagnostics, indicated by markers in the /// input source file. ENUM_DIAGOPT(VerifyIgnoreUnexpected, DiagnosticLevelMask, 4, DiagnosticLevelMask::None) /// Ignore unexpected diagnostics of /// the specified levels when using /// -verify. DIAGOPT(ElideType, 1, 0) /// Elide identical types in template diffing DIAGOPT(ShowTemplateTree, 1, 0) /// Print a template tree when diffing DIAGOPT(CLFallbackMode, 1, 0) /// Format for clang-cl fallback mode VALUE_DIAGOPT(ErrorLimit, 32, 0) /// Limit # errors emitted. /// Limit depth of macro expansion backtrace. VALUE_DIAGOPT(MacroBacktraceLimit, 32, DefaultMacroBacktraceLimit) /// Limit depth of instantiation backtrace. VALUE_DIAGOPT(TemplateBacktraceLimit, 32, DefaultTemplateBacktraceLimit) /// Limit depth of constexpr backtrace. VALUE_DIAGOPT(ConstexprBacktraceLimit, 32, DefaultConstexprBacktraceLimit) /// Limit number of times to perform spell checking. VALUE_DIAGOPT(SpellCheckingLimit, 32, DefaultSpellCheckingLimit) VALUE_DIAGOPT(TabStop, 32, DefaultTabStop) /// The distance between tab stops. /// Column limit for formatting message diagnostics, or 0 if unused. VALUE_DIAGOPT(MessageLength, 32, 0) #undef DIAGOPT #undef ENUM_DIAGOPT #undef VALUE_DIAGOPT #undef SEMANTIC_DIAGOPT #undef SEMANTIC_ENUM_DIAGOPT #undef SEMANTIC_VALUE_DIAGOPT
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/SourceLocation.h
//===--- SourceLocation.h - Compact identifier for Source Files -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::SourceLocation class and associated facilities. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SOURCELOCATION_H #define LLVM_CLANG_BASIC_SOURCELOCATION_H #include "clang/Basic/LLVM.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/PointerLikeTypeTraits.h" #include <cassert> #include <functional> #include <string> #include <utility> namespace llvm { class MemoryBuffer; template <typename T> struct DenseMapInfo; template <typename T> struct isPodLike; } namespace clang { class SourceManager; /// \brief An opaque identifier used by SourceManager which refers to a /// source file (MemoryBuffer) along with its \#include path and \#line data. /// class FileID { /// \brief A mostly-opaque identifier, where 0 is "invalid", >0 is /// this module, and <-1 is something loaded from another module. int ID; public: FileID() : ID(0) {} bool isInvalid() const { return ID == 0; } bool operator==(const FileID &RHS) const { return ID == RHS.ID; } bool operator<(const FileID &RHS) const { return ID < RHS.ID; } bool operator<=(const FileID &RHS) const { return ID <= RHS.ID; } bool operator!=(const FileID &RHS) const { return !(*this == RHS); } bool operator>(const FileID &RHS) const { return RHS < *this; } bool operator>=(const FileID &RHS) const { return RHS <= *this; } static FileID getSentinel() { return get(-1); } unsigned getHashValue() const { return static_cast<unsigned>(ID); } private: friend class SourceManager; friend class ASTWriter; friend class ASTReader; static FileID get(int V) { FileID F; F.ID = V; return F; } int getOpaqueValue() const { return ID; } }; /// \brief Encodes a location in the source. The SourceManager can decode this /// to get at the full include stack, line and column information. /// /// Technically, a source location is simply an offset into the manager's view /// of the input source, which is all input buffers (including macro /// expansions) concatenated in an effectively arbitrary order. The manager /// actually maintains two blocks of input buffers. One, starting at offset /// 0 and growing upwards, contains all buffers from this module. The other, /// starting at the highest possible offset and growing downwards, contains /// buffers of loaded modules. /// /// In addition, one bit of SourceLocation is used for quick access to the /// information whether the location is in a file or a macro expansion. /// /// It is important that this type remains small. It is currently 32 bits wide. class SourceLocation { unsigned ID; friend class SourceManager; friend class ASTReader; friend class ASTWriter; enum : unsigned { MacroIDBit = 1U << 31 }; public: SourceLocation() : ID(0) {} bool isFileID() const { return (ID & MacroIDBit) == 0; } bool isMacroID() const { return (ID & MacroIDBit) != 0; } /// \brief Return true if this is a valid SourceLocation object. /// /// Invalid SourceLocations are often used when events have no corresponding /// location in the source (e.g. a diagnostic is required for a command line /// option). bool isValid() const { return ID != 0; } bool isInvalid() const { return ID == 0; } private: /// \brief Return the offset into the manager's global input view. unsigned getOffset() const { return ID & ~MacroIDBit; } static SourceLocation getFileLoc(unsigned ID) { assert((ID & MacroIDBit) == 0 && "Ran out of source locations!"); SourceLocation L; L.ID = ID; return L; } static SourceLocation getMacroLoc(unsigned ID) { assert((ID & MacroIDBit) == 0 && "Ran out of source locations!"); SourceLocation L; L.ID = MacroIDBit | ID; return L; } public: /// \brief Return a source location with the specified offset from this /// SourceLocation. SourceLocation getLocWithOffset(int Offset) const { assert(((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow"); SourceLocation L; L.ID = ID+Offset; return L; } /// \brief When a SourceLocation itself cannot be used, this returns /// an (opaque) 32-bit integer encoding for it. /// /// This should only be passed to SourceLocation::getFromRawEncoding, it /// should not be inspected directly. unsigned getRawEncoding() const { return ID; } /// \brief Turn a raw encoding of a SourceLocation object into /// a real SourceLocation. /// /// \see getRawEncoding. static SourceLocation getFromRawEncoding(unsigned Encoding) { SourceLocation X; X.ID = Encoding; return X; } /// \brief When a SourceLocation itself cannot be used, this returns /// an (opaque) pointer encoding for it. /// /// This should only be passed to SourceLocation::getFromPtrEncoding, it /// should not be inspected directly. void* getPtrEncoding() const { // Double cast to avoid a warning "cast to pointer from integer of different // size". return (void*)(uintptr_t)getRawEncoding(); } /// \brief Turn a pointer encoding of a SourceLocation object back /// into a real SourceLocation. static SourceLocation getFromPtrEncoding(const void *Encoding) { return getFromRawEncoding((unsigned)(uintptr_t)Encoding); } void print(raw_ostream &OS, const SourceManager &SM) const; std::string printToString(const SourceManager &SM) const; void dump(const SourceManager &SM) const; }; inline bool operator==(const SourceLocation &LHS, const SourceLocation &RHS) { return LHS.getRawEncoding() == RHS.getRawEncoding(); } inline bool operator!=(const SourceLocation &LHS, const SourceLocation &RHS) { return !(LHS == RHS); } inline bool operator<(const SourceLocation &LHS, const SourceLocation &RHS) { return LHS.getRawEncoding() < RHS.getRawEncoding(); } /// \brief A trivial tuple used to represent a source range. class SourceRange { SourceLocation B; SourceLocation E; public: SourceRange(): B(SourceLocation()), E(SourceLocation()) {} SourceRange(SourceLocation loc) : B(loc), E(loc) {} SourceRange(SourceLocation begin, SourceLocation end) : B(begin), E(end) {} SourceLocation getBegin() const { return B; } SourceLocation getEnd() const { return E; } void setBegin(SourceLocation b) { B = b; } void setEnd(SourceLocation e) { E = e; } bool isValid() const { return B.isValid() && E.isValid(); } bool isInvalid() const { return !isValid(); } bool operator==(const SourceRange &X) const { return B == X.B && E == X.E; } bool operator!=(const SourceRange &X) const { return B != X.B || E != X.E; } }; /// \brief Represents a character-granular source range. /// /// The underlying SourceRange can either specify the starting/ending character /// of the range, or it can specify the start of the range and the start of the /// last token of the range (a "token range"). In the token range case, the /// size of the last token must be measured to determine the actual end of the /// range. class CharSourceRange { SourceRange Range; bool IsTokenRange; public: CharSourceRange() : IsTokenRange(false) {} CharSourceRange(SourceRange R, bool ITR) : Range(R), IsTokenRange(ITR) {} static CharSourceRange getTokenRange(SourceRange R) { return CharSourceRange(R, true); } static CharSourceRange getCharRange(SourceRange R) { return CharSourceRange(R, false); } static CharSourceRange getTokenRange(SourceLocation B, SourceLocation E) { return getTokenRange(SourceRange(B, E)); } static CharSourceRange getCharRange(SourceLocation B, SourceLocation E) { return getCharRange(SourceRange(B, E)); } /// \brief Return true if the end of this range specifies the start of /// the last token. Return false if the end of this range specifies the last /// character in the range. bool isTokenRange() const { return IsTokenRange; } bool isCharRange() const { return !IsTokenRange; } SourceLocation getBegin() const { return Range.getBegin(); } SourceLocation getEnd() const { return Range.getEnd(); } const SourceRange &getAsRange() const { return Range; } void setBegin(SourceLocation b) { Range.setBegin(b); } void setEnd(SourceLocation e) { Range.setEnd(e); } bool isValid() const { return Range.isValid(); } bool isInvalid() const { return !isValid(); } }; /// \brief A SourceLocation and its associated SourceManager. /// /// This is useful for argument passing to functions that expect both objects. class FullSourceLoc : public SourceLocation { const SourceManager *SrcMgr; public: /// \brief Creates a FullSourceLoc where isValid() returns \c false. explicit FullSourceLoc() : SrcMgr(nullptr) {} explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM) : SourceLocation(Loc), SrcMgr(&SM) {} /// \pre This FullSourceLoc has an associated SourceManager. const SourceManager &getManager() const { assert(SrcMgr && "SourceManager is NULL."); return *SrcMgr; } FileID getFileID() const; FullSourceLoc getExpansionLoc() const; FullSourceLoc getSpellingLoc() const; unsigned getExpansionLineNumber(bool *Invalid = nullptr) const; unsigned getExpansionColumnNumber(bool *Invalid = nullptr) const; unsigned getSpellingLineNumber(bool *Invalid = nullptr) const; unsigned getSpellingColumnNumber(bool *Invalid = nullptr) const; const char *getCharacterData(bool *Invalid = nullptr) const; /// \brief Return a StringRef to the source buffer data for the /// specified FileID. StringRef getBufferData(bool *Invalid = nullptr) const; /// \brief Decompose the specified location into a raw FileID + Offset pair. /// /// The first element is the FileID, the second is the offset from the /// start of the buffer of the location. std::pair<FileID, unsigned> getDecomposedLoc() const; bool isInSystemHeader() const; /// \brief Determines the order of 2 source locations in the translation unit. /// /// \returns true if this source location comes before 'Loc', false otherwise. bool isBeforeInTranslationUnitThan(SourceLocation Loc) const; /// \brief Determines the order of 2 source locations in the translation unit. /// /// \returns true if this source location comes before 'Loc', false otherwise. bool isBeforeInTranslationUnitThan(FullSourceLoc Loc) const { assert(Loc.isValid()); assert(SrcMgr == Loc.SrcMgr && "Loc comes from another SourceManager!"); return isBeforeInTranslationUnitThan((SourceLocation)Loc); } /// \brief Comparison function class, useful for sorting FullSourceLocs. struct BeforeThanCompare { bool operator()(const FullSourceLoc& lhs, const FullSourceLoc& rhs) const { return lhs.isBeforeInTranslationUnitThan(rhs); } }; /// \brief Prints information about this FullSourceLoc to stderr. /// /// This is useful for debugging. void dump() const; friend inline bool operator==(const FullSourceLoc &LHS, const FullSourceLoc &RHS) { return LHS.getRawEncoding() == RHS.getRawEncoding() && LHS.SrcMgr == RHS.SrcMgr; } friend inline bool operator!=(const FullSourceLoc &LHS, const FullSourceLoc &RHS) { return !(LHS == RHS); } }; /// \brief Represents an unpacked "presumed" location which can be presented /// to the user. /// /// A 'presumed' location can be modified by \#line and GNU line marker /// directives and is always the expansion point of a normal location. /// /// You can get a PresumedLoc from a SourceLocation with SourceManager. class PresumedLoc { const char *Filename; unsigned Line, Col; SourceLocation IncludeLoc; public: PresumedLoc() : Filename(nullptr) {} PresumedLoc(const char *FN, unsigned Ln, unsigned Co, SourceLocation IL) : Filename(FN), Line(Ln), Col(Co), IncludeLoc(IL) { } /// \brief Return true if this object is invalid or uninitialized. /// /// This occurs when created with invalid source locations or when walking /// off the top of a \#include stack. bool isInvalid() const { return Filename == nullptr; } bool isValid() const { return Filename != nullptr; } /// \brief Return the presumed filename of this location. /// /// This can be affected by \#line etc. const char *getFilename() const { return Filename; } /// \brief Return the presumed line number of this location. /// /// This can be affected by \#line etc. unsigned getLine() const { return Line; } /// \brief Return the presumed column number of this location. /// /// This cannot be affected by \#line, but is packaged here for convenience. unsigned getColumn() const { return Col; } /// \brief Return the presumed include location of this location. /// /// This can be affected by GNU linemarker directives. SourceLocation getIncludeLoc() const { return IncludeLoc; } }; } // end namespace clang namespace llvm { /// Define DenseMapInfo so that FileID's can be used as keys in DenseMap and /// DenseSets. template <> struct DenseMapInfo<clang::FileID> { static inline clang::FileID getEmptyKey() { return clang::FileID(); } static inline clang::FileID getTombstoneKey() { return clang::FileID::getSentinel(); } static unsigned getHashValue(clang::FileID S) { return S.getHashValue(); } static bool isEqual(clang::FileID LHS, clang::FileID RHS) { return LHS == RHS; } }; template <> struct isPodLike<clang::SourceLocation> { static const bool value = true; }; template <> struct isPodLike<clang::FileID> { static const bool value = true; }; // Teach SmallPtrSet how to handle SourceLocation. template<> class PointerLikeTypeTraits<clang::SourceLocation> { public: static inline void *getAsVoidPointer(clang::SourceLocation L) { return L.getPtrEncoding(); } static inline clang::SourceLocation getFromVoidPointer(void *P) { return clang::SourceLocation::getFromRawEncoding((unsigned)(uintptr_t)P); } enum { NumLowBitsAvailable = 0 }; }; } // end namespace llvm #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsAArch64.def
//==- BuiltinsAArch64.def - AArch64 Builtin function database ----*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the AArch64-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") BUILTIN(__builtin_arm_ldrex, "v.", "t") BUILTIN(__builtin_arm_ldaex, "v.", "t") BUILTIN(__builtin_arm_strex, "i.", "t") BUILTIN(__builtin_arm_stlex, "i.", "t") BUILTIN(__builtin_arm_clrex, "v", "") // Bit manipulation BUILTIN(__builtin_arm_rbit, "UiUi", "nc") BUILTIN(__builtin_arm_rbit64, "LUiLUi", "nc") // HINT BUILTIN(__builtin_arm_nop, "v", "") BUILTIN(__builtin_arm_yield, "v", "") BUILTIN(__builtin_arm_wfe, "v", "") BUILTIN(__builtin_arm_wfi, "v", "") BUILTIN(__builtin_arm_sev, "v", "") BUILTIN(__builtin_arm_sevl, "v", "") // CRC32 BUILTIN(__builtin_arm_crc32b, "UiUiUc", "nc") BUILTIN(__builtin_arm_crc32cb, "UiUiUc", "nc") BUILTIN(__builtin_arm_crc32h, "UiUiUs", "nc") BUILTIN(__builtin_arm_crc32ch, "UiUiUs", "nc") BUILTIN(__builtin_arm_crc32w, "UiUiUi", "nc") BUILTIN(__builtin_arm_crc32cw, "UiUiUi", "nc") BUILTIN(__builtin_arm_crc32d, "UiUiLUi", "nc") BUILTIN(__builtin_arm_crc32cd, "UiUiLUi", "nc") // Memory barrier BUILTIN(__builtin_arm_dmb, "vUi", "nc") BUILTIN(__builtin_arm_dsb, "vUi", "nc") BUILTIN(__builtin_arm_isb, "vUi", "nc") // Prefetch BUILTIN(__builtin_arm_prefetch, "vvC*UiUiUiUi", "nc") // System Registers BUILTIN(__builtin_arm_rsr, "UicC*", "nc") BUILTIN(__builtin_arm_rsr64, "LUicC*", "nc") BUILTIN(__builtin_arm_rsrp, "v*cC*", "nc") BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/OperatorKinds.def
//===--- OperatorKinds.def - C++ Overloaded Operator Database ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the OverloadedOperator database, which includes // all of the overloadable C++ operators. // //===----------------------------------------------------------------------===// // /// @file OperatorKinds.def /// /// In this file, each of the overloadable C++ operators is enumerated /// with either the OVERLOADED_OPERATOR or OVERLOADED_OPERATOR_MULTI /// macro, each of which can be specified by the code including this /// file. OVERLOADED_OPERATOR is used for single-token operators /// (e.g., "+"), and has six arguments: /// /// Name: The name of the token. OO_Name will be the name of the /// corresponding enumerator in OverloadedOperatorKind in /// OperatorKinds.h. /// /// Spelling: A string that provides a canonical spelling for the /// operator, e.g., "operator+". /// /// Token: The name of the token that specifies the operator, e.g., /// "plus" for operator+ or "greatergreaterequal" for /// "operator>>=". With a "kw_" prefix, the token name can be used as /// an enumerator into the TokenKind enumeration. /// /// Unary: True if the operator can be declared as a unary operator. /// /// Binary: True if the operator can be declared as a binary /// operator. Note that some operators (e.g., "operator+" and /// "operator*") can be both unary and binary. /// /// MemberOnly: True if this operator can only be declared as a /// non-static member function. False if the operator can be both a /// non-member function and a non-static member function. /// /// OVERLOADED_OPERATOR_MULTI is used to enumerate the multi-token /// overloaded operator names, e.g., "operator delete []". The macro /// has all of the parameters of OVERLOADED_OPERATOR except Token, /// which is omitted. #ifndef OVERLOADED_OPERATOR # define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) #endif #ifndef OVERLOADED_OPERATOR_MULTI # define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly) \ OVERLOADED_OPERATOR(Name,Spelling,unknown,Unary,Binary,MemberOnly) #endif OVERLOADED_OPERATOR_MULTI(New , "new" , true , true , false) OVERLOADED_OPERATOR_MULTI(Delete , "delete" , true , true , false) OVERLOADED_OPERATOR_MULTI(Array_New , "new[]" , true , true , false) OVERLOADED_OPERATOR_MULTI(Array_Delete , "delete[]" , true , true , false) OVERLOADED_OPERATOR(Plus , "+" , plus , true , true , false) OVERLOADED_OPERATOR(Minus , "-" , minus , true , true , false) OVERLOADED_OPERATOR(Star , "*" , star , true , true , false) OVERLOADED_OPERATOR(Slash , "/" , slash , false, true , false) OVERLOADED_OPERATOR(Percent , "%" , percent , false, true , false) OVERLOADED_OPERATOR(Caret , "^" , caret , false, true , false) OVERLOADED_OPERATOR(Amp , "&" , amp , true , true , false) OVERLOADED_OPERATOR(Pipe , "|" , pipe , false, true , false) OVERLOADED_OPERATOR(Tilde , "~" , tilde , true , false, false) OVERLOADED_OPERATOR(Exclaim , "!" , exclaim , true , false, false) OVERLOADED_OPERATOR(Equal , "=" , equal , false, true , true) OVERLOADED_OPERATOR(Less , "<" , less , false, true , false) OVERLOADED_OPERATOR(Greater , ">" , greater , false, true , false) OVERLOADED_OPERATOR(PlusEqual , "+=" , plusequal , false, true , false) OVERLOADED_OPERATOR(MinusEqual , "-=" , minusequal , false, true , false) OVERLOADED_OPERATOR(StarEqual , "*=" , starequal , false, true , false) OVERLOADED_OPERATOR(SlashEqual , "/=" , slashequal , false, true , false) OVERLOADED_OPERATOR(PercentEqual , "%=" , percentequal , false, true , false) OVERLOADED_OPERATOR(CaretEqual , "^=" , caretequal , false, true , false) OVERLOADED_OPERATOR(AmpEqual , "&=" , ampequal , false, true , false) OVERLOADED_OPERATOR(PipeEqual , "|=" , pipeequal , false, true , false) OVERLOADED_OPERATOR(LessLess , "<<" , lessless , false, true , false) OVERLOADED_OPERATOR(GreaterGreater , ">>" , greatergreater , false, true , false) OVERLOADED_OPERATOR(LessLessEqual , "<<=" , lesslessequal , false, true , false) OVERLOADED_OPERATOR(GreaterGreaterEqual , ">>=" , greatergreaterequal, false, true , false) OVERLOADED_OPERATOR(EqualEqual , "==" , equalequal , false, true , false) OVERLOADED_OPERATOR(ExclaimEqual , "!=" , exclaimequal , false, true , false) OVERLOADED_OPERATOR(LessEqual , "<=" , lessequal , false, true , false) OVERLOADED_OPERATOR(GreaterEqual , ">=" , greaterequal , false, true , false) OVERLOADED_OPERATOR(AmpAmp , "&&" , ampamp , false, true , false) OVERLOADED_OPERATOR(PipePipe , "||" , pipepipe , false, true , false) OVERLOADED_OPERATOR(PlusPlus , "++" , plusplus , true , true , false) OVERLOADED_OPERATOR(MinusMinus , "--" , minusminus , true , true , false) OVERLOADED_OPERATOR(Comma , "," , comma , false, true , false) OVERLOADED_OPERATOR(ArrowStar , "->*" , arrowstar , false, true , false) OVERLOADED_OPERATOR(Arrow , "->" , arrow , true , false, true) OVERLOADED_OPERATOR_MULTI(Call , "()" , true , true , true) OVERLOADED_OPERATOR_MULTI(Subscript , "[]" , false, true , true) // ?: can *not* be overloaded, but we need the overload // resolution machinery for it. OVERLOADED_OPERATOR_MULTI(Conditional , "?" , false, true , false) #undef OVERLOADED_OPERATOR_MULTI #undef OVERLOADED_OPERATOR
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/SanitizerBlacklist.h
//===--- SanitizerBlacklist.h - Blacklist for sanitizers --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // User-provided blacklist used to disable/alter instrumentation done in // sanitizers. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H #define LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/SpecialCaseList.h" #include <memory> namespace clang { class SanitizerBlacklist { std::unique_ptr<llvm::SpecialCaseList> SCL; SourceManager &SM; public: SanitizerBlacklist(const std::vector<std::string> &BlacklistPaths, SourceManager &SM); bool isBlacklistedGlobal(StringRef GlobalName, StringRef Category = StringRef()) const; bool isBlacklistedType(StringRef MangledTypeName, StringRef Category = StringRef()) const; bool isBlacklistedFunction(StringRef FunctionName) const; bool isBlacklistedFile(StringRef FileName, StringRef Category = StringRef()) const; bool isBlacklistedLocation(SourceLocation Loc, StringRef Category = StringRef()) const; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Visibility.h
//===--- Visibility.h - Visibility enumeration and utilities ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::Visibility enumeration and various utility /// functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_VISIBILITY_H #define LLVM_CLANG_BASIC_VISIBILITY_H #include "clang/Basic/Linkage.h" namespace clang { /// \brief Describes the different kinds of visibility that a declaration /// may have. /// /// Visibility determines how a declaration interacts with the dynamic /// linker. It may also affect whether the symbol can be found by runtime /// symbol lookup APIs. /// /// Visibility is not described in any language standard and /// (nonetheless) sometimes has odd behavior. Not all platforms /// support all visibility kinds. enum Visibility { /// Objects with "hidden" visibility are not seen by the dynamic /// linker. HiddenVisibility, /// Objects with "protected" visibility are seen by the dynamic /// linker but always dynamically resolve to an object within this /// shared object. ProtectedVisibility, /// Objects with "default" visibility are seen by the dynamic linker /// and act like normal objects. DefaultVisibility }; inline Visibility minVisibility(Visibility L, Visibility R) { return L < R ? L : R; } class LinkageInfo { uint8_t linkage_ : 3; uint8_t visibility_ : 2; uint8_t explicit_ : 1; void setVisibility(Visibility V, bool E) { visibility_ = V; explicit_ = E; } public: LinkageInfo() : linkage_(ExternalLinkage), visibility_(DefaultVisibility), explicit_(false) {} LinkageInfo(Linkage L, Visibility V, bool E) : linkage_(L), visibility_(V), explicit_(E) { assert(getLinkage() == L && getVisibility() == V && isVisibilityExplicit() == E && "Enum truncated!"); } static LinkageInfo external() { return LinkageInfo(); } static LinkageInfo internal() { return LinkageInfo(InternalLinkage, DefaultVisibility, false); } static LinkageInfo uniqueExternal() { return LinkageInfo(UniqueExternalLinkage, DefaultVisibility, false); } static LinkageInfo none() { return LinkageInfo(NoLinkage, DefaultVisibility, false); } Linkage getLinkage() const { return (Linkage)linkage_; } Visibility getVisibility() const { return (Visibility)visibility_; } bool isVisibilityExplicit() const { return explicit_; } void setLinkage(Linkage L) { linkage_ = L; } void mergeLinkage(Linkage L) { setLinkage(minLinkage(getLinkage(), L)); } void mergeLinkage(LinkageInfo other) { mergeLinkage(other.getLinkage()); } void mergeExternalVisibility(Linkage L) { Linkage ThisL = getLinkage(); if (!isExternallyVisible(L)) { if (ThisL == VisibleNoLinkage) ThisL = NoLinkage; else if (ThisL == ExternalLinkage) ThisL = UniqueExternalLinkage; } setLinkage(ThisL); } void mergeExternalVisibility(LinkageInfo Other) { mergeExternalVisibility(Other.getLinkage()); } /// Merge in the visibility 'newVis'. void mergeVisibility(Visibility newVis, bool newExplicit) { Visibility oldVis = getVisibility(); // Never increase visibility. if (oldVis < newVis) return; // If the new visibility is the same as the old and the new // visibility isn't explicit, we have nothing to add. if (oldVis == newVis && !newExplicit) return; // Otherwise, we're either decreasing visibility or making our // existing visibility explicit. setVisibility(newVis, newExplicit); } void mergeVisibility(LinkageInfo other) { mergeVisibility(other.getVisibility(), other.isVisibilityExplicit()); } /// Merge both linkage and visibility. void merge(LinkageInfo other) { mergeLinkage(other); mergeVisibility(other); } /// Merge linkage and conditionally merge visibility. void mergeMaybeWithVisibility(LinkageInfo other, bool withVis) { mergeLinkage(other); if (withVis) mergeVisibility(other); } }; } #endif // LLVM_CLANG_BASIC_VISIBILITY_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsX86.def
//===--- BuiltinsX86.def - X86 Builtin function database --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the X86-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // FIXME: In GCC, these builtins are defined depending on whether support for // MMX/SSE/etc is turned on. We should do this too. // FIXME: Ideally we would be able to pull this information from what // LLVM already knows about X86 builtins. We need to match the LLVM // definition anyway, since code generation will lower to the // intrinsic if one exists. // FIXME: Are these nothrow/const? // Miscellaneous builtin for checking x86 cpu features. // TODO: Make this somewhat generic so that other backends // can use it? BUILTIN(__builtin_cpu_supports, "bcC*", "nc") // 3DNow! // BUILTIN(__builtin_ia32_femms, "v", "") BUILTIN(__builtin_ia32_pavgusb, "V8cV8cV8c", "nc") BUILTIN(__builtin_ia32_pf2id, "V2iV2f", "nc") BUILTIN(__builtin_ia32_pfacc, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfadd, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfcmpeq, "V2iV2fV2f", "nc") BUILTIN(__builtin_ia32_pfcmpge, "V2iV2fV2f", "nc") BUILTIN(__builtin_ia32_pfcmpgt, "V2iV2fV2f", "nc") BUILTIN(__builtin_ia32_pfmax, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfmin, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfmul, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfrcp, "V2fV2f", "nc") BUILTIN(__builtin_ia32_pfrcpit1, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfrcpit2, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfrsqrt, "V2fV2f", "nc") BUILTIN(__builtin_ia32_pfrsqit1, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfsub, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfsubr, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pi2fd, "V2fV2i", "nc") BUILTIN(__builtin_ia32_pmulhrw, "V4sV4sV4s", "nc") // 3DNow! Extensions (3dnowa). BUILTIN(__builtin_ia32_pf2iw, "V2iV2f", "nc") BUILTIN(__builtin_ia32_pfnacc, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfpnacc, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pi2fw, "V2fV2i", "nc") BUILTIN(__builtin_ia32_pswapdsf, "V2fV2f", "nc") BUILTIN(__builtin_ia32_pswapdsi, "V2iV2i", "nc") // MMX // // All MMX instructions will be generated via builtins. Any MMX vector // types (<1 x i64>, <2 x i32>, etc.) that aren't used by these builtins will be // expanded by the back-end. // FIXME: _mm_prefetch must be a built-in because it takes a compile-time constant // argument and our prior approach of using a #define to the current built-in // doesn't work in the presence of re-declaration of _mm_prefetch for windows. BUILTIN(_mm_prefetch, "vcC*i", "nc") BUILTIN(__builtin_ia32_emms, "v", "") BUILTIN(__builtin_ia32_paddb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_paddw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_paddd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_paddsb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_paddsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_paddusb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_paddusw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psubb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_psubw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psubd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_psubsb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_psubsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psubusb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_psubusw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pmulhw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pmullw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pmaddwd, "V2iV4sV4s", "") BUILTIN(__builtin_ia32_pand, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_pandn, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_por, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_pxor, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_psllw, "V4sV4sV1LLi", "") BUILTIN(__builtin_ia32_pslld, "V2iV2iV1LLi", "") BUILTIN(__builtin_ia32_psllq, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_psrlw, "V4sV4sV1LLi", "") BUILTIN(__builtin_ia32_psrld, "V2iV2iV1LLi", "") BUILTIN(__builtin_ia32_psrlq, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_psraw, "V4sV4sV1LLi", "") BUILTIN(__builtin_ia32_psrad, "V2iV2iV1LLi", "") BUILTIN(__builtin_ia32_psllwi, "V4sV4si", "") BUILTIN(__builtin_ia32_pslldi, "V2iV2ii", "") BUILTIN(__builtin_ia32_psllqi, "V1LLiV1LLii", "") BUILTIN(__builtin_ia32_psrlwi, "V4sV4si", "") BUILTIN(__builtin_ia32_psrldi, "V2iV2ii", "") BUILTIN(__builtin_ia32_psrlqi, "V1LLiV1LLii", "") BUILTIN(__builtin_ia32_psrawi, "V4sV4si", "") BUILTIN(__builtin_ia32_psradi, "V2iV2ii", "") BUILTIN(__builtin_ia32_packsswb, "V8cV4sV4s", "") BUILTIN(__builtin_ia32_packssdw, "V4sV2iV2i", "") BUILTIN(__builtin_ia32_packuswb, "V8cV4sV4s", "") BUILTIN(__builtin_ia32_punpckhbw, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_punpckhwd, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_punpckhdq, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_punpcklbw, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_punpcklwd, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_punpckldq, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_pcmpeqb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_pcmpeqw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pcmpeqd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_pcmpgtb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_pcmpgtw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pcmpgtd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_maskmovq, "vV8cV8cc*", "") BUILTIN(__builtin_ia32_movntq, "vV1LLi*V1LLi", "") BUILTIN(__builtin_ia32_vec_init_v2si, "V2iii", "") BUILTIN(__builtin_ia32_vec_init_v4hi, "V4sssss", "") BUILTIN(__builtin_ia32_vec_init_v8qi, "V8ccccccccc", "") BUILTIN(__builtin_ia32_vec_ext_v2si, "iV2ii", "") // MMX2 (MMX+SSE) intrinsics BUILTIN(__builtin_ia32_cvtpi2ps, "V4fV4fV2i", "") BUILTIN(__builtin_ia32_cvtps2pi, "V2iV4f", "") BUILTIN(__builtin_ia32_cvttps2pi, "V2iV4f", "") BUILTIN(__builtin_ia32_pavgb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_pavgw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pmaxsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pmaxub, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_pminsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pminub, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_pmovmskb, "iV8c", "") BUILTIN(__builtin_ia32_pmulhuw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psadbw, "V4sV8cV8c", "") BUILTIN(__builtin_ia32_pshufw, "V4sV4sIc", "") // MMX+SSE2 BUILTIN(__builtin_ia32_cvtpd2pi, "V2iV2d", "") BUILTIN(__builtin_ia32_cvtpi2pd, "V2dV2i", "") BUILTIN(__builtin_ia32_cvttpd2pi, "V2iV2d", "") BUILTIN(__builtin_ia32_paddq, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_pmuludq, "V1LLiV2iV2i", "") BUILTIN(__builtin_ia32_psubq, "V1LLiV1LLiV1LLi", "") // MMX+SSSE3 BUILTIN(__builtin_ia32_pabsb, "V8cV8c", "") BUILTIN(__builtin_ia32_pabsd, "V2iV2i", "") BUILTIN(__builtin_ia32_pabsw, "V4sV4s", "") BUILTIN(__builtin_ia32_palignr, "V8cV8cV8cIc", "") BUILTIN(__builtin_ia32_phaddd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_phaddsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_phaddw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_phsubd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_phsubsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_phsubw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pmaddubsw, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_pmulhrsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_pshufb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_psignw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psignb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_psignd, "V2iV2iV2i", "") // SSE intrinsics. BUILTIN(__builtin_ia32_comieq, "iV4fV4f", "") BUILTIN(__builtin_ia32_comilt, "iV4fV4f", "") BUILTIN(__builtin_ia32_comile, "iV4fV4f", "") BUILTIN(__builtin_ia32_comigt, "iV4fV4f", "") BUILTIN(__builtin_ia32_comige, "iV4fV4f", "") BUILTIN(__builtin_ia32_comineq, "iV4fV4f", "") BUILTIN(__builtin_ia32_ucomieq, "iV4fV4f", "") BUILTIN(__builtin_ia32_ucomilt, "iV4fV4f", "") BUILTIN(__builtin_ia32_ucomile, "iV4fV4f", "") BUILTIN(__builtin_ia32_ucomigt, "iV4fV4f", "") BUILTIN(__builtin_ia32_ucomige, "iV4fV4f", "") BUILTIN(__builtin_ia32_ucomineq, "iV4fV4f", "") BUILTIN(__builtin_ia32_comisdeq, "iV2dV2d", "") BUILTIN(__builtin_ia32_comisdlt, "iV2dV2d", "") BUILTIN(__builtin_ia32_comisdle, "iV2dV2d", "") BUILTIN(__builtin_ia32_comisdgt, "iV2dV2d", "") BUILTIN(__builtin_ia32_comisdge, "iV2dV2d", "") BUILTIN(__builtin_ia32_comisdneq, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdeq, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdlt, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdle, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdgt, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdge, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdneq, "iV2dV2d", "") BUILTIN(__builtin_ia32_cmpps, "V4fV4fV4fIc", "") BUILTIN(__builtin_ia32_cmpeqps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpltps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpleps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpunordps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpneqps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpnltps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpnleps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpordps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpss, "V4fV4fV4fIc", "") BUILTIN(__builtin_ia32_cmpeqss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpltss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpless, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpunordss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpneqss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpnltss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpnless, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpordss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_minps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_maxps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_minss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_maxss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmppd, "V2dV2dV2dIc", "") BUILTIN(__builtin_ia32_cmpeqpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpltpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmplepd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpunordpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpneqpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpnltpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpnlepd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpordpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpsd, "V2dV2dV2dIc", "") BUILTIN(__builtin_ia32_cmpeqsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpltsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmplesd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpunordsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpneqsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpnltsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpnlesd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpordsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_minpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_maxpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_minsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_maxsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_paddsb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_paddsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psubsb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_psubsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_paddusb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_paddusw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psubusb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_psubusw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pmulhw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pavgb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pavgw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pmaxub128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pmaxsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pminub128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pminsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_packsswb128, "V16cV8sV8s", "") BUILTIN(__builtin_ia32_packssdw128, "V8sV4iV4i", "") BUILTIN(__builtin_ia32_packuswb128, "V16cV8sV8s", "") BUILTIN(__builtin_ia32_pmulhuw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_addsubps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_addsubpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_haddps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_haddpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_hsubps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_hsubpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_phaddw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_phaddd128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_phaddsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_phsubw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_phsubd128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_phsubsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pmaddubsw128, "V8sV16cV16c", "") BUILTIN(__builtin_ia32_pmulhrsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pshufb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_psignb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_psignw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psignd128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_pabsb128, "V16cV16c", "") BUILTIN(__builtin_ia32_pabsw128, "V8sV8s", "") BUILTIN(__builtin_ia32_pabsd128, "V4iV4i", "") BUILTIN(__builtin_ia32_ldmxcsr, "vUi", "") BUILTIN(__builtin_ia32_stmxcsr, "Ui", "") BUILTIN(__builtin_ia32_cvtss2si, "iV4f", "") BUILTIN(__builtin_ia32_cvtss2si64, "LLiV4f", "") BUILTIN(__builtin_ia32_storeups, "vf*V4f", "") BUILTIN(__builtin_ia32_storehps, "vV2i*V4f", "") BUILTIN(__builtin_ia32_storelps, "vV2i*V4f", "") BUILTIN(__builtin_ia32_movmskps, "iV4f", "") BUILTIN(__builtin_ia32_movntps, "vf*V4f", "") BUILTIN(__builtin_ia32_sfence, "v", "") BUILTIN(__builtin_ia32_rcpps, "V4fV4f", "") BUILTIN(__builtin_ia32_rcpss, "V4fV4f", "") BUILTIN(__builtin_ia32_rsqrtps, "V4fV4f", "") BUILTIN(__builtin_ia32_rsqrtss, "V4fV4f", "") BUILTIN(__builtin_ia32_sqrtps, "V4fV4f", "") BUILTIN(__builtin_ia32_sqrtss, "V4fV4f", "") BUILTIN(__builtin_ia32_maskmovdqu, "vV16cV16cc*", "") BUILTIN(__builtin_ia32_storeupd, "vd*V2d", "") BUILTIN(__builtin_ia32_movmskpd, "iV2d", "") BUILTIN(__builtin_ia32_pmovmskb128, "iV16c", "") BUILTIN(__builtin_ia32_movnti, "vi*i", "") BUILTIN(__builtin_ia32_movnti64, "vLLi*LLi", "") BUILTIN(__builtin_ia32_movntpd, "vd*V2d", "") BUILTIN(__builtin_ia32_movntdq, "vV2LLi*V2LLi", "") BUILTIN(__builtin_ia32_psadbw128, "V2LLiV16cV16c", "") BUILTIN(__builtin_ia32_sqrtpd, "V2dV2d", "") BUILTIN(__builtin_ia32_sqrtsd, "V2dV2d", "") BUILTIN(__builtin_ia32_cvtdq2pd, "V2dV4i", "") BUILTIN(__builtin_ia32_cvtdq2ps, "V4fV4i", "") BUILTIN(__builtin_ia32_cvtpd2dq, "V2LLiV2d", "") BUILTIN(__builtin_ia32_cvtpd2ps, "V4fV2d", "") BUILTIN(__builtin_ia32_cvttpd2dq, "V4iV2d", "") BUILTIN(__builtin_ia32_cvtsd2si, "iV2d", "") BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "") BUILTIN(__builtin_ia32_cvtps2dq, "V4iV4f", "") BUILTIN(__builtin_ia32_cvtps2pd, "V2dV4f", "") BUILTIN(__builtin_ia32_cvttps2dq, "V4iV4f", "") BUILTIN(__builtin_ia32_clflush, "vvC*", "") BUILTIN(__builtin_ia32_lfence, "v", "") BUILTIN(__builtin_ia32_mfence, "v", "") BUILTIN(__builtin_ia32_storedqu, "vc*V16c", "") BUILTIN(__builtin_ia32_pmuludq128, "V2LLiV4iV4i", "") BUILTIN(__builtin_ia32_psraw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psrad128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psrlw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psrld128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psrlq128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_psllw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pslld128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psllq128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_psllwi128, "V8sV8si", "") BUILTIN(__builtin_ia32_pslldi128, "V4iV4ii", "") BUILTIN(__builtin_ia32_psllqi128, "V2LLiV2LLii", "") BUILTIN(__builtin_ia32_psrlwi128, "V8sV8si", "") BUILTIN(__builtin_ia32_psrldi128, "V4iV4ii", "") BUILTIN(__builtin_ia32_psrlqi128, "V2LLiV2LLii", "") BUILTIN(__builtin_ia32_psrawi128, "V8sV8si", "") BUILTIN(__builtin_ia32_psradi128, "V4iV4ii", "") BUILTIN(__builtin_ia32_pmaddwd128, "V4iV8sV8s", "") BUILTIN(__builtin_ia32_monitor, "vv*UiUi", "") BUILTIN(__builtin_ia32_mwait, "vUiUi", "") BUILTIN(__builtin_ia32_lddqu, "V16ccC*", "") BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cIc", "") BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fIc", "") BUILTIN(__builtin_ia32_pblendvb128, "V16cV16cV16cV16c", "") BUILTIN(__builtin_ia32_blendvpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_blendvps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_packusdw128, "V8sV4iV4i", "") BUILTIN(__builtin_ia32_pmaxsb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pmaxsd128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_pmaxud128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_pmaxuw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pminsb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pminsd128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_pminud128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_pminuw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pmovsxbd128, "V4iV16c", "") BUILTIN(__builtin_ia32_pmovsxbq128, "V2LLiV16c", "") BUILTIN(__builtin_ia32_pmovsxbw128, "V8sV16c", "") BUILTIN(__builtin_ia32_pmovsxdq128, "V2LLiV4i", "") BUILTIN(__builtin_ia32_pmovsxwd128, "V4iV8s", "") BUILTIN(__builtin_ia32_pmovsxwq128, "V2LLiV8s", "") BUILTIN(__builtin_ia32_pmovzxbd128, "V4iV16c", "") BUILTIN(__builtin_ia32_pmovzxbq128, "V2LLiV16c", "") BUILTIN(__builtin_ia32_pmovzxbw128, "V8sV16c", "") BUILTIN(__builtin_ia32_pmovzxdq128, "V2LLiV4i", "") BUILTIN(__builtin_ia32_pmovzxwd128, "V4iV8s", "") BUILTIN(__builtin_ia32_pmovzxwq128, "V2LLiV8s", "") BUILTIN(__builtin_ia32_pmuldq128, "V2LLiV4iV4i", "") BUILTIN(__builtin_ia32_pmulld128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_roundps, "V4fV4fi", "") BUILTIN(__builtin_ia32_roundss, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_roundsd, "V2dV2dV2di", "") BUILTIN(__builtin_ia32_roundpd, "V2dV2di", "") BUILTIN(__builtin_ia32_dpps, "V4fV4fV4fIc", "") BUILTIN(__builtin_ia32_dppd, "V2dV2dV2dIc", "") BUILTIN(__builtin_ia32_movntdqa, "V2LLiV2LLi*", "") BUILTIN(__builtin_ia32_ptestz128, "iV2LLiV2LLi", "") BUILTIN(__builtin_ia32_ptestc128, "iV2LLiV2LLi", "") BUILTIN(__builtin_ia32_ptestnzc128, "iV2LLiV2LLi", "") BUILTIN(__builtin_ia32_mpsadbw128, "V16cV16cV16cIc", "") BUILTIN(__builtin_ia32_phminposuw128, "V8sV8s", "") // SSE 4.2 BUILTIN(__builtin_ia32_pcmpistrm128, "V16cV16cV16cIc", "") BUILTIN(__builtin_ia32_pcmpistri128, "iV16cV16cIc", "") BUILTIN(__builtin_ia32_pcmpestrm128, "V16cV16ciV16ciIc", "") BUILTIN(__builtin_ia32_pcmpestri128, "iV16ciV16ciIc","") BUILTIN(__builtin_ia32_pcmpistria128, "iV16cV16cIc","") BUILTIN(__builtin_ia32_pcmpistric128, "iV16cV16cIc","") BUILTIN(__builtin_ia32_pcmpistrio128, "iV16cV16cIc","") BUILTIN(__builtin_ia32_pcmpistris128, "iV16cV16cIc","") BUILTIN(__builtin_ia32_pcmpistriz128, "iV16cV16cIc","") BUILTIN(__builtin_ia32_pcmpestria128, "iV16ciV16ciIc","") BUILTIN(__builtin_ia32_pcmpestric128, "iV16ciV16ciIc","") BUILTIN(__builtin_ia32_pcmpestrio128, "iV16ciV16ciIc","") BUILTIN(__builtin_ia32_pcmpestris128, "iV16ciV16ciIc","") BUILTIN(__builtin_ia32_pcmpestriz128, "iV16ciV16ciIc","") BUILTIN(__builtin_ia32_crc32qi, "UiUiUc", "") BUILTIN(__builtin_ia32_crc32hi, "UiUiUs", "") BUILTIN(__builtin_ia32_crc32si, "UiUiUi", "") BUILTIN(__builtin_ia32_crc32di, "ULLiULLiULLi", "") // SSE4a BUILTIN(__builtin_ia32_extrqi, "V2LLiV2LLiIcIc", "") BUILTIN(__builtin_ia32_extrq, "V2LLiV2LLiV16c", "") BUILTIN(__builtin_ia32_insertqi, "V2LLiV2LLiV2LLiIcIc", "") BUILTIN(__builtin_ia32_insertq, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_movntsd, "vd*V2d", "") BUILTIN(__builtin_ia32_movntss, "vf*V4f", "") // AES BUILTIN(__builtin_ia32_aesenc128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_aesenclast128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_aesdec128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_aesdeclast128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_aesimc128, "V2LLiV2LLi", "") BUILTIN(__builtin_ia32_aeskeygenassist128, "V2LLiV2LLiIc", "") // CLMUL BUILTIN(__builtin_ia32_pclmulqdq128, "V2LLiV2LLiV2LLiIc", "") // AVX BUILTIN(__builtin_ia32_addsubpd256, "V4dV4dV4d", "") BUILTIN(__builtin_ia32_addsubps256, "V8fV8fV8f", "") BUILTIN(__builtin_ia32_haddpd256, "V4dV4dV4d", "") BUILTIN(__builtin_ia32_hsubps256, "V8fV8fV8f", "") BUILTIN(__builtin_ia32_hsubpd256, "V4dV4dV4d", "") BUILTIN(__builtin_ia32_haddps256, "V8fV8fV8f", "") BUILTIN(__builtin_ia32_maxpd256, "V4dV4dV4d", "") BUILTIN(__builtin_ia32_maxps256, "V8fV8fV8f", "") BUILTIN(__builtin_ia32_minpd256, "V4dV4dV4d", "") BUILTIN(__builtin_ia32_minps256, "V8fV8fV8f", "") BUILTIN(__builtin_ia32_vpermilvarpd, "V2dV2dV2LLi", "") BUILTIN(__builtin_ia32_vpermilvarps, "V4fV4fV4i", "") BUILTIN(__builtin_ia32_vpermilvarpd256, "V4dV4dV4LLi", "") BUILTIN(__builtin_ia32_vpermilvarps256, "V8fV8fV8i", "") BUILTIN(__builtin_ia32_blendvpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_blendvps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fIc", "") BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dIc", "") BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fIc", "") BUILTIN(__builtin_ia32_cvtdq2pd256, "V4dV4i", "") BUILTIN(__builtin_ia32_cvtdq2ps256, "V8fV8i", "") BUILTIN(__builtin_ia32_cvtpd2ps256, "V4fV4d", "") BUILTIN(__builtin_ia32_cvtps2dq256, "V8iV8f", "") BUILTIN(__builtin_ia32_cvtps2pd256, "V4dV4f", "") BUILTIN(__builtin_ia32_cvttpd2dq256, "V4iV4d", "") BUILTIN(__builtin_ia32_cvtpd2dq256, "V4iV4d", "") BUILTIN(__builtin_ia32_cvttps2dq256, "V8iV8f", "") BUILTIN(__builtin_ia32_vperm2f128_pd256, "V4dV4dV4dIc", "") BUILTIN(__builtin_ia32_vperm2f128_ps256, "V8fV8fV8fIc", "") BUILTIN(__builtin_ia32_vperm2f128_si256, "V8iV8iV8iIc", "") BUILTIN(__builtin_ia32_sqrtpd256, "V4dV4d", "") BUILTIN(__builtin_ia32_sqrtps256, "V8fV8f", "") BUILTIN(__builtin_ia32_rsqrtps256, "V8fV8f", "") BUILTIN(__builtin_ia32_rcpps256, "V8fV8f", "") BUILTIN(__builtin_ia32_roundpd256, "V4dV4dIi", "") BUILTIN(__builtin_ia32_roundps256, "V8fV8fIi", "") BUILTIN(__builtin_ia32_vtestzpd, "iV2dV2d", "") BUILTIN(__builtin_ia32_vtestcpd, "iV2dV2d", "") BUILTIN(__builtin_ia32_vtestnzcpd, "iV2dV2d", "") BUILTIN(__builtin_ia32_vtestzps, "iV4fV4f", "") BUILTIN(__builtin_ia32_vtestcps, "iV4fV4f", "") BUILTIN(__builtin_ia32_vtestnzcps, "iV4fV4f", "") BUILTIN(__builtin_ia32_vtestzpd256, "iV4dV4d", "") BUILTIN(__builtin_ia32_vtestcpd256, "iV4dV4d", "") BUILTIN(__builtin_ia32_vtestnzcpd256, "iV4dV4d", "") BUILTIN(__builtin_ia32_vtestzps256, "iV8fV8f", "") BUILTIN(__builtin_ia32_vtestcps256, "iV8fV8f", "") BUILTIN(__builtin_ia32_vtestnzcps256, "iV8fV8f", "") BUILTIN(__builtin_ia32_ptestz256, "iV4LLiV4LLi", "") BUILTIN(__builtin_ia32_ptestc256, "iV4LLiV4LLi", "") BUILTIN(__builtin_ia32_ptestnzc256, "iV4LLiV4LLi", "") BUILTIN(__builtin_ia32_movmskpd256, "iV4d", "") BUILTIN(__builtin_ia32_movmskps256, "iV8f", "") BUILTIN(__builtin_ia32_vzeroall, "v", "") BUILTIN(__builtin_ia32_vzeroupper, "v", "") BUILTIN(__builtin_ia32_vbroadcastf128_pd256, "V4dV2dC*", "") BUILTIN(__builtin_ia32_vbroadcastf128_ps256, "V8fV4fC*", "") BUILTIN(__builtin_ia32_storeupd256, "vd*V4d", "") BUILTIN(__builtin_ia32_storeups256, "vf*V8f", "") BUILTIN(__builtin_ia32_storedqu256, "vc*V32c", "") BUILTIN(__builtin_ia32_lddqu256, "V32ccC*", "") BUILTIN(__builtin_ia32_movntdq256, "vV4LLi*V4LLi", "") BUILTIN(__builtin_ia32_movntpd256, "vd*V4d", "") BUILTIN(__builtin_ia32_movntps256, "vf*V8f", "") BUILTIN(__builtin_ia32_maskloadpd, "V2dV2dC*V2d", "") BUILTIN(__builtin_ia32_maskloadps, "V4fV4fC*V4f", "") BUILTIN(__builtin_ia32_maskloadpd256, "V4dV4dC*V4d", "") BUILTIN(__builtin_ia32_maskloadps256, "V8fV8fC*V8f", "") BUILTIN(__builtin_ia32_maskstorepd, "vV2d*V2dV2d", "") BUILTIN(__builtin_ia32_maskstoreps, "vV4f*V4fV4f", "") BUILTIN(__builtin_ia32_maskstorepd256, "vV4d*V4dV4d", "") BUILTIN(__builtin_ia32_maskstoreps256, "vV8f*V8fV8f", "") // AVX2 BUILTIN(__builtin_ia32_mpsadbw256, "V32cV32cV32cIc", "") BUILTIN(__builtin_ia32_pabsb256, "V32cV32c", "") BUILTIN(__builtin_ia32_pabsw256, "V16sV16s", "") BUILTIN(__builtin_ia32_pabsd256, "V8iV8i", "") BUILTIN(__builtin_ia32_packsswb256, "V32cV16sV16s", "") BUILTIN(__builtin_ia32_packssdw256, "V16sV8iV8i", "") BUILTIN(__builtin_ia32_packuswb256, "V32cV16sV16s", "") BUILTIN(__builtin_ia32_packusdw256, "V16sV8iV8i", "") BUILTIN(__builtin_ia32_paddsb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_paddsw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_psubsb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_psubsw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_paddusb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_paddusw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_psubusb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_psubusw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_palignr256, "V32cV32cV32cIc", "") BUILTIN(__builtin_ia32_pavgb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_pavgw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pblendvb256, "V32cV32cV32cV32c", "") BUILTIN(__builtin_ia32_phaddw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_phaddd256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_phaddsw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_phsubw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_phsubd256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_phsubsw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pmaddubsw256, "V16sV32cV32c", "") BUILTIN(__builtin_ia32_pmaddwd256, "V8iV16sV16s", "") BUILTIN(__builtin_ia32_pmaxub256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_pmaxuw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pmaxud256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_pmaxsb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_pmaxsw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pmaxsd256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_pminub256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_pminuw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pminud256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_pminsb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_pminsw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pminsd256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_pmovmskb256, "iV32c", "") BUILTIN(__builtin_ia32_pmovsxbw256, "V16sV16c", "") BUILTIN(__builtin_ia32_pmovsxbd256, "V8iV16c", "") BUILTIN(__builtin_ia32_pmovsxbq256, "V4LLiV16c", "") BUILTIN(__builtin_ia32_pmovsxwd256, "V8iV8s", "") BUILTIN(__builtin_ia32_pmovsxwq256, "V4LLiV8s", "") BUILTIN(__builtin_ia32_pmovsxdq256, "V4LLiV4i", "") BUILTIN(__builtin_ia32_pmovzxbw256, "V16sV16c", "") BUILTIN(__builtin_ia32_pmovzxbd256, "V8iV16c", "") BUILTIN(__builtin_ia32_pmovzxbq256, "V4LLiV16c", "") BUILTIN(__builtin_ia32_pmovzxwd256, "V8iV8s", "") BUILTIN(__builtin_ia32_pmovzxwq256, "V4LLiV8s", "") BUILTIN(__builtin_ia32_pmovzxdq256, "V4LLiV4i", "") BUILTIN(__builtin_ia32_pmuldq256, "V4LLiV8iV8i", "") BUILTIN(__builtin_ia32_pmulhrsw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pmulhuw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pmulhw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pmuludq256, "V4LLiV8iV8i", "") BUILTIN(__builtin_ia32_psadbw256, "V4LLiV32cV32c", "") BUILTIN(__builtin_ia32_pshufb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_psignb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_psignw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_psignd256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_pslldqi256, "V4LLiV4LLiIi", "") BUILTIN(__builtin_ia32_psllwi256, "V16sV16si", "") BUILTIN(__builtin_ia32_psllw256, "V16sV16sV8s", "") BUILTIN(__builtin_ia32_pslldi256, "V8iV8ii", "") BUILTIN(__builtin_ia32_pslld256, "V8iV8iV4i", "") BUILTIN(__builtin_ia32_psllqi256, "V4LLiV4LLii", "") BUILTIN(__builtin_ia32_psllq256, "V4LLiV4LLiV2LLi", "") BUILTIN(__builtin_ia32_psrawi256, "V16sV16si", "") BUILTIN(__builtin_ia32_psraw256, "V16sV16sV8s", "") BUILTIN(__builtin_ia32_psradi256, "V8iV8ii", "") BUILTIN(__builtin_ia32_psrad256, "V8iV8iV4i", "") BUILTIN(__builtin_ia32_psrldqi256, "V4LLiV4LLiIi", "") BUILTIN(__builtin_ia32_psrlwi256, "V16sV16si", "") BUILTIN(__builtin_ia32_psrlw256, "V16sV16sV8s", "") BUILTIN(__builtin_ia32_psrldi256, "V8iV8ii", "") BUILTIN(__builtin_ia32_psrld256, "V8iV8iV4i", "") BUILTIN(__builtin_ia32_psrlqi256, "V4LLiV4LLii", "") BUILTIN(__builtin_ia32_psrlq256, "V4LLiV4LLiV2LLi", "") BUILTIN(__builtin_ia32_movntdqa256, "V4LLiV4LLi*", "") BUILTIN(__builtin_ia32_vbroadcastss_ps, "V4fV4f", "") BUILTIN(__builtin_ia32_vbroadcastss_ps256, "V8fV4f", "") BUILTIN(__builtin_ia32_vbroadcastsd_pd256, "V4dV2d", "") BUILTIN(__builtin_ia32_pbroadcastb256, "V32cV16c", "") BUILTIN(__builtin_ia32_pbroadcastw256, "V16sV8s", "") BUILTIN(__builtin_ia32_pbroadcastd256, "V8iV4i", "") BUILTIN(__builtin_ia32_pbroadcastq256, "V4LLiV2LLi", "") BUILTIN(__builtin_ia32_pbroadcastb128, "V16cV16c", "") BUILTIN(__builtin_ia32_pbroadcastw128, "V8sV8s", "") BUILTIN(__builtin_ia32_pbroadcastd128, "V4iV4i", "") BUILTIN(__builtin_ia32_pbroadcastq128, "V2LLiV2LLi", "") BUILTIN(__builtin_ia32_permvarsi256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_permvarsf256, "V8fV8fV8f", "") BUILTIN(__builtin_ia32_permti256, "V4LLiV4LLiV4LLiIc", "") BUILTIN(__builtin_ia32_maskloadd256, "V8iV8iC*V8i", "") BUILTIN(__builtin_ia32_maskloadq256, "V4LLiV4LLiC*V4LLi", "") BUILTIN(__builtin_ia32_maskloadd, "V4iV4iC*V4i", "") BUILTIN(__builtin_ia32_maskloadq, "V2LLiV2LLiC*V2LLi", "") BUILTIN(__builtin_ia32_maskstored256, "vV8i*V8iV8i", "") BUILTIN(__builtin_ia32_maskstoreq256, "vV4LLi*V4LLiV4LLi", "") BUILTIN(__builtin_ia32_maskstored, "vV4i*V4iV4i", "") BUILTIN(__builtin_ia32_maskstoreq, "vV2LLi*V2LLiV2LLi", "") BUILTIN(__builtin_ia32_psllv8si, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_psllv4si, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psllv4di, "V4LLiV4LLiV4LLi", "") BUILTIN(__builtin_ia32_psllv2di, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_psrav8si, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_psrav4si, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psrlv8si, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_psrlv4si, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psrlv4di, "V4LLiV4LLiV4LLi", "") BUILTIN(__builtin_ia32_psrlv2di, "V2LLiV2LLiV2LLi", "") // GATHER BUILTIN(__builtin_ia32_gatherd_pd, "V2dV2dV2dC*V4iV2dIc", "") BUILTIN(__builtin_ia32_gatherd_pd256, "V4dV4dV4dC*V4iV4dIc", "") BUILTIN(__builtin_ia32_gatherq_pd, "V2dV2dV2dC*V2LLiV2dIc", "") BUILTIN(__builtin_ia32_gatherq_pd256, "V4dV4dV4dC*V4LLiV4dIc", "") BUILTIN(__builtin_ia32_gatherd_ps, "V4fV4fV4fC*V4iV4fIc", "") BUILTIN(__builtin_ia32_gatherd_ps256, "V8fV8fV8fC*V8iV8fIc", "") BUILTIN(__builtin_ia32_gatherq_ps, "V4fV4fV4fC*V2LLiV4fIc", "") BUILTIN(__builtin_ia32_gatherq_ps256, "V4fV4fV4fC*V4LLiV4fIc", "") BUILTIN(__builtin_ia32_gatherd_q, "V2LLiV2LLiV2LLiC*V4iV2LLiIc", "") BUILTIN(__builtin_ia32_gatherd_q256, "V4LLiV4LLiV4LLiC*V4iV4LLiIc", "") BUILTIN(__builtin_ia32_gatherq_q, "V2LLiV2LLiV2LLiC*V2LLiV2LLiIc", "") BUILTIN(__builtin_ia32_gatherq_q256, "V4LLiV4LLiV4LLiC*V4LLiV4LLiIc", "") BUILTIN(__builtin_ia32_gatherd_d, "V4iV4iV4iC*V4iV4iIc", "") BUILTIN(__builtin_ia32_gatherd_d256, "V8iV8iV8iC*V8iV8iIc", "") BUILTIN(__builtin_ia32_gatherq_d, "V4iV4iV4iC*V2LLiV4iIc", "") BUILTIN(__builtin_ia32_gatherq_d256, "V4iV4iV4iC*V4LLiV4iIc", "") // F16C BUILTIN(__builtin_ia32_vcvtps2ph, "V8sV4fIi", "") BUILTIN(__builtin_ia32_vcvtps2ph256, "V8sV8fIi", "") BUILTIN(__builtin_ia32_vcvtps2ph512, "V16sV16fIi", "") BUILTIN(__builtin_ia32_vcvtph2ps, "V4fV8s", "") BUILTIN(__builtin_ia32_vcvtph2ps256, "V8fV8s", "") BUILTIN(__builtin_ia32_vcvtph2ps512, "V16fV16s", "") // RDRAND BUILTIN(__builtin_ia32_rdrand16_step, "UiUs*", "") BUILTIN(__builtin_ia32_rdrand32_step, "UiUi*", "") BUILTIN(__builtin_ia32_rdrand64_step, "UiULLi*", "") // FSGSBASE BUILTIN(__builtin_ia32_rdfsbase32, "Ui", "") BUILTIN(__builtin_ia32_rdfsbase64, "ULLi", "") BUILTIN(__builtin_ia32_rdgsbase32, "Ui", "") BUILTIN(__builtin_ia32_rdgsbase64, "ULLi", "") BUILTIN(__builtin_ia32_wrfsbase32, "vUi", "") BUILTIN(__builtin_ia32_wrfsbase64, "vULLi", "") BUILTIN(__builtin_ia32_wrgsbase32, "vUi", "") BUILTIN(__builtin_ia32_wrgsbase64, "vULLi", "") // FXSR BUILTIN(__builtin_ia32_fxrstor, "vv*", "") BUILTIN(__builtin_ia32_fxrstor64, "vv*", "") BUILTIN(__builtin_ia32_fxsave, "vv*", "") BUILTIN(__builtin_ia32_fxsave64, "vv*", "") // ADX BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "") BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "") BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "") BUILTIN(__builtin_ia32_addcarry_u64, "UcUcULLiULLiULLi*", "") BUILTIN(__builtin_ia32_subborrow_u32, "UcUcUiUiUi*", "") BUILTIN(__builtin_ia32_subborrow_u64, "UcUcULLiULLiULLi*", "") // RDSEED BUILTIN(__builtin_ia32_rdseed16_step, "UiUs*", "") BUILTIN(__builtin_ia32_rdseed32_step, "UiUi*", "") BUILTIN(__builtin_ia32_rdseed64_step, "UiULLi*", "") // BMI BUILTIN(__builtin_ia32_bextr_u32, "UiUiUi", "") BUILTIN(__builtin_ia32_bextr_u64, "ULLiULLiULLi", "") // BMI2 BUILTIN(__builtin_ia32_bzhi_si, "UiUiUi", "") BUILTIN(__builtin_ia32_bzhi_di, "ULLiULLiULLi", "") BUILTIN(__builtin_ia32_pdep_si, "UiUiUi", "") BUILTIN(__builtin_ia32_pdep_di, "ULLiULLiULLi", "") BUILTIN(__builtin_ia32_pext_si, "UiUiUi", "") BUILTIN(__builtin_ia32_pext_di, "ULLiULLiULLi", "") // TBM BUILTIN(__builtin_ia32_bextri_u32, "UiUiIUi", "") BUILTIN(__builtin_ia32_bextri_u64, "ULLiULLiIULLi", "") // SHA BUILTIN(__builtin_ia32_sha1rnds4, "V4iV4iV4iIc", "") BUILTIN(__builtin_ia32_sha1nexte, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_sha1msg1, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_sha1msg2, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_sha256rnds2, "V4iV4iV4iV4i", "") BUILTIN(__builtin_ia32_sha256msg1, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_sha256msg2, "V4iV4iV4i", "") // FMA BUILTIN(__builtin_ia32_vfmaddps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfmaddpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfmaddss, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfmaddsd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfmsubps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfmsubpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfmsubss, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfmsubsd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfnmaddps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfnmaddpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfnmaddss, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfnmaddsd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfnmsubps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfnmsubpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfnmsubss, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfnmsubsd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfmaddsubps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfmaddsubpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfmsubaddps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfmsubaddpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfmaddps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfmaddpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_vfmsubps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfmsubpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_vfnmaddps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfnmaddpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_vfnmsubps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfnmsubpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_vfmaddsubps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfmaddsubpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_vfmsubaddps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfmsubaddpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_vfmaddpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmaddpd128_mask3, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmaddpd128_maskz, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmaddpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmaddpd256_mask3, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmaddpd256_maskz, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmaddpd512_mask, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmaddpd512_mask3, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmaddpd512_maskz, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmaddps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmaddps128_mask3, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmaddps128_maskz, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmaddps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmaddps256_mask3, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmaddps256_maskz, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmaddps512_mask, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfmaddps512_mask3, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfmaddps512_maskz, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfmaddsubpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmaddsubpd128_mask3, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmaddsubpd128_maskz, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmaddsubpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmaddsubpd256_mask3, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmaddsubpd256_maskz, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmaddsubpd512_mask, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmaddsubpd512_mask3, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmaddsubpd512_maskz, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmaddsubps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmaddsubps128_mask3, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmaddsubps128_maskz, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmaddsubps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmaddsubps256_mask3, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmaddsubps256_maskz, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmaddsubps512_mask, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfmaddsubps512_mask3, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfmaddsubps512_maskz, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfmsubpd128_mask3, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmsubpd256_mask3, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmsubpd512_mask3, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmsubps128_mask3, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmsubps256_mask3, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmsubps512_mask3, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfmsubaddpd128_mask3, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfmsubaddpd256_mask3, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfmsubaddpd512_mask3, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfmsubaddps128_mask3, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfmsubaddps256_mask3, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfmsubaddps512_mask3, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfnmaddpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfnmaddpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfnmaddpd512_mask, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfnmaddps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfnmaddps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfnmaddps512_mask, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfnmsubpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfnmsubpd128_mask3, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_vfnmsubpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfnmsubpd256_mask3, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_vfnmsubpd512_mask, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfnmsubpd512_mask3, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_vfnmsubps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfnmsubps128_mask3, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_vfnmsubps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfnmsubps256_mask3, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_vfnmsubps512_mask, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_vfnmsubps512_mask3, "V16fV16fV16fV16fUsIi", "") // XOP BUILTIN(__builtin_ia32_vpmacssww, "V8sV8sV8sV8s", "") BUILTIN(__builtin_ia32_vpmacsww, "V8sV8sV8sV8s", "") BUILTIN(__builtin_ia32_vpmacsswd, "V4iV8sV8sV4i", "") BUILTIN(__builtin_ia32_vpmacswd, "V4iV8sV8sV4i", "") BUILTIN(__builtin_ia32_vpmacssdd, "V4iV4iV4iV4i", "") BUILTIN(__builtin_ia32_vpmacsdd, "V4iV4iV4iV4i", "") BUILTIN(__builtin_ia32_vpmacssdql, "V2LLiV4iV4iV2LLi", "") BUILTIN(__builtin_ia32_vpmacsdql, "V2LLiV4iV4iV2LLi", "") BUILTIN(__builtin_ia32_vpmacssdqh, "V2LLiV4iV4iV2LLi", "") BUILTIN(__builtin_ia32_vpmacsdqh, "V2LLiV4iV4iV2LLi", "") BUILTIN(__builtin_ia32_vpmadcsswd, "V4iV8sV8sV4i", "") BUILTIN(__builtin_ia32_vpmadcswd, "V4iV8sV8sV4i", "") BUILTIN(__builtin_ia32_vphaddbw, "V8sV16c", "") BUILTIN(__builtin_ia32_vphaddbd, "V4iV16c", "") BUILTIN(__builtin_ia32_vphaddbq, "V2LLiV16c", "") BUILTIN(__builtin_ia32_vphaddwd, "V4iV8s", "") BUILTIN(__builtin_ia32_vphaddwq, "V2LLiV8s", "") BUILTIN(__builtin_ia32_vphadddq, "V2LLiV4i", "") BUILTIN(__builtin_ia32_vphaddubw, "V8sV16c", "") BUILTIN(__builtin_ia32_vphaddubd, "V4iV16c", "") BUILTIN(__builtin_ia32_vphaddubq, "V2LLiV16c", "") BUILTIN(__builtin_ia32_vphadduwd, "V4iV8s", "") BUILTIN(__builtin_ia32_vphadduwq, "V2LLiV8s", "") BUILTIN(__builtin_ia32_vphaddudq, "V2LLiV4i", "") BUILTIN(__builtin_ia32_vphsubbw, "V8sV16c", "") BUILTIN(__builtin_ia32_vphsubwd, "V4iV8s", "") BUILTIN(__builtin_ia32_vphsubdq, "V2LLiV4i", "") BUILTIN(__builtin_ia32_vpcmov, "V2LLiV2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_vpcmov_256, "V4LLiV4LLiV4LLiV4LLi", "") BUILTIN(__builtin_ia32_vpperm, "V16cV16cV16cV16c", "") BUILTIN(__builtin_ia32_vprotb, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_vprotw, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_vprotd, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_vprotq, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_vprotbi, "V16cV16cIc", "") BUILTIN(__builtin_ia32_vprotwi, "V8sV8sIc", "") BUILTIN(__builtin_ia32_vprotdi, "V4iV4iIc", "") BUILTIN(__builtin_ia32_vprotqi, "V2LLiV2LLiIc", "") BUILTIN(__builtin_ia32_vpshlb, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_vpshlw, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_vpshld, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_vpshlq, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_vpshab, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_vpshaw, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_vpshad, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_vpshaq, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_vpcomub, "V16cV16cV16cIc", "") BUILTIN(__builtin_ia32_vpcomuw, "V8sV8sV8sIc", "") BUILTIN(__builtin_ia32_vpcomud, "V4iV4iV4iIc", "") BUILTIN(__builtin_ia32_vpcomuq, "V2LLiV2LLiV2LLiIc", "") BUILTIN(__builtin_ia32_vpcomb, "V16cV16cV16cIc", "") BUILTIN(__builtin_ia32_vpcomw, "V8sV8sV8sIc", "") BUILTIN(__builtin_ia32_vpcomd, "V4iV4iV4iIc", "") BUILTIN(__builtin_ia32_vpcomq, "V2LLiV2LLiV2LLiIc", "") BUILTIN(__builtin_ia32_vpermil2pd, "V2dV2dV2dV2LLiIc", "") BUILTIN(__builtin_ia32_vpermil2pd256, "V4dV4dV4dV4LLiIc", "") BUILTIN(__builtin_ia32_vpermil2ps, "V4fV4fV4fV4iIc", "") BUILTIN(__builtin_ia32_vpermil2ps256, "V8fV8fV8fV8iIc", "") BUILTIN(__builtin_ia32_vfrczss, "V4fV4f", "") BUILTIN(__builtin_ia32_vfrczsd, "V2dV2d", "") BUILTIN(__builtin_ia32_vfrczps, "V4fV4f", "") BUILTIN(__builtin_ia32_vfrczpd, "V2dV2d", "") BUILTIN(__builtin_ia32_vfrczps256, "V8fV8f", "") BUILTIN(__builtin_ia32_vfrczpd256, "V4dV4d", "") BUILTIN(__builtin_ia32_xbegin, "i", "") BUILTIN(__builtin_ia32_xend, "v", "") BUILTIN(__builtin_ia32_xabort, "vIc", "") BUILTIN(__builtin_ia32_xtest, "i", "") BUILTIN(__builtin_ia32_rdpmc, "ULLii", "") BUILTIN(__builtin_ia32_rdtsc, "ULLi", "") BUILTIN(__builtin_ia32_rdtscp, "ULLiUi*", "") // AVX-512 BUILTIN(__builtin_ia32_sqrtpd512_mask, "V8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_sqrtps512_mask, "V16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_rsqrt14sd_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_rsqrt14ss_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_rsqrt14pd512_mask, "V8dV8dV8dUc", "") BUILTIN(__builtin_ia32_rsqrt14ps512_mask, "V16fV16fV16fUs", "") BUILTIN(__builtin_ia32_rsqrt28sd_mask, "V2dV2dV2dV2dUcIi", "") BUILTIN(__builtin_ia32_rsqrt28ss_mask, "V4fV4fV4fV4fUcIi", "") BUILTIN(__builtin_ia32_rsqrt28pd_mask, "V8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_rsqrt28ps_mask, "V16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_rcp14sd_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_rcp14ss_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_rcp14pd512_mask, "V8dV8dV8dUc", "") BUILTIN(__builtin_ia32_rcp14ps512_mask, "V16fV16fV16fUs", "") BUILTIN(__builtin_ia32_rcp28sd_mask, "V2dV2dV2dV2dUcIi", "") BUILTIN(__builtin_ia32_rcp28ss_mask, "V4fV4fV4fV4fUcIi", "") BUILTIN(__builtin_ia32_rcp28pd_mask, "V8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_rcp28ps_mask, "V16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_exp2pd_mask, "V8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_exp2ps_mask, "V16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_cvttps2dq512_mask, "V16iV16fV16iUsIi", "") BUILTIN(__builtin_ia32_cvttps2udq512_mask, "V16iV16fV16iUsIi", "") BUILTIN(__builtin_ia32_cvttpd2dq512_mask, "V8iV8dV8iUcIi", "") BUILTIN(__builtin_ia32_cvttpd2udq512_mask, "V8iV8dV8iUcIi", "") BUILTIN(__builtin_ia32_cmpps512_mask, "UsV16fV16fIiUsIi", "") BUILTIN(__builtin_ia32_cmpps256_mask, "UcV8fV8fIiUc", "") BUILTIN(__builtin_ia32_cmpps128_mask, "UcV4fV4fIiUc", "") BUILTIN(__builtin_ia32_pcmpeqb512_mask, "LLiV64cV64cLLi", "") BUILTIN(__builtin_ia32_pcmpeqd512_mask, "sV16iV16is", "") BUILTIN(__builtin_ia32_pcmpeqq512_mask, "cV8LLiV8LLic", "") BUILTIN(__builtin_ia32_pcmpeqw512_mask, "iV32sV32si", "") BUILTIN(__builtin_ia32_pcmpeqb256_mask, "iV32cV32ci", "") BUILTIN(__builtin_ia32_pcmpeqd256_mask, "cV8iV8ic", "") BUILTIN(__builtin_ia32_pcmpeqq256_mask, "cV4LLiV4LLic", "") BUILTIN(__builtin_ia32_pcmpeqw256_mask, "sV16sV16ss", "") BUILTIN(__builtin_ia32_pcmpeqb128_mask, "sV16cV16cs", "") BUILTIN(__builtin_ia32_pcmpeqd128_mask, "cV4iV4ic", "") BUILTIN(__builtin_ia32_pcmpeqq128_mask, "cV2LLiV2LLic", "") BUILTIN(__builtin_ia32_pcmpeqw128_mask, "cV8sV8sc", "") BUILTIN(__builtin_ia32_pcmpgtb512_mask, "LLiV64cV64cLLi", "") BUILTIN(__builtin_ia32_pcmpgtd512_mask, "sV16iV16is", "") BUILTIN(__builtin_ia32_pcmpgtq512_mask, "cV8LLiV8LLic", "") BUILTIN(__builtin_ia32_pcmpgtw512_mask, "iV32sV32si", "") BUILTIN(__builtin_ia32_pcmpgtb256_mask, "iV32cV32ci", "") BUILTIN(__builtin_ia32_pcmpgtd256_mask, "cV8iV8ic", "") BUILTIN(__builtin_ia32_pcmpgtq256_mask, "cV4LLiV4LLic", "") BUILTIN(__builtin_ia32_pcmpgtw256_mask, "sV16sV16ss", "") BUILTIN(__builtin_ia32_pcmpgtb128_mask, "sV16cV16cs", "") BUILTIN(__builtin_ia32_pcmpgtd128_mask, "cV4iV4ic", "") BUILTIN(__builtin_ia32_pcmpgtq128_mask, "cV2LLiV2LLic", "") BUILTIN(__builtin_ia32_pcmpgtw128_mask, "cV8sV8sc", "") BUILTIN(__builtin_ia32_cmppd512_mask, "UcV8dV8dIiUcIi", "") BUILTIN(__builtin_ia32_cmppd256_mask, "UcV4dV4dIiUc", "") BUILTIN(__builtin_ia32_cmppd128_mask, "UcV2dV2dIiUc", "") BUILTIN(__builtin_ia32_rndscaleps_mask, "V16fV16fIiV16fUsIi", "") BUILTIN(__builtin_ia32_rndscalepd_mask, "V8dV8dIiV8dUcIi", "") BUILTIN(__builtin_ia32_cvtps2dq512_mask, "V16iV16fV16iUsIi", "") BUILTIN(__builtin_ia32_cvtpd2dq512_mask, "V8iV8dV8iUcIi", "") BUILTIN(__builtin_ia32_cvtps2udq512_mask, "V16iV16fV16iUsIi", "") BUILTIN(__builtin_ia32_cvtpd2udq512_mask, "V8iV8dV8iUcIi", "") BUILTIN(__builtin_ia32_minps512_mask, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_minpd512_mask, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_maxps512_mask, "V16fV16fV16fV16fUsIi", "") BUILTIN(__builtin_ia32_maxpd512_mask, "V8dV8dV8dV8dUcIi", "") BUILTIN(__builtin_ia32_cvtdq2ps512_mask, "V16fV16iV16fUsIi", "") BUILTIN(__builtin_ia32_cvtudq2ps512_mask, "V16fV16iV16fUsIi", "") BUILTIN(__builtin_ia32_cvtdq2pd512_mask, "V8dV8iV8dUc", "") BUILTIN(__builtin_ia32_cvtudq2pd512_mask, "V8dV8iV8dUc", "") BUILTIN(__builtin_ia32_cvtpd2ps512_mask, "V8fV8dV8fUcIi", "") BUILTIN(__builtin_ia32_vcvtps2ph512_mask, "V16sV16fIiV16sUs", "") BUILTIN(__builtin_ia32_vcvtph2ps512_mask, "V16fV16sV16fUsIi", "") BUILTIN(__builtin_ia32_pandd512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pandq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pord512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_porq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pxord512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pxorq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pabsd512_mask, "V16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pabsq512_mask, "V8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pmaxsd512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pmaxsq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pmaxud512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pmaxuq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pminsd512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pminsq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pminud512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pminuq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pmuldq512_mask, "V8LLiV16iV16iV8LLiUc", "") BUILTIN(__builtin_ia32_pmuludq512_mask, "V8LLiV16iV16iV8LLiUc", "") BUILTIN(__builtin_ia32_blendmd_512_mask, "V16iV16iV16iUs", "") BUILTIN(__builtin_ia32_blendmq_512_mask, "V8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_blendmps_512_mask, "V16fV16fV16fUs", "") BUILTIN(__builtin_ia32_blendmpd_512_mask, "V8dV8dV8dUc", "") BUILTIN(__builtin_ia32_ptestmd512, "UsV16iV16iUs", "") BUILTIN(__builtin_ia32_ptestmq512, "UcV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_pbroadcastd512_gpr_mask, "V16iiV16iUs", "") BUILTIN(__builtin_ia32_pbroadcastq512_gpr_mask, "V8LLiLLiV8LLiUc", "") BUILTIN(__builtin_ia32_pbroadcastq512_mem_mask, "V8LLiLLiV8LLiUc", "") BUILTIN(__builtin_ia32_loaddqusi512_mask, "V16ivC*V16iUs", "") BUILTIN(__builtin_ia32_loaddqudi512_mask, "V8LLivC*V8LLiUc", "") BUILTIN(__builtin_ia32_loadups512_mask, "V16fvC*V16fUs", "") BUILTIN(__builtin_ia32_loadaps512_mask, "V16fvC*V16fUs", "") BUILTIN(__builtin_ia32_loadupd512_mask, "V8dvC*V8dUc", "") BUILTIN(__builtin_ia32_loadapd512_mask, "V8dvC*V8dUc", "") BUILTIN(__builtin_ia32_storedqudi512_mask, "vv*V8LLiUc", "") BUILTIN(__builtin_ia32_storedqusi512_mask, "vv*V16iUs", "") BUILTIN(__builtin_ia32_storeupd512_mask, "vv*V8dUc", "") BUILTIN(__builtin_ia32_storeapd512_mask, "vv*V8dUc", "") BUILTIN(__builtin_ia32_storeups512_mask, "vv*V16fUs", "") BUILTIN(__builtin_ia32_storeaps512_mask, "vv*V16fUs", "") BUILTIN(__builtin_ia32_vpermt2vard512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_vpermt2varq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_vpermt2varps512_mask, "V16fV16iV16fV16fUs", "") BUILTIN(__builtin_ia32_vpermt2varpd512_mask, "V8dV8LLiV8dV8dUc", "") BUILTIN(__builtin_ia32_alignq512_mask, "V8LLiV8LLiV8LLiIcV8LLiUc", "") BUILTIN(__builtin_ia32_alignd512_mask, "V16iV16iV16iIcV16iUs", "") BUILTIN(__builtin_ia32_extractf64x4_mask, "V4dV8dIcV4dUc", "") BUILTIN(__builtin_ia32_extractf32x4_mask, "V4fV16fIcV4fUc", "") BUILTIN(__builtin_ia32_gathersiv8df, "V8dV8dvC*V8iUcIi", "") BUILTIN(__builtin_ia32_gathersiv16sf, "V16fV16fvC*UsIi", "") BUILTIN(__builtin_ia32_gatherdiv8df, "V8dV8dvC*V8LLiUcIi", "") BUILTIN(__builtin_ia32_gatherdiv16sf, "V8fV8fvC*V8LLiUcIi", "") BUILTIN(__builtin_ia32_gathersiv8di, "V8LLiV8LLivC*V8iUcIi", "") BUILTIN(__builtin_ia32_gathersiv16si, "V16iV16ivC*UsIi", "") BUILTIN(__builtin_ia32_gatherdiv8di, "V8LLiV8LLivC*V8LLiUcIi", "") BUILTIN(__builtin_ia32_gatherdiv16si, "V8iV8ivC*V8LLiUcIi", "") BUILTIN(__builtin_ia32_scattersiv8df, "vv*UcV8iV8dIi", "") BUILTIN(__builtin_ia32_scattersiv16sf, "vv*UsV16iV16fIi", "") BUILTIN(__builtin_ia32_scatterdiv8df, "vv*UcV8LLiV8dIi", "") BUILTIN(__builtin_ia32_scatterdiv16sf, "vv*UcV8LLiV8fIi", "") BUILTIN(__builtin_ia32_scattersiv8di, "vv*UcV8iV8LLiIi", "") BUILTIN(__builtin_ia32_scattersiv16si, "vv*UsV16iV16iIi", "") BUILTIN(__builtin_ia32_scatterdiv8di, "vv*UcV8LLiV8LLiIi", "") BUILTIN(__builtin_ia32_scatterdiv16si, "vv*UcV8LLiV8iIi", "") BUILTIN(__builtin_ia32_gatherpfdpd, "vUcV8ivC*IiIi", "") BUILTIN(__builtin_ia32_gatherpfdps, "vUsV16ivC*IiIi", "") BUILTIN(__builtin_ia32_gatherpfqpd, "vUcV8LLivC*IiIi", "") BUILTIN(__builtin_ia32_gatherpfqps, "vUcV8LLivC*IiIi", "") BUILTIN(__builtin_ia32_scatterpfdpd, "vUcV8iv*IiIi", "") BUILTIN(__builtin_ia32_scatterpfdps, "vUsV16iv*IiIi", "") BUILTIN(__builtin_ia32_scatterpfqpd, "vUcV8LLiv*IiIi", "") BUILTIN(__builtin_ia32_scatterpfqps, "vUcV8LLiv*IiIi", "") BUILTIN(__builtin_ia32_knothi, "UsUs", "") BUILTIN(__builtin_ia32_cmpb128_mask, "UsV16cV16cIiUs", "") BUILTIN(__builtin_ia32_cmpd128_mask, "UcV4iV4iIiUc", "") BUILTIN(__builtin_ia32_cmpq128_mask, "UcV2LLiV2LLiIiUc", "") BUILTIN(__builtin_ia32_cmpw128_mask, "UcV8sV8sIiUc", "") BUILTIN(__builtin_ia32_cmpb256_mask, "UiV32cV32cIiUi", "") BUILTIN(__builtin_ia32_cmpd256_mask, "UcV8iV8iIiUc", "") BUILTIN(__builtin_ia32_cmpq256_mask, "UcV4LLiV4LLiIiUc", "") BUILTIN(__builtin_ia32_cmpw256_mask, "UsV16sV16sIiUs", "") BUILTIN(__builtin_ia32_cmpb512_mask, "ULLiV64cV64cIiULLi", "") BUILTIN(__builtin_ia32_cmpd512_mask, "UsV16iV16iIiUs", "") BUILTIN(__builtin_ia32_cmpq512_mask, "UcV8LLiV8LLiIiUc", "") BUILTIN(__builtin_ia32_cmpw512_mask, "UiV32sV32sIiUi", "") BUILTIN(__builtin_ia32_ucmpb128_mask, "UsV16cV16cIiUs", "") BUILTIN(__builtin_ia32_ucmpd128_mask, "UcV4iV4iIiUc", "") BUILTIN(__builtin_ia32_ucmpq128_mask, "UcV2LLiV2LLiIiUc", "") BUILTIN(__builtin_ia32_ucmpw128_mask, "UcV8sV8sIiUc", "") BUILTIN(__builtin_ia32_ucmpb256_mask, "UiV32cV32cIiUi", "") BUILTIN(__builtin_ia32_ucmpd256_mask, "UcV8iV8iIiUc", "") BUILTIN(__builtin_ia32_ucmpq256_mask, "UcV4LLiV4LLiIiUc", "") BUILTIN(__builtin_ia32_ucmpw256_mask, "UsV16sV16sIiUs", "") BUILTIN(__builtin_ia32_ucmpb512_mask, "ULLiV64cV64cIiULLi", "") BUILTIN(__builtin_ia32_ucmpd512_mask, "UsV16iV16iIiUs", "") BUILTIN(__builtin_ia32_ucmpq512_mask, "UcV8LLiV8LLiIiUc", "") BUILTIN(__builtin_ia32_ucmpw512_mask, "UiV32sV32sIiUi", "") BUILTIN(__builtin_ia32_paddd256_mask, "V8iV8iV8iV8iUc", "") BUILTIN(__builtin_ia32_paddq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "") BUILTIN(__builtin_ia32_psubd256_mask, "V8iV8iV8iV8iUc", "") BUILTIN(__builtin_ia32_psubq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "") BUILTIN(__builtin_ia32_paddd128_mask, "V4iV4iV4iV4iUc", "") BUILTIN(__builtin_ia32_paddq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "") BUILTIN(__builtin_ia32_psubd128_mask, "V4iV4iV4iV4iUc", "") BUILTIN(__builtin_ia32_psubq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "") BUILTIN(__builtin_ia32_pmuldq256_mask, "V4LLiV8iV8iV4LLiUc", "") BUILTIN(__builtin_ia32_pmuldq128_mask, "V2LLiV4iV4iV2LLiUc", "") BUILTIN(__builtin_ia32_pmuludq256_mask, "V4LLiV8iV8iV4LLiUc", "") BUILTIN(__builtin_ia32_pmuludq128_mask, "V2LLiV4iV4iV2LLiUc", "") BUILTIN(__builtin_ia32_pmulld256_mask, "V8iV8iV8iV8iUc", "") BUILTIN(__builtin_ia32_pmulld128_mask, "V4iV4iV4iV4iUc", "") BUILTIN(__builtin_ia32_pandd256_mask, "V8iV8iV8iV8iUc", "") BUILTIN(__builtin_ia32_pandd128_mask, "V4iV4iV4iV4iUc", "") BUILTIN(__builtin_ia32_pandnd256_mask, "V8iV8iV8iV8iUc", "") BUILTIN(__builtin_ia32_pandnd128_mask, "V4iV4iV4iV4iUc", "") BUILTIN(__builtin_ia32_pord256_mask, "V8iV8iV8iV8iUc", "") BUILTIN(__builtin_ia32_pord128_mask, "V4iV4iV4iV4iUc", "") BUILTIN(__builtin_ia32_pxord256_mask, "V8iV8iV8iV8iUc", "") BUILTIN(__builtin_ia32_pxord128_mask, "V4iV4iV4iV4iUc", "") BUILTIN(__builtin_ia32_pandq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "") BUILTIN(__builtin_ia32_pandq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "") BUILTIN(__builtin_ia32_pandnq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "") BUILTIN(__builtin_ia32_pandnq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "") BUILTIN(__builtin_ia32_porq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "") BUILTIN(__builtin_ia32_porq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "") BUILTIN(__builtin_ia32_pxorq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "") BUILTIN(__builtin_ia32_pxorq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "") BUILTIN(__builtin_ia32_paddb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_psubb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_paddw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_psubw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pmullw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_paddb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_paddw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_psubb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_psubw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_paddb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_paddw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_psubb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_psubw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pmullw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pmullw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pandnd512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pandnq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_paddq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_psubq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_paddd512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_psubd512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pmulld512_mask, "V16iV16iV16iV16iUs", "") BUILTIN(__builtin_ia32_pmullq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_xorpd512_mask, "V8dV8dV8dV8dUc", "") BUILTIN(__builtin_ia32_xorps512_mask, "V16fV16fV16fV16fUs", "") BUILTIN(__builtin_ia32_orpd512_mask, "V8dV8dV8dV8dUc", "") BUILTIN(__builtin_ia32_orps512_mask, "V16fV16fV16fV16fUs", "") BUILTIN(__builtin_ia32_andpd512_mask, "V8dV8dV8dV8dUc", "") BUILTIN(__builtin_ia32_andps512_mask, "V16fV16fV16fV16fUs", "") BUILTIN(__builtin_ia32_andnpd512_mask, "V8dV8dV8dV8dUc", "") BUILTIN(__builtin_ia32_andnps512_mask, "V16fV16fV16fV16fUs", "") BUILTIN(__builtin_ia32_pmullq256_mask, "V4LLiV4LLiV4LLiV4LLiUc", "") BUILTIN(__builtin_ia32_pmullq128_mask, "V2LLiV2LLiV2LLiV2LLiUc", "") BUILTIN(__builtin_ia32_andnpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_andnpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_andnps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_andnps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_andpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_andpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_andps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_andps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_xorpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_xorpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_xorps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_xorps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_orpd256_mask, "V4dV4dV4dV4dUc", "") BUILTIN(__builtin_ia32_orpd128_mask, "V2dV2dV2dV2dUc", "") BUILTIN(__builtin_ia32_orps256_mask, "V8fV8fV8fV8fUc", "") BUILTIN(__builtin_ia32_orps128_mask, "V4fV4fV4fV4fUc", "") BUILTIN(__builtin_ia32_blendmb_512_mask, "V64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_blendmw_512_mask, "V32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pabsb512_mask, "V64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_pabsw512_mask, "V32sV32sV32sUi", "") BUILTIN(__builtin_ia32_packssdw512_mask, "V32sV16iV16iV32sUi", "") BUILTIN(__builtin_ia32_packsswb512_mask, "V64cV32sV32sV64cULLi", "") BUILTIN(__builtin_ia32_packusdw512_mask, "V32sV16iV16iV32sUi", "") BUILTIN(__builtin_ia32_packuswb512_mask, "V64cV32sV32sV64cULLi", "") BUILTIN(__builtin_ia32_paddsb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_paddsw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_paddusb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_paddusw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pavgb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_pavgw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pmaxsb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_pmaxsw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pmaxub512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_pmaxuw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pminsb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_pminsw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pminub512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_pminuw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_pshufb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_psubsb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_psubsw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_psubusb512_mask, "V64cV64cV64cV64cULLi", "") BUILTIN(__builtin_ia32_psubusw512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_vpermi2varhi512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_vpermt2varhi512_mask, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_vpermt2varhi512_maskz, "V32sV32sV32sV32sUi", "") BUILTIN(__builtin_ia32_vpconflictdi_512_mask, "V8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_vpconflictsi_512_mask, "V16iV16iV16iUs", "") BUILTIN(__builtin_ia32_vplzcntd_512_mask, "V16iV16iV16iUs", "") BUILTIN(__builtin_ia32_vplzcntq_512_mask, "V8LLiV8LLiV8LLiUc", "") BUILTIN(__builtin_ia32_blendmb_128_mask, "V16cV16cV16cUs", "") BUILTIN(__builtin_ia32_blendmb_256_mask, "V32cV32cV32cUi", "") BUILTIN(__builtin_ia32_blendmw_128_mask, "V8sV8sV8sUc", "") BUILTIN(__builtin_ia32_blendmw_256_mask, "V16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pabsb128_mask, "V16cV16cV16cUs", "") BUILTIN(__builtin_ia32_pabsb256_mask, "V32cV32cV32cUi", "") BUILTIN(__builtin_ia32_pabsw128_mask, "V8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pabsw256_mask, "V16sV16sV16sUs", "") BUILTIN(__builtin_ia32_packssdw128_mask, "V8sV4iV4iV8sUc", "") BUILTIN(__builtin_ia32_packssdw256_mask, "V16sV8iV8iV16sUs", "") BUILTIN(__builtin_ia32_packsswb128_mask, "V16cV8sV8sV16cUs", "") BUILTIN(__builtin_ia32_packsswb256_mask, "V32cV16sV16sV32cUi", "") BUILTIN(__builtin_ia32_packusdw128_mask, "V8sV4iV4iV8sUc", "") BUILTIN(__builtin_ia32_packusdw256_mask, "V16sV8iV8iV16sUs", "") BUILTIN(__builtin_ia32_packuswb128_mask, "V16cV8sV8sV16cUs", "") BUILTIN(__builtin_ia32_packuswb256_mask, "V32cV16sV16sV32cUi", "") BUILTIN(__builtin_ia32_paddsb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_paddsb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_paddsw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_paddsw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_paddusb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_paddusb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_paddusw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_paddusw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pavgb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_pavgb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_pavgw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pavgw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pmaxsb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_pmaxsb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_pmaxsw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pmaxsw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pmaxub128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_pmaxub256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_pmaxuw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pmaxuw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pminsb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_pminsb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_pminsw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pminsw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pminub128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_pminub256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_pminuw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_pminuw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_pshufb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_pshufb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_psubsb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_psubsb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_psubsw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_psubsw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_psubusb128_mask, "V16cV16cV16cV16cUs", "") BUILTIN(__builtin_ia32_psubusb256_mask, "V32cV32cV32cV32cUi", "") BUILTIN(__builtin_ia32_psubusw128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_psubusw256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_vpermi2varhi128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_vpermi2varhi256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_vpermt2varhi128_mask, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_vpermt2varhi128_maskz, "V8sV8sV8sV8sUc", "") BUILTIN(__builtin_ia32_vpermt2varhi256_mask, "V16sV16sV16sV16sUs", "") BUILTIN(__builtin_ia32_vpermt2varhi256_maskz, "V16sV16sV16sV16sUs", "") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Attributes.h
//===--- Attributes.h - Attributes header -----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_ATTRIBUTES_H #define LLVM_CLANG_BASIC_ATTRIBUTES_H #include "clang/Basic/LangOptions.h" #include "llvm/ADT/Triple.h" namespace clang { class IdentifierInfo; enum class AttrSyntax { /// Is the identifier known as a GNU-style attribute? GNU, /// Is the identifier known as a __declspec-style attribute? Declspec, // Is the identifier known as a C++-style attribute? CXX, // Is the identifier known as a pragma attribute? Pragma }; /// \brief Return the version number associated with the attribute if we /// recognize and implement the attribute specified by the given information. int hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope, const IdentifierInfo *Attr, const llvm::Triple &T, const LangOptions &LangOpts); } // end namespace clang #endif // LLVM_CLANG_BASIC_ATTRIBUTES_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/LangOptions.fixed.def
//===--- LangOptions.def - Language option database -------------*- C++ -*-===// /////////////////////////////////////////////////////////////////////////////// // // // LangOptions.fixed.def // // Copyright (C) Microsoft Corporation. All rights reserved. // // This file is distributed under the University of Illinois Open Source // // License. See LICENSE.TXT for details. // // // // This file defines the language options. Users of this file must // // define the LANGOPT macro to make use of this information. // // // // Optionally, the user may also define: // // // // BENIGN_LANGOPT: for options that don't affect the construction of the AST in// // any way (that is, the value can be different between an implicit module// // and the user of that module). // // // // COMPATIBLE_LANGOPT: for options that affect the construction of the AST in// // a way that doesn't prevent interoperability (that is, the value can be// // different between an explicit module and the user of that module). // // // // ENUM_LANGOPT: for options that have enumeration, rather than unsigned, type.// // // // VALUE_LANGOPT: for options that describe a value rather than a flag. // // // // BENIGN_ENUM_LANGOPT, COMPATIBLE_ENUM_LANGOPT: combinations of the above. // // // // FIXME: Clients should be able to more easily select whether they want // // different levels of compatibility versus how to handle different kinds // // of option. // // // /////////////////////////////////////////////////////////////////////////////// #ifndef LANGOPT # error Define the LANGOPT macro to handle language options #endif #ifndef COMPATIBLE_LANGOPT # define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif #ifndef BENIGN_LANGOPT # define BENIGN_LANGOPT(Name, Bits, Default, Description) \ COMPATIBLE_LANGOPT(Name, Bits, Default, Description) #endif #ifndef COMPATIBLE_LANGOPT_BOOL # define COMPATIBLE_LANGOPT_BOOL(Name, Default, Description) \ LANGOPT_BOOL(Name, Default, Description) #endif #ifndef BENIGN_LANGOPT_BOOL # define BENIGN_LANGOPT_BOOL(Name, Default, Description) \ COMPATIBLE_LANGOPT_BOOL(Name, Default, Description) #endif // add default LANGOPT_BOOL. #ifndef LANGOPT_BOOL #define LANGOPT_BOOL(Name, Default, Description) #endif #ifndef ENUM_LANGOPT # define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif #ifndef COMPATIBLE_ENUM_LANGOPT # define COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ ENUM_LANGOPT(Name, Type, Bits, Default, Description) #endif #ifndef BENIGN_ENUM_LANGOPT # define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) #endif #ifndef VALUE_LANGOPT # define VALUE_LANGOPT(Name, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif // FIXME: A lot of the BENIGN_ options should be COMPATIBLE_ instead. LANGOPT(C99 , 1, 0, "C99") LANGOPT(C11 , 1, 0, "C11") LANGOPT_BOOL(MSVCCompat, 0, "Microsoft Visual C++ full compatibility mode") LANGOPT_BOOL(MicrosoftExt, 0, "Microsoft C++ extensions") LANGOPT_BOOL(AsmBlocks, 0, "Microsoft inline asm blocks") LANGOPT_BOOL(Borland, 0, "Borland extensions") LANGOPT_BOOL(CPlusPlus, 1, "C++") LANGOPT_BOOL(CPlusPlus11, 0, "C++11") LANGOPT(CPlusPlus14 , 1, 0, "C++14") LANGOPT(CPlusPlus1z , 1, 0, "C++1z") LANGOPT(ObjC1 , 1, 0, "Objective-C 1") LANGOPT(ObjC2 , 1, 0, "Objective-C 2") BENIGN_LANGOPT_BOOL(ObjCDefaultSynthProperties, 0, "Objective-C auto-synthesized properties") BENIGN_LANGOPT_BOOL(EncodeExtendedBlockSig, 0, "Encoding extended block type signature") BENIGN_LANGOPT_BOOL(ObjCInferRelatedResultType, 1, "Objective-C related result type inference") LANGOPT_BOOL(AppExt, 0, "Objective-C App Extension") LANGOPT_BOOL(Trigraphs, 0,"trigraphs") LANGOPT_BOOL(LineComment, 1, "'//' comments") LANGOPT_BOOL(Bool, 1, "bool, true, and false keywords") LANGOPT_BOOL(Half, 0, "half keyword") LANGOPT_BOOL(WChar, CPlusPlus, "wchar_t keyword") BENIGN_LANGOPT_BOOL(DollarIdents, 1, "'$' in identifiers") BENIGN_LANGOPT_BOOL(AsmPreprocessor, 0, "preprocessor in asm mode") BENIGN_LANGOPT_BOOL(GNUMode, 0, "GNU extensions") LANGOPT_BOOL(GNUKeywords, 0, "GNU keywords") BENIGN_LANGOPT_BOOL(ImplicitInt, !C99 && !CPlusPlus, "C89 implicit 'int'") LANGOPT_BOOL(Digraphs, 0, "digraphs") BENIGN_LANGOPT_BOOL(HexFloats, C99, "C99 hexadecimal float constants") LANGOPT_BOOL(CXXOperatorNames, 0, "C++ operator name keywords") LANGOPT_BOOL(AppleKext, 0, "Apple kext support") BENIGN_LANGOPT_BOOL(PascalStrings, 0, "Pascal string support") LANGOPT_BOOL(WritableStrings, 0, "writable string support") LANGOPT_BOOL(ConstStrings, 0, "const-qualified string support") LANGOPT_BOOL(LaxVectorConversions, 1, "lax vector conversions") LANGOPT_BOOL(AltiVec, 0, "AltiVec-style vector initializers") LANGOPT_BOOL(ZVector, 0, "System z vector extensions") LANGOPT_BOOL(Exceptions, 0, "exception handling") LANGOPT_BOOL(ObjCExceptions, 0, "Objective-C exceptions") LANGOPT_BOOL(CXXExceptions, 0, "C++ exceptions") LANGOPT_BOOL(SjLjExceptions, 0, "setjmp-longjump exception handling") LANGOPT_BOOL(TraditionalCPP, 0, "traditional CPP emulation") LANGOPT_BOOL(RTTI, 0, "run-time type information") LANGOPT_BOOL(RTTIData, 0, "emit run-time type information data") LANGOPT_BOOL(MSBitfields, 0, "Microsoft-compatible structure layout") LANGOPT_BOOL(Freestanding, 0, "freestanding implementation") LANGOPT_BOOL(NoBuiltin, 0, "disable builtin functions") LANGOPT_BOOL(NoMathBuiltin, 0, "disable math builtin functions") LANGOPT_BOOL(GNUAsm, 1, "GNU-style inline assembly") BENIGN_LANGOPT_BOOL(ThreadsafeStatics, 0, "thread-safe static initializers") LANGOPT_BOOL(POSIXThreads, 0, "POSIX thread support") LANGOPT_BOOL(Blocks, 0, "blocks extension to C") BENIGN_LANGOPT_BOOL(EmitAllDecls, 0, "support for emitting all declarations") LANGOPT_BOOL(MathErrno, 0, "errno support for math functions") BENIGN_LANGOPT_BOOL(HeinousExtensions, 0, "Extensions that we really don't like and may be ripped out at any time") LANGOPT_BOOL(Modules, 0, "modules extension to C") COMPATIBLE_LANGOPT_BOOL(ModulesDeclUse, 0, "require declaration of module uses") LANGOPT_BOOL(ModulesSearchAll, 0, "search even non-imported modules to find unresolved references") COMPATIBLE_LANGOPT_BOOL(ModulesStrictDeclUse, 0, "require declaration of module uses and all headers to be in modules") BENIGN_LANGOPT_BOOL(ModulesErrorRecovery, 0, "automatically import modules as needed when performing error recovery") BENIGN_LANGOPT_BOOL(ImplicitModules, 0, "build modules that are not specified via -fmodule-file") COMPATIBLE_LANGOPT_BOOL(ModulesLocalVisibility, 0, "local submodule visibility") COMPATIBLE_LANGOPT_BOOL(ModulesHideInternalLinkage, 0, "hiding non-visible internal linkage declarations from redeclaration lookup") COMPATIBLE_LANGOPT_BOOL(Optimize, 0, "__OPTIMIZE__ predefined macro") COMPATIBLE_LANGOPT_BOOL(OptimizeSize, 0, "__OPTIMIZE_SIZE__ predefined macro") LANGOPT_BOOL(Static, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)") VALUE_LANGOPT(PackStruct , 32, 0, "default struct packing maximum alignment") VALUE_LANGOPT(MaxTypeAlign , 32, 0, "default maximum alignment for types") VALUE_LANGOPT(PICLevel , 2, 0, "__PIC__ level") VALUE_LANGOPT(PIELevel , 2, 0, "__PIE__ level") LANGOPT_BOOL(GNUInline, 0, "GNU inline semantics") COMPATIBLE_LANGOPT_BOOL(NoInlineDefine, 0, "__NO_INLINE__ predefined macro") COMPATIBLE_LANGOPT_BOOL(Deprecated, 0, "__DEPRECATED predefined macro") LANGOPT_BOOL(FastMath, 0, "__FAST_MATH__ predefined macro") LANGOPT_BOOL(FiniteMathOnly, 0, "__FINITE_MATH_ONLY__ predefined macro") BENIGN_LANGOPT_BOOL(ObjCGCBitmapPrint, 0, "printing of GC's bitmap layout for __weak/__strong ivars") BENIGN_LANGOPT_BOOL(AccessControl, 1, "C++ access control") LANGOPT_BOOL(CharIsSigned, 1, "signed char") LANGOPT_BOOL(ShortWChar, 0, "unsigned short wchar_t") ENUM_LANGOPT(MSPointerToMemberRepresentationMethod, PragmaMSPointersToMembersKind, 2, PPTMK_BestCase, "member-pointer representation method") LANGOPT_BOOL(ShortEnums, 0, "short enum types") LANGOPT_BOOL(HLSL, 1, "Microsoft HLSL") // HLSL Change: LangOption for HLSL LANGOPT_BOOL(OpenCL, 0, "OpenCL") LANGOPT(OpenCLVersion , 32, 0, "OpenCL version") LANGOPT_BOOL(NativeHalfType, 1, "Native half type support") LANGOPT_BOOL(HalfArgsAndReturns, 1, "half args and returns") LANGOPT_BOOL(CUDA, 0, "CUDA") LANGOPT_BOOL(OpenMP, 0, "OpenMP support") LANGOPT_BOOL(OpenMPUseTLS, 0, "Use TLS for threadprivates or runtime calls") LANGOPT_BOOL(CUDAIsDevice, 0, "Compiling for CUDA device") LANGOPT_BOOL(CUDAAllowHostCallsFromHostDevice, 0, "Allow host device functions to call host functions") LANGOPT_BOOL(CUDADisableTargetCallChecks, 0, "Disable checks for call targets (host, device, etc.)") LANGOPT_BOOL(AssumeSaneOperatorNew, 1, "implicit __attribute__((malloc)) for C++'s new operators") LANGOPT_BOOL(SizedDeallocation, 0, "enable sized deallocation functions") LANGOPT_BOOL(ConceptsTS, 0, "enable C++ Extensions for Concepts") BENIGN_LANGOPT_BOOL(ElideConstructors, 1, "C++ copy constructor elision") BENIGN_LANGOPT_BOOL(DumpRecordLayouts, 0, "dumping the layout of IRgen'd records") BENIGN_LANGOPT_BOOL(DumpRecordLayoutsSimple, 0, "dumping the layout of IRgen'd records in a simple form") BENIGN_LANGOPT_BOOL(DumpVTableLayouts, 0, "dumping the layouts of emitted vtables") LANGOPT_BOOL(NoConstantCFStrings, 0, "no constant CoreFoundation strings") BENIGN_LANGOPT_BOOL(InlineVisibilityHidden, 0, "hidden default visibility for inline C++ methods") BENIGN_LANGOPT_BOOL(ParseUnknownAnytype, 0, "__unknown_anytype") BENIGN_LANGOPT_BOOL(DebuggerSupport, 0, "debugger support") BENIGN_LANGOPT_BOOL(DebuggerCastResultToId, 0, "for 'po' in the debugger, cast the result to id if it is of unknown type") BENIGN_LANGOPT_BOOL(DebuggerObjCLiteral, 0, "debugger Objective-C literals and subscripting support") BENIGN_LANGOPT_BOOL(SpellChecking, 1, "spell-checking") LANGOPT_BOOL(SinglePrecisionConstants, 0, "treating double-precision floating point constants as single precision constants") LANGOPT_BOOL(FastRelaxedMath, 0, "OpenCL fast relaxed math") LANGOPT_BOOL(DefaultFPContract, 0, "FP_CONTRACT") LANGOPT_BOOL(NoBitFieldTypeAlign, 0, "bit-field type alignment") LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility") LANGOPT_BOOL(ObjCAutoRefCount, 0, "Objective-C automated reference counting") LANGOPT_BOOL(ObjCARCWeak, 0, "__weak support in the ARC runtime") LANGOPT_BOOL(ObjCSubscriptingLegacyRuntime, 0, "Subscripting support in legacy ObjectiveC runtime") LANGOPT_BOOL(FakeAddressSpaceMap, 0, "OpenCL fake address space map") ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, "OpenCL address space map mangling mode") LANGOPT_BOOL(MRTD, 0, "-mrtd calling convention") BENIGN_LANGOPT_BOOL(DelayedTemplateParsing, 0, "delayed template parsing") LANGOPT_BOOL(BlocksRuntimeOptional, 0, "optional blocks runtime") ENUM_LANGOPT(GC, GCMode, 2, NonGC, "Objective-C Garbage Collection mode") ENUM_LANGOPT(ValueVisibilityMode, Visibility, 3, DefaultVisibility, "value symbol visibility") ENUM_LANGOPT(TypeVisibilityMode, Visibility, 3, DefaultVisibility, "type symbol visibility") ENUM_LANGOPT(StackProtector, StackProtectorMode, 2, SSPOff, "stack protector mode") ENUM_LANGOPT(SignedOverflowBehavior, SignedOverflowBehaviorTy, 2, SOB_Undefined, "signed integer overflow handling") BENIGN_LANGOPT(ArrowDepth, 32, 256, "maximum number of operator->s to follow") BENIGN_LANGOPT(InstantiationDepth, 32, 256, "maximum template instantiation depth") BENIGN_LANGOPT(ConstexprCallDepth, 32, 512, "maximum constexpr call depth") BENIGN_LANGOPT(ConstexprStepLimit, 32, 1048576, "maximum constexpr evaluation steps") BENIGN_LANGOPT(BracketDepth, 32, 256, "maximum bracket nesting depth") BENIGN_LANGOPT(NumLargeByValueCopy, 32, 0, "if non-zero, warn about parameter or return Warn if parameter/return value is larger in bytes than this setting. 0 is no check.") VALUE_LANGOPT(MSCompatibilityVersion, 32, 0, "Microsoft Visual C/C++ Version") VALUE_LANGOPT(VtorDispMode, 2, 1, "How many vtordisps to insert") LANGOPT_BOOL(ApplePragmaPack, 0, "Apple gcc-compatible #pragma pack handling") LANGOPT_BOOL(RetainCommentsFromSystemHeaders, 0, "retain documentation comments from system headers in the AST") LANGOPT(SanitizeAddressFieldPadding, 2, 0, "controls how aggressive is ASan " "field padding (0: none, 1:least " "aggressive, 2: more aggressive)") #undef LANGOPT #undef COMPATIBLE_LANGOPT #undef BENIGN_LANGOPT #undef ENUM_LANGOPT #undef COMPATIBLE_ENUM_LANGOPT #undef BENIGN_ENUM_LANGOPT #undef VALUE_LANGOPT #undef LANGOPT_BOOL #undef COMPATIBLE_LANGOPT_BOOL #undef BENIGN_LANGOPT_BOOL
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/CMakeLists.txt
macro(clang_diag_gen component) clang_tablegen(Diagnostic${component}Kinds.inc -gen-clang-diags-defs -clang-component=${component} SOURCE Diagnostic.td TARGET ClangDiagnostic${component}) endmacro(clang_diag_gen) clang_diag_gen(Analysis) clang_diag_gen(AST) clang_diag_gen(Comment) clang_diag_gen(Common) clang_diag_gen(Driver) clang_diag_gen(Frontend) clang_diag_gen(Lex) clang_diag_gen(Parse) clang_diag_gen(Sema) clang_diag_gen(Serialization) clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups SOURCE Diagnostic.td TARGET ClangDiagnosticGroups) clang_tablegen(DiagnosticIndexName.inc -gen-clang-diags-index-name SOURCE Diagnostic.td TARGET ClangDiagnosticIndexName) clang_tablegen(AttrList.inc -gen-clang-attr-list -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ SOURCE Attr.td TARGET ClangAttrList) clang_tablegen(AttrHasAttributeImpl.inc -gen-clang-attr-has-attribute-impl -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ SOURCE Attr.td TARGET ClangAttrHasAttributeImpl ) # HLSL Change Start - remove unsupported builtins # ARM NEON #clang_tablegen(arm_neon.inc -gen-arm-neon-sema # -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ # SOURCE arm_neon.td # TARGET ClangARMNeon) # HLSL Change Ends - remove unsupported builtins
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/AttrKinds.h
//===----- Attr.h - Enum values for C Attribute Kinds ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::attr::Kind enum. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_ATTRKINDS_H #define LLVM_CLANG_BASIC_ATTRKINDS_H namespace clang { namespace attr { // \brief A list of all the recognized kinds of attributes. enum Kind { #define ATTR(X) X, #define LAST_INHERITABLE_ATTR(X) X, LAST_INHERITABLE = X, #define LAST_INHERITABLE_PARAM_ATTR(X) X, LAST_INHERITABLE_PARAM = X, #include "clang/Basic/AttrList.inc" NUM_ATTRS }; } // end namespace attr } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsARM.def
//===--- BuiltinsARM.def - ARM Builtin function database ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the ARM-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// #if defined(BUILTIN) && !defined(LANGBUILTIN) # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) #endif // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic BUILTIN(__builtin_arm_qadd, "iii", "nc") BUILTIN(__builtin_arm_qsub, "iii", "nc") BUILTIN(__builtin_arm_ssat, "iiUi", "nc") BUILTIN(__builtin_arm_usat, "UiUiUi", "nc") // Bit manipulation BUILTIN(__builtin_arm_rbit, "UiUi", "nc") // Store and load exclusive BUILTIN(__builtin_arm_ldrexd, "LLUiv*", "") BUILTIN(__builtin_arm_strexd, "iLLUiv*", "") BUILTIN(__builtin_arm_ldrex, "v.", "t") BUILTIN(__builtin_arm_ldaex, "v.", "t") BUILTIN(__builtin_arm_strex, "i.", "t") BUILTIN(__builtin_arm_stlex, "i.", "t") BUILTIN(__builtin_arm_clrex, "v", "") // VFP BUILTIN(__builtin_arm_get_fpscr, "Ui", "nc") BUILTIN(__builtin_arm_set_fpscr, "vUi", "nc") BUILTIN(__builtin_arm_vcvtr_f, "ffi", "nc") BUILTIN(__builtin_arm_vcvtr_d, "fdi", "nc") // Coprocessor BUILTIN(__builtin_arm_mcr, "vUiUiUiUiUiUi", "") BUILTIN(__builtin_arm_mcr2, "vUiUiUiUiUiUi", "") BUILTIN(__builtin_arm_mrc, "UiUiUiUiUiUi", "") BUILTIN(__builtin_arm_mrc2, "UiUiUiUiUiUi", "") BUILTIN(__builtin_arm_cdp, "vUiUiUiUiUiUi", "") BUILTIN(__builtin_arm_cdp2, "vUiUiUiUiUiUi", "") BUILTIN(__builtin_arm_mcrr, "vUiUiUiUiUi", "") BUILTIN(__builtin_arm_mcrr2, "vUiUiUiUiUi", "") // CRC32 BUILTIN(__builtin_arm_crc32b, "UiUiUc", "nc") BUILTIN(__builtin_arm_crc32cb, "UiUiUc", "nc") BUILTIN(__builtin_arm_crc32h, "UiUiUs", "nc") BUILTIN(__builtin_arm_crc32ch, "UiUiUs", "nc") BUILTIN(__builtin_arm_crc32w, "UiUiUi", "nc") BUILTIN(__builtin_arm_crc32cw, "UiUiUi", "nc") BUILTIN(__builtin_arm_crc32d, "UiUiLLUi", "nc") BUILTIN(__builtin_arm_crc32cd, "UiUiLLUi", "nc") // HINT BUILTIN(__builtin_arm_nop, "v", "") BUILTIN(__builtin_arm_yield, "v", "") BUILTIN(__builtin_arm_wfe, "v", "") BUILTIN(__builtin_arm_wfi, "v", "") BUILTIN(__builtin_arm_sev, "v", "") BUILTIN(__builtin_arm_sevl, "v", "") BUILTIN(__builtin_arm_dbg, "vUi", "") // Data barrier BUILTIN(__builtin_arm_dmb, "vUi", "nc") BUILTIN(__builtin_arm_dsb, "vUi", "nc") BUILTIN(__builtin_arm_isb, "vUi", "nc") // Prefetch BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc") // System registers (ACLE) BUILTIN(__builtin_arm_rsr, "UicC*", "nc") BUILTIN(__builtin_arm_rsr64, "LLUicC*", "nc") BUILTIN(__builtin_arm_rsrp, "v*cC*", "nc") BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc") BUILTIN(__builtin_arm_wsr64, "vcC*LLUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") // MSVC LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES) LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES) LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES) LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES) LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES) LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES) LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES) LANGBUILTIN(_MoveToCoprocessor, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES) LANGBUILTIN(_MoveToCoprocessor2, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES) #undef BUILTIN #undef LANGBUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Specifiers.h
//===--- Specifiers.h - Declaration and Type Specifiers ---------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines various enumerations that describe declaration and /// type specifiers. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SPECIFIERS_H #define LLVM_CLANG_BASIC_SPECIFIERS_H #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" #include "llvm/ADT/ArrayRef.h" // HLSL Change namespace clang { /// \brief Specifies the width of a type, e.g., short, long, or long long. enum TypeSpecifierWidth { TSW_unspecified, TSW_short, TSW_long, TSW_longlong }; /// \brief Specifies the signedness of a type, e.g., signed or unsigned. enum TypeSpecifierSign { TSS_unspecified, TSS_signed, TSS_unsigned }; /// \brief Specifies the kind of type. enum TypeSpecifierType { TST_unspecified, TST_void, TST_char, TST_wchar, // C++ wchar_t TST_char16, // C++11 char16_t TST_char32, // C++11 char32_t TST_int, TST_int128, // HLSL Changes begin TST_min16float, TST_min16int, TST_min16uint, TST_min10float, TST_min12int, TST_int8_4packed, TST_uint8_4packed, // HLSL Changes end TST_half, // OpenCL half, ARM NEON __fp16 TST_halffloat, // HLSL Change TST_float, TST_double, TST_bool, // _Bool TST_decimal32, // _Decimal32 TST_decimal64, // _Decimal64 TST_decimal128, // _Decimal128 TST_enum, TST_union, TST_struct, TST_class, // C++ class type TST_interface, // C++ (Microsoft-specific) __interface type TST_typename, // Typedef, C++ class-name or enum name, etc. TST_typeofType, TST_typeofExpr, TST_decltype, // C++11 decltype TST_underlyingType, // __underlying_type for C++11 TST_auto, // C++11 auto TST_decltype_auto, // C++1y decltype(auto) TST_unknown_anytype, // __unknown_anytype extension TST_atomic, // C11 _Atomic TST_error // erroneous type }; /// \brief Structure that packs information about the type specifiers that /// were written in a particular type specifier sequence. struct WrittenBuiltinSpecs { /*DeclSpec::TST*/ unsigned Type : 5; /*DeclSpec::TSS*/ unsigned Sign : 2; /*DeclSpec::TSW*/ unsigned Width : 2; bool ModeAttr : 1; }; /// \brief A C++ access specifier (public, private, protected), plus the /// special value "none" which means different things in different contexts. enum AccessSpecifier { AS_public, AS_protected, AS_private, AS_none }; /// \brief The categorization of expression values, currently following the /// C++11 scheme. enum ExprValueKind { /// \brief An r-value expression (a pr-value in the C++11 taxonomy) /// produces a temporary value. VK_RValue, /// \brief An l-value expression is a reference to an object with /// independent storage. VK_LValue, /// \brief An x-value expression is a reference to an object with /// independent storage but which can be "moved", i.e. /// efficiently cannibalized for its resources. VK_XValue }; /// \brief A further classification of the kind of object referenced by an /// l-value or x-value. enum ExprObjectKind { /// An ordinary object is located at an address in memory. OK_Ordinary, /// A bitfield object is a bitfield on a C or C++ record. OK_BitField, /// A vector component is an element or range of elements on a vector. OK_VectorComponent, /// An Objective-C property is a logical field of an Objective-C /// object which is read and written via Objective-C method calls. OK_ObjCProperty, /// An Objective-C array/dictionary subscripting which reads an /// object or writes at the subscripted array/dictionary element via /// Objective-C method calls. OK_ObjCSubscript }; /// \brief Describes the kind of template specialization that a /// particular template specialization declaration represents. enum TemplateSpecializationKind { /// This template specialization was formed from a template-id but /// has not yet been declared, defined, or instantiated. TSK_Undeclared = 0, /// This template specialization was implicitly instantiated from a /// template. (C++ [temp.inst]). TSK_ImplicitInstantiation, /// This template specialization was declared or defined by an /// explicit specialization (C++ [temp.expl.spec]) or partial /// specialization (C++ [temp.class.spec]). TSK_ExplicitSpecialization, /// This template specialization was instantiated from a template /// due to an explicit instantiation declaration request /// (C++11 [temp.explicit]). TSK_ExplicitInstantiationDeclaration, /// This template specialization was instantiated from a template /// due to an explicit instantiation definition request /// (C++ [temp.explicit]). TSK_ExplicitInstantiationDefinition }; /// \brief Determine whether this template specialization kind refers /// to an instantiation of an entity (as opposed to a non-template or /// an explicit specialization). inline bool isTemplateInstantiation(TemplateSpecializationKind Kind) { return Kind != TSK_Undeclared && Kind != TSK_ExplicitSpecialization; } /// \brief Thread storage-class-specifier. enum ThreadStorageClassSpecifier { TSCS_unspecified, /// GNU __thread. TSCS___thread, /// C++11 thread_local. Implies 'static' at block scope, but not at /// class scope. TSCS_thread_local, /// C11 _Thread_local. Must be combined with either 'static' or 'extern' /// if used at block scope. TSCS__Thread_local }; /// \brief Storage classes. enum StorageClass { // These are legal on both functions and variables. SC_None, SC_Extern, SC_Static, SC_PrivateExtern, // These are only legal on variables. SC_OpenCLWorkGroupLocal, SC_Auto, SC_Register }; /// \brief Checks whether the given storage class is legal for functions. inline bool isLegalForFunction(StorageClass SC) { return SC <= SC_PrivateExtern; } /// \brief Checks whether the given storage class is legal for variables. inline bool isLegalForVariable(StorageClass SC) { return true; } /// \brief In-class initialization styles for non-static data members. enum InClassInitStyle { ICIS_NoInit, ///< No in-class initializer. ICIS_CopyInit, ///< Copy initialization. ICIS_ListInit ///< Direct list-initialization. }; /// \brief CallingConv - Specifies the calling convention that a function uses. enum CallingConv { CC_C, // __attribute__((cdecl)) CC_X86StdCall, // __attribute__((stdcall)) CC_X86FastCall, // __attribute__((fastcall)) CC_X86ThisCall, // __attribute__((thiscall)) CC_X86VectorCall, // __attribute__((vectorcall)) CC_X86Pascal, // __attribute__((pascal)) CC_X86_64Win64, // __attribute__((ms_abi)) CC_X86_64SysV, // __attribute__((sysv_abi)) CC_AAPCS, // __attribute__((pcs("aapcs"))) CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp"))) CC_IntelOclBicc, // __attribute__((intel_ocl_bicc)) CC_SpirFunction, // default for OpenCL functions on SPIR target CC_SpirKernel // inferred for OpenCL kernels on SPIR target }; /// \brief Checks whether the given calling convention supports variadic /// calls. Unprototyped calls also use the variadic call rules. inline bool supportsVariadicCall(CallingConv CC) { switch (CC) { case CC_X86StdCall: case CC_X86FastCall: case CC_X86ThisCall: case CC_X86Pascal: case CC_X86VectorCall: case CC_SpirFunction: case CC_SpirKernel: return false; default: return true; } } /// \brief The storage duration for an object (per C++ [basic.stc]). enum StorageDuration { SD_FullExpression, ///< Full-expression storage duration (for temporaries). SD_Automatic, ///< Automatic storage duration (most local variables). SD_Thread, ///< Thread storage duration. SD_Static, ///< Static storage duration. SD_Dynamic ///< Dynamic storage duration. }; /// Describes the nullability of a particular type. enum class NullabilityKind : uint8_t { /// Values of this type can never be null. NonNull = 0, /// Values of this type can be null. Nullable, /// Whether values of this type can be null is (explicitly) /// unspecified. This captures a (fairly rare) case where we /// can't conclude anything about the nullability of the type even /// though it has been considered. Unspecified }; /// Retrieve the spelling of the given nullability kind. llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive = false); } // end namespace clang // HLSL Change Starts namespace hlsl { /// In/inout/out/uniform parameter modifier. class ParameterModifier { public: enum Kind { In, InOut, Out, Uniform, Ref, Invalid }; ParameterModifier() : m_Kind(Kind::In) { } ParameterModifier(enum Kind Kind) : m_Kind(Kind) { } static ParameterModifier FromInOut(bool isIn, bool isOut) { if (isIn && !isOut) return hlsl::ParameterModifier(hlsl::ParameterModifier::Kind::In); if (isIn && isOut) return hlsl::ParameterModifier(hlsl::ParameterModifier::Kind::InOut); assert(!isIn && isOut && "else args are invalid"); return hlsl::ParameterModifier(hlsl::ParameterModifier::Kind::Out); } Kind GetKind() const { return m_Kind; } unsigned getAsUnsigned() const { return (unsigned)m_Kind; } bool isIn() const { return m_Kind == Kind::In; } bool isOut() const { return m_Kind == Kind::Out; } bool isInOut() const { return m_Kind == Kind::InOut; } bool isAnyIn() const { return isIn() || isInOut(); } bool isAnyOut() const { return isOut() || isInOut(); } bool operator==(const ParameterModifier& other) const { return m_Kind == other.m_Kind; } bool operator!=(const ParameterModifier& other) const { return m_Kind != other.m_Kind; } private: enum Kind m_Kind; }; } // HLSL Change Ends #endif // LLVM_CLANG_BASIC_SPECIFIERS_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Lambda.h
//===--- Lambda.h - Types for C++ Lambdas -----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines several types used to describe C++ lambda expressions /// that are shared between the parser and AST. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_LAMBDA_H #define LLVM_CLANG_BASIC_LAMBDA_H namespace clang { /// \brief The default, if any, capture method for a lambda expression. enum LambdaCaptureDefault { LCD_None, LCD_ByCopy, LCD_ByRef }; /// \brief The different capture forms in a lambda introducer /// /// C++11 allows capture of \c this, or of local variables by copy or /// by reference. C++1y also allows "init-capture", where the initializer /// is an expression. enum LambdaCaptureKind { LCK_This, ///< Capturing the \c this pointer LCK_ByCopy, ///< Capturing by copy (a.k.a., by value) LCK_ByRef, ///< Capturing by reference LCK_VLAType ///< Capturing variable-length array type }; } // end namespace clang #endif // LLVM_CLANG_BASIC_LAMBDA_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/ObjCRuntime.h
//===--- ObjCRuntime.h - Objective-C Runtime Configuration ------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines types useful for describing an Objective-C runtime. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_OBJCRUNTIME_H #define LLVM_CLANG_BASIC_OBJCRUNTIME_H #include "clang/Basic/VersionTuple.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/ErrorHandling.h" namespace clang { /// \brief The basic abstraction for the target Objective-C runtime. class ObjCRuntime { public: /// \brief The basic Objective-C runtimes that we know about. enum Kind { /// 'macosx' is the Apple-provided NeXT-derived runtime on Mac OS /// X platforms that use the non-fragile ABI; the version is a /// release of that OS. MacOSX, /// 'macosx-fragile' is the Apple-provided NeXT-derived runtime on /// Mac OS X platforms that use the fragile ABI; the version is a /// release of that OS. FragileMacOSX, /// 'ios' is the Apple-provided NeXT-derived runtime on iOS or the iOS /// simulator; it is always non-fragile. The version is a release /// version of iOS. iOS, /// 'gcc' is the Objective-C runtime shipped with GCC, implementing a /// fragile Objective-C ABI GCC, /// 'gnustep' is the modern non-fragile GNUstep runtime. GNUstep, /// 'objfw' is the Objective-C runtime included in ObjFW ObjFW }; private: Kind TheKind; VersionTuple Version; public: /// A bogus initialization of the runtime. ObjCRuntime() : TheKind(MacOSX) {} ObjCRuntime(Kind kind, const VersionTuple &version) : TheKind(kind), Version(version) {} void set(Kind kind, VersionTuple version) { TheKind = kind; Version = version; } Kind getKind() const { return TheKind; } const VersionTuple &getVersion() const { return Version; } /// \brief Does this runtime follow the set of implied behaviors for a /// "non-fragile" ABI? bool isNonFragile() const { switch (getKind()) { case FragileMacOSX: return false; case GCC: return false; case MacOSX: return true; case GNUstep: return true; case ObjFW: return true; case iOS: return true; } llvm_unreachable("bad kind"); } /// The inverse of isNonFragile(): does this runtime follow the set of /// implied behaviors for a "fragile" ABI? bool isFragile() const { return !isNonFragile(); } /// The default dispatch mechanism to use for the specified architecture bool isLegacyDispatchDefaultForArch(llvm::Triple::ArchType Arch) { // The GNUstep runtime uses a newer dispatch method by default from // version 1.6 onwards if (getKind() == GNUstep && getVersion() >= VersionTuple(1, 6)) { if (Arch == llvm::Triple::arm || Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) return false; } else if ((getKind() == MacOSX) && isNonFragile() && (getVersion() >= VersionTuple(10, 0)) && (getVersion() < VersionTuple(10, 6))) return Arch != llvm::Triple::x86_64; // Except for deployment target of 10.5 or less, // Mac runtimes use legacy dispatch everywhere now. return true; } /// \brief Is this runtime basically of the GNU family of runtimes? bool isGNUFamily() const { switch (getKind()) { case FragileMacOSX: case MacOSX: case iOS: return false; case GCC: case GNUstep: case ObjFW: return true; } llvm_unreachable("bad kind"); } /// \brief Is this runtime basically of the NeXT family of runtimes? bool isNeXTFamily() const { // For now, this is just the inverse of isGNUFamily(), but that's // not inherently true. return !isGNUFamily(); } /// \brief Does this runtime allow ARC at all? bool allowsARC() const { switch (getKind()) { case FragileMacOSX: return false; case MacOSX: return true; case iOS: return true; case GCC: return false; case GNUstep: return true; case ObjFW: return true; } llvm_unreachable("bad kind"); } /// \brief Does this runtime natively provide the ARC entrypoints? /// /// ARC cannot be directly supported on a platform that does not provide /// these entrypoints, although it may be supportable via a stub /// library. bool hasNativeARC() const { switch (getKind()) { case FragileMacOSX: return false; case MacOSX: return getVersion() >= VersionTuple(10, 7); case iOS: return getVersion() >= VersionTuple(5); case GCC: return false; case GNUstep: return getVersion() >= VersionTuple(1, 6); case ObjFW: return true; } llvm_unreachable("bad kind"); } /// \brief Does this runtime supports optimized setter entrypoints? bool hasOptimizedSetter() const { switch (getKind()) { case MacOSX: return getVersion() >= VersionTuple(10, 8); case iOS: return (getVersion() >= VersionTuple(6)); case GNUstep: return getVersion() >= VersionTuple(1, 7); default: return false; } } /// Does this runtime allow the use of __weak? bool allowsWeak() const { return hasNativeWeak(); } /// \brief Does this runtime natively provide ARC-compliant 'weak' /// entrypoints? bool hasNativeWeak() const { // Right now, this is always equivalent to whether the runtime // natively supports ARC decision. return hasNativeARC(); } /// \brief Does this runtime directly support the subscripting methods? /// /// This is really a property of the library, not the runtime. bool hasSubscripting() const { switch (getKind()) { case FragileMacOSX: return false; case MacOSX: return getVersion() >= VersionTuple(10, 8); case iOS: return getVersion() >= VersionTuple(6); // This is really a lie, because some implementations and versions // of the runtime do not support ARC. Probably -fgnu-runtime // should imply a "maximal" runtime or something? case GCC: return true; case GNUstep: return true; case ObjFW: return true; } llvm_unreachable("bad kind"); } /// \brief Does this runtime allow sizeof or alignof on object types? bool allowsSizeofAlignof() const { return isFragile(); } /// \brief Does this runtime allow pointer arithmetic on objects? /// /// This covers +, -, ++, --, and (if isSubscriptPointerArithmetic() /// yields true) []. bool allowsPointerArithmetic() const { switch (getKind()) { case FragileMacOSX: case GCC: return true; case MacOSX: case iOS: case GNUstep: case ObjFW: return false; } llvm_unreachable("bad kind"); } /// \brief Is subscripting pointer arithmetic? bool isSubscriptPointerArithmetic() const { return allowsPointerArithmetic(); } /// \brief Does this runtime provide an objc_terminate function? /// /// This is used in handlers for exceptions during the unwind process; /// without it, abort() must be used in pure ObjC files. bool hasTerminate() const { switch (getKind()) { case FragileMacOSX: return getVersion() >= VersionTuple(10, 8); case MacOSX: return getVersion() >= VersionTuple(10, 8); case iOS: return getVersion() >= VersionTuple(5); case GCC: return false; case GNUstep: return false; case ObjFW: return false; } llvm_unreachable("bad kind"); } /// \brief Does this runtime support weakly importing classes? bool hasWeakClassImport() const { switch (getKind()) { case MacOSX: return true; case iOS: return true; case FragileMacOSX: return false; case GCC: return true; case GNUstep: return true; case ObjFW: return true; } llvm_unreachable("bad kind"); } /// \brief Does this runtime use zero-cost exceptions? bool hasUnwindExceptions() const { switch (getKind()) { case MacOSX: return true; case iOS: return true; case FragileMacOSX: return false; case GCC: return true; case GNUstep: return true; case ObjFW: return true; } llvm_unreachable("bad kind"); } bool hasAtomicCopyHelper() const { switch (getKind()) { case FragileMacOSX: case MacOSX: case iOS: return true; case GNUstep: return getVersion() >= VersionTuple(1, 7); default: return false; } } /// \brief Try to parse an Objective-C runtime specification from the given /// string. /// /// \return true on error. bool tryParse(StringRef input); std::string getAsString() const; friend bool operator==(const ObjCRuntime &left, const ObjCRuntime &right) { return left.getKind() == right.getKind() && left.getVersion() == right.getVersion(); } friend bool operator!=(const ObjCRuntime &left, const ObjCRuntime &right) { return !(left == right); } }; raw_ostream &operator<<(raw_ostream &out, const ObjCRuntime &value); } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TokenKinds.h
//===--- TokenKinds.h - Enum values for C Token Kinds -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::TokenKind enum and support functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TOKENKINDS_H #define LLVM_CLANG_BASIC_TOKENKINDS_H #include "llvm/Support/Compiler.h" namespace clang { namespace tok { /// \brief Provides a simple uniform namespace for tokens from all C languages. enum TokenKind : unsigned short { #define TOK(X) X, #include "clang/Basic/TokenKinds.def" NUM_TOKENS }; /// \brief Provides a namespace for preprocessor keywords which start with a /// '#' at the beginning of the line. enum PPKeywordKind { #define PPKEYWORD(X) pp_##X, #include "clang/Basic/TokenKinds.def" NUM_PP_KEYWORDS }; /// \brief Provides a namespace for Objective-C keywords which start with /// an '@'. enum ObjCKeywordKind { #define OBJC1_AT_KEYWORD(X) objc_##X, #define OBJC2_AT_KEYWORD(X) objc_##X, #include "clang/Basic/TokenKinds.def" NUM_OBJC_KEYWORDS }; /// \brief Defines the possible values of an on-off-switch (C99 6.10.6p2). enum OnOffSwitch { OOS_ON, OOS_OFF, OOS_DEFAULT }; /// \brief Determines the name of a token as used within the front end. /// /// The name of a token will be an internal name (such as "l_square") /// and should not be used as part of diagnostic messages. const char *getTokenName(TokenKind Kind) LLVM_READNONE; /// \brief Determines the spelling of simple punctuation tokens like /// '!' or '%', and returns NULL for literal and annotation tokens. /// /// This routine only retrieves the "simple" spelling of the token, /// and will not produce any alternative spellings (e.g., a /// digraph). For the actual spelling of a given Token, use /// Preprocessor::getSpelling(). const char *getPunctuatorSpelling(TokenKind Kind) LLVM_READNONE; /// \brief Determines the spelling of simple keyword and contextual keyword /// tokens like 'int' and 'dynamic_cast'. Returns NULL for other token kinds. const char *getKeywordSpelling(TokenKind Kind) LLVM_READNONE; /// \brief Return true if this is a raw identifier or an identifier kind. inline bool isAnyIdentifier(TokenKind K) { return (K == tok::identifier) || (K == tok::raw_identifier); } /// \brief Return true if this is a C or C++ string-literal (or /// C++11 user-defined-string-literal) token. inline bool isStringLiteral(TokenKind K) { return K == tok::string_literal || K == tok::wide_string_literal || K == tok::utf8_string_literal || K == tok::utf16_string_literal || K == tok::utf32_string_literal; } /// \brief Return true if this is a "literal" kind, like a numeric /// constant, string, etc. inline bool isLiteral(TokenKind K) { return K == tok::numeric_constant || K == tok::char_constant || K == tok::wide_char_constant || K == tok::utf8_char_constant || K == tok::utf16_char_constant || K == tok::utf32_char_constant || isStringLiteral(K) || K == tok::angle_string_literal; } /// \brief Return true if this is any of tok::annot_* kinds. inline bool isAnnotation(TokenKind K) { #define ANNOTATION(NAME) \ if (K == tok::annot_##NAME) \ return true; #include "clang/Basic/TokenKinds.def" return false; } // HLSL Change Starts /// \brief Return true if this is a punctuator token. inline bool isPunctuator(TokenKind K) { #define PUNCTUATOR(NAME, SYMBOL) \ if (K == tok::NAME) \ return true; #include "clang/Basic/TokenKinds.def" #undef PUNCTUATOR return false; } // HLSL Change Ends } // end namespace tok } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsNEON.def
//===--- BuiltinsNEON.def - NEON Builtin function database ------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the NEON-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// #define GET_NEON_BUILTINS #include "clang/Basic/arm_neon.inc" #undef GET_NEON_BUILTINS #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Builtins.h
//===--- Builtins.h - Builtin function header -------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines enum values for all the target-independent builtin /// functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_BUILTINS_H #define LLVM_CLANG_BASIC_BUILTINS_H #include "clang/Basic/LLVM.h" #include <cstring> // VC++ defines 'alloca' as an object-like macro, which interferes with our // builtins. #undef alloca namespace clang { class TargetInfo; class IdentifierTable; class ASTContext; class QualType; class LangOptions; enum LanguageID { GNU_LANG = 0x1, // builtin requires GNU mode. C_LANG = 0x2, // builtin for c only. CXX_LANG = 0x4, // builtin for cplusplus only. OBJC_LANG = 0x8, // builtin for objective-c and objective-c++ MS_LANG = 0x10, // builtin requires MS mode. ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages. ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode. ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode. }; namespace Builtin { enum ID { NotBuiltin = 0, // This is not a builtin function. #define BUILTIN(ID, TYPE, ATTRS) BI##ID, #include "clang/Basic/Builtins.def" FirstTSBuiltin }; struct Info { const char *Name, *Type, *Attributes, *HeaderName; LanguageID builtin_lang; bool operator==(const Info &RHS) const { return !strcmp(Name, RHS.Name) && !strcmp(Type, RHS.Type) && !strcmp(Attributes, RHS.Attributes); } bool operator!=(const Info &RHS) const { return !(*this == RHS); } }; /// \brief Holds information about both target-independent and /// target-specific builtins, allowing easy queries by clients. class Context { const Info *TSRecords; unsigned NumTSRecords; public: Context(); /// \brief Perform target-specific initialization void InitializeTarget(const TargetInfo &Target); /// \brief Mark the identifiers for all the builtins with their /// appropriate builtin ID # and mark any non-portable builtin identifiers as /// such. void InitializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts); /// \brief Populate the vector with the names of all of the builtins. void GetBuiltinNames(SmallVectorImpl<const char *> &Names); /// \brief Return the identifier name for the specified builtin, /// e.g. "__builtin_abs". const char *GetName(unsigned ID) const { return GetRecord(ID).Name; } /// \brief Get the type descriptor string for the specified builtin. const char *GetTypeString(unsigned ID) const { return GetRecord(ID).Type; } /// \brief Return true if this function has no side effects and doesn't /// read memory. bool isConst(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'c') != nullptr; } /// \brief Return true if we know this builtin never throws an exception. bool isNoThrow(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'n') != nullptr; } /// \brief Return true if we know this builtin never returns. bool isNoReturn(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'r') != nullptr; } /// \brief Return true if we know this builtin can return twice. bool isReturnsTwice(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'j') != nullptr; } /// \brief Returns true if this builtin does not perform the side-effects /// of its arguments. bool isUnevaluated(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'u') != nullptr; } /// \brief Return true if this is a builtin for a libc/libm function, /// with a "__builtin_" prefix (e.g. __builtin_abs). bool isLibFunction(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'F') != nullptr; } /// \brief Determines whether this builtin is a predefined libc/libm /// function, such as "malloc", where we know the signature a /// priori. bool isPredefinedLibFunction(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'f') != nullptr; } /// \brief Determines whether this builtin is a predefined compiler-rt/libgcc /// function, such as "__clear_cache", where we know the signature a /// priori. bool isPredefinedRuntimeFunction(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'i') != nullptr; } /// \brief Determines whether this builtin has custom typechecking. bool hasCustomTypechecking(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 't') != nullptr; } /// \brief Determines whether this builtin has a result or any arguments which /// are pointer types. bool hasPtrArgsOrResult(unsigned ID) const { return strchr(GetRecord(ID).Type, '*') != nullptr; } /// \brief Completely forget that the given ID was ever considered a builtin, /// e.g., because the user provided a conflicting signature. void ForgetBuiltin(unsigned ID, IdentifierTable &Table); /// \brief If this is a library function that comes from a specific /// header, retrieve that header name. const char *getHeaderName(unsigned ID) const { return GetRecord(ID).HeaderName; } /// \brief Determine whether this builtin is like printf in its /// formatting rules and, if so, set the index to the format string /// argument and whether this function as a va_list argument. bool isPrintfLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg); /// \brief Determine whether this builtin is like scanf in its /// formatting rules and, if so, set the index to the format string /// argument and whether this function as a va_list argument. bool isScanfLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg); /// \brief Return true if this function has no side effects and doesn't /// read memory, except for possibly errno. /// /// Such functions can be const when the MathErrno lang option is disabled. bool isConstWithoutErrno(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 'e') != nullptr; } private: const Info &GetRecord(unsigned ID) const; /// \brief Is this builtin supported according to the given language options? bool BuiltinIsSupported(const Builtin::Info &BuiltinInfo, const LangOptions &LangOpts); /// \brief Helper function for isPrintfLike and isScanfLike. bool isLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg, const char *Fmt) const; }; } } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/OpenMPKinds.def
//===--- OpenMPKinds.def - OpenMP directives and clauses list ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// \file /// \brief This file defines the list of supported OpenMP directives and /// clauses. /// //===----------------------------------------------------------------------===// #ifndef OPENMP_DIRECTIVE # define OPENMP_DIRECTIVE(Name) #endif #ifndef OPENMP_DIRECTIVE_EXT #define OPENMP_DIRECTIVE_EXT(Name, Str) #endif #ifndef OPENMP_CLAUSE # define OPENMP_CLAUSE(Name, Class) #endif #ifndef OPENMP_PARALLEL_CLAUSE # define OPENMP_PARALLEL_CLAUSE(Name) #endif #ifndef OPENMP_SIMD_CLAUSE # define OPENMP_SIMD_CLAUSE(Name) #endif #ifndef OPENMP_FOR_CLAUSE # define OPENMP_FOR_CLAUSE(Name) #endif #ifndef OPENMP_FOR_SIMD_CLAUSE # define OPENMP_FOR_SIMD_CLAUSE(Name) #endif #ifndef OPENMP_SECTIONS_CLAUSE # define OPENMP_SECTIONS_CLAUSE(Name) #endif #ifndef OPENMP_SINGLE_CLAUSE # define OPENMP_SINGLE_CLAUSE(Name) #endif #ifndef OPENMP_PARALLEL_FOR_CLAUSE # define OPENMP_PARALLEL_FOR_CLAUSE(Name) #endif #ifndef OPENMP_PARALLEL_FOR_SIMD_CLAUSE # define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) #endif #ifndef OPENMP_PARALLEL_SECTIONS_CLAUSE # define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) #endif #ifndef OPENMP_TASK_CLAUSE # define OPENMP_TASK_CLAUSE(Name) #endif #ifndef OPENMP_ATOMIC_CLAUSE # define OPENMP_ATOMIC_CLAUSE(Name) #endif #ifndef OPENMP_TARGET_CLAUSE # define OPENMP_TARGET_CLAUSE(Name) #endif #ifndef OPENMP_TEAMS_CLAUSE # define OPENMP_TEAMS_CLAUSE(Name) #endif #ifndef OPENMP_DEFAULT_KIND # define OPENMP_DEFAULT_KIND(Name) #endif #ifndef OPENMP_PROC_BIND_KIND # define OPENMP_PROC_BIND_KIND(Name) #endif #ifndef OPENMP_SCHEDULE_KIND #define OPENMP_SCHEDULE_KIND(Name) #endif #ifndef OPENMP_DEPEND_KIND #define OPENMP_DEPEND_KIND(Name) #endif // OpenMP directives. OPENMP_DIRECTIVE(threadprivate) OPENMP_DIRECTIVE(parallel) OPENMP_DIRECTIVE(task) OPENMP_DIRECTIVE(simd) OPENMP_DIRECTIVE(for) OPENMP_DIRECTIVE(sections) OPENMP_DIRECTIVE(section) OPENMP_DIRECTIVE(single) OPENMP_DIRECTIVE(master) OPENMP_DIRECTIVE(critical) OPENMP_DIRECTIVE(taskyield) OPENMP_DIRECTIVE(barrier) OPENMP_DIRECTIVE(taskwait) OPENMP_DIRECTIVE(taskgroup) OPENMP_DIRECTIVE(flush) OPENMP_DIRECTIVE(ordered) OPENMP_DIRECTIVE(atomic) OPENMP_DIRECTIVE(target) OPENMP_DIRECTIVE(teams) OPENMP_DIRECTIVE(cancel) OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for") OPENMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd") OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections") OPENMP_DIRECTIVE_EXT(for_simd, "for simd") OPENMP_DIRECTIVE_EXT(cancellation_point, "cancellation point") // OpenMP clauses. OPENMP_CLAUSE(if, OMPIfClause) OPENMP_CLAUSE(final, OMPFinalClause) OPENMP_CLAUSE(num_threads, OMPNumThreadsClause) OPENMP_CLAUSE(safelen, OMPSafelenClause) OPENMP_CLAUSE(collapse, OMPCollapseClause) OPENMP_CLAUSE(default, OMPDefaultClause) OPENMP_CLAUSE(private, OMPPrivateClause) OPENMP_CLAUSE(firstprivate, OMPFirstprivateClause) OPENMP_CLAUSE(lastprivate, OMPLastprivateClause) OPENMP_CLAUSE(shared, OMPSharedClause) OPENMP_CLAUSE(reduction, OMPReductionClause) OPENMP_CLAUSE(linear, OMPLinearClause) OPENMP_CLAUSE(aligned, OMPAlignedClause) OPENMP_CLAUSE(copyin, OMPCopyinClause) OPENMP_CLAUSE(copyprivate, OMPCopyprivateClause) OPENMP_CLAUSE(proc_bind, OMPProcBindClause) OPENMP_CLAUSE(schedule, OMPScheduleClause) OPENMP_CLAUSE(ordered, OMPOrderedClause) OPENMP_CLAUSE(nowait, OMPNowaitClause) OPENMP_CLAUSE(untied, OMPUntiedClause) OPENMP_CLAUSE(mergeable, OMPMergeableClause) OPENMP_CLAUSE(flush, OMPFlushClause) OPENMP_CLAUSE(read, OMPReadClause) OPENMP_CLAUSE(write, OMPWriteClause) OPENMP_CLAUSE(update, OMPUpdateClause) OPENMP_CLAUSE(capture, OMPCaptureClause) OPENMP_CLAUSE(seq_cst, OMPSeqCstClause) OPENMP_CLAUSE(depend, OMPDependClause) // Clauses allowed for OpenMP directive 'parallel'. OPENMP_PARALLEL_CLAUSE(if) OPENMP_PARALLEL_CLAUSE(num_threads) OPENMP_PARALLEL_CLAUSE(default) OPENMP_PARALLEL_CLAUSE(proc_bind) OPENMP_PARALLEL_CLAUSE(private) OPENMP_PARALLEL_CLAUSE(firstprivate) OPENMP_PARALLEL_CLAUSE(shared) OPENMP_PARALLEL_CLAUSE(reduction) OPENMP_PARALLEL_CLAUSE(copyin) // Clauses allowed for directive 'omp simd'. OPENMP_SIMD_CLAUSE(private) OPENMP_SIMD_CLAUSE(lastprivate) OPENMP_SIMD_CLAUSE(linear) OPENMP_SIMD_CLAUSE(aligned) OPENMP_SIMD_CLAUSE(safelen) OPENMP_SIMD_CLAUSE(collapse) OPENMP_SIMD_CLAUSE(reduction) // Clauses allowed for directive 'omp for'. OPENMP_FOR_CLAUSE(private) OPENMP_FOR_CLAUSE(lastprivate) OPENMP_FOR_CLAUSE(firstprivate) OPENMP_FOR_CLAUSE(reduction) OPENMP_FOR_CLAUSE(collapse) OPENMP_FOR_CLAUSE(schedule) OPENMP_FOR_CLAUSE(ordered) OPENMP_FOR_CLAUSE(nowait) // Clauses allowed for directive 'omp for simd'. OPENMP_FOR_SIMD_CLAUSE(private) OPENMP_FOR_SIMD_CLAUSE(firstprivate) OPENMP_FOR_SIMD_CLAUSE(lastprivate) OPENMP_FOR_SIMD_CLAUSE(reduction) OPENMP_FOR_SIMD_CLAUSE(schedule) OPENMP_FOR_SIMD_CLAUSE(collapse) OPENMP_FOR_SIMD_CLAUSE(nowait) OPENMP_FOR_SIMD_CLAUSE(safelen) OPENMP_FOR_SIMD_CLAUSE(linear) OPENMP_FOR_SIMD_CLAUSE(aligned) // Clauses allowed for OpenMP directive 'omp sections'. OPENMP_SECTIONS_CLAUSE(private) OPENMP_SECTIONS_CLAUSE(lastprivate) OPENMP_SECTIONS_CLAUSE(firstprivate) OPENMP_SECTIONS_CLAUSE(reduction) OPENMP_SECTIONS_CLAUSE(nowait) // Clauses allowed for directive 'omp single'. OPENMP_SINGLE_CLAUSE(private) OPENMP_SINGLE_CLAUSE(firstprivate) OPENMP_SINGLE_CLAUSE(copyprivate) OPENMP_SINGLE_CLAUSE(nowait) // Static attributes for 'default' clause. OPENMP_DEFAULT_KIND(none) OPENMP_DEFAULT_KIND(shared) // Static attributes for 'proc_bind' clause. OPENMP_PROC_BIND_KIND(master) OPENMP_PROC_BIND_KIND(close) OPENMP_PROC_BIND_KIND(spread) // Static attributes for 'schedule' clause. OPENMP_SCHEDULE_KIND(static) OPENMP_SCHEDULE_KIND(dynamic) OPENMP_SCHEDULE_KIND(guided) OPENMP_SCHEDULE_KIND(auto) OPENMP_SCHEDULE_KIND(runtime) // Static attributes for 'depend' clause. OPENMP_DEPEND_KIND(in) OPENMP_DEPEND_KIND(out) OPENMP_DEPEND_KIND(inout) // Clauses allowed for OpenMP directive 'parallel for'. OPENMP_PARALLEL_FOR_CLAUSE(if) OPENMP_PARALLEL_FOR_CLAUSE(num_threads) OPENMP_PARALLEL_FOR_CLAUSE(default) OPENMP_PARALLEL_FOR_CLAUSE(proc_bind) OPENMP_PARALLEL_FOR_CLAUSE(private) OPENMP_PARALLEL_FOR_CLAUSE(firstprivate) OPENMP_PARALLEL_FOR_CLAUSE(shared) OPENMP_PARALLEL_FOR_CLAUSE(reduction) OPENMP_PARALLEL_FOR_CLAUSE(copyin) OPENMP_PARALLEL_FOR_CLAUSE(lastprivate) OPENMP_PARALLEL_FOR_CLAUSE(collapse) OPENMP_PARALLEL_FOR_CLAUSE(schedule) OPENMP_PARALLEL_FOR_CLAUSE(ordered) // Clauses allowed for OpenMP directive 'parallel for simd'. OPENMP_PARALLEL_FOR_SIMD_CLAUSE(if) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(num_threads) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(default) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(proc_bind) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(private) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(firstprivate) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(shared) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(reduction) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(copyin) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(lastprivate) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(collapse) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(schedule) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(safelen) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(linear) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(aligned) // Clauses allowed for OpenMP directive 'parallel sections'. OPENMP_PARALLEL_SECTIONS_CLAUSE(if) OPENMP_PARALLEL_SECTIONS_CLAUSE(num_threads) OPENMP_PARALLEL_SECTIONS_CLAUSE(default) OPENMP_PARALLEL_SECTIONS_CLAUSE(proc_bind) OPENMP_PARALLEL_SECTIONS_CLAUSE(private) OPENMP_PARALLEL_SECTIONS_CLAUSE(firstprivate) OPENMP_PARALLEL_SECTIONS_CLAUSE(shared) OPENMP_PARALLEL_SECTIONS_CLAUSE(reduction) OPENMP_PARALLEL_SECTIONS_CLAUSE(copyin) OPENMP_PARALLEL_SECTIONS_CLAUSE(lastprivate) // Clauses allowed for OpenMP directive 'task'. OPENMP_TASK_CLAUSE(if) OPENMP_TASK_CLAUSE(final) OPENMP_TASK_CLAUSE(default) OPENMP_TASK_CLAUSE(private) OPENMP_TASK_CLAUSE(firstprivate) OPENMP_TASK_CLAUSE(shared) OPENMP_TASK_CLAUSE(untied) OPENMP_TASK_CLAUSE(mergeable) OPENMP_TASK_CLAUSE(depend) // Clauses allowed for OpenMP directive 'atomic'. OPENMP_ATOMIC_CLAUSE(read) OPENMP_ATOMIC_CLAUSE(write) OPENMP_ATOMIC_CLAUSE(update) OPENMP_ATOMIC_CLAUSE(capture) OPENMP_ATOMIC_CLAUSE(seq_cst) // Clauses allowed for OpenMP directive 'target'. // TODO More clauses for 'target' directive. OPENMP_TARGET_CLAUSE(if) // Clauses allowed for OpenMP directive 'teams'. // TODO More clauses for 'teams' directive. OPENMP_TEAMS_CLAUSE(default) OPENMP_TEAMS_CLAUSE(private) OPENMP_TEAMS_CLAUSE(firstprivate) OPENMP_TEAMS_CLAUSE(shared) OPENMP_TEAMS_CLAUSE(reduction) #undef OPENMP_DEPEND_KIND #undef OPENMP_SCHEDULE_KIND #undef OPENMP_PROC_BIND_KIND #undef OPENMP_DEFAULT_KIND #undef OPENMP_DIRECTIVE #undef OPENMP_DIRECTIVE_EXT #undef OPENMP_CLAUSE #undef OPENMP_SINGLE_CLAUSE #undef OPENMP_SECTIONS_CLAUSE #undef OPENMP_PARALLEL_CLAUSE #undef OPENMP_PARALLEL_FOR_CLAUSE #undef OPENMP_PARALLEL_FOR_SIMD_CLAUSE #undef OPENMP_PARALLEL_SECTIONS_CLAUSE #undef OPENMP_TASK_CLAUSE #undef OPENMP_ATOMIC_CLAUSE #undef OPENMP_TARGET_CLAUSE #undef OPENMP_TEAMS_CLAUSE #undef OPENMP_SIMD_CLAUSE #undef OPENMP_FOR_CLAUSE #undef OPENMP_FOR_SIMD_CLAUSE
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TargetInfo.h
//===--- TargetInfo.h - Expose information about the target -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::TargetInfo interface. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TARGETINFO_H #define LLVM_CLANG_BASIC_TARGETINFO_H #include "clang/Basic/AddressSpaces.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/Specifiers.h" #include "clang/Basic/TargetCXXABI.h" #include "clang/Basic/TargetOptions.h" #include "clang/Basic/VersionTuple.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/DataTypes.h" #include <cassert> #include <string> #include <vector> namespace llvm { struct fltSemantics; } namespace clang { class DiagnosticsEngine; class LangOptions; class MacroBuilder; class SourceLocation; class SourceManager; namespace Builtin { struct Info; } /// \brief Exposes information about the current target. /// class TargetInfo : public RefCountedBase<TargetInfo> { std::shared_ptr<TargetOptions> TargetOpts; llvm::Triple Triple; protected: // Target values set by the ctor of the actual target implementation. Default // values are specified by the TargetInfo constructor. bool BigEndian; bool TLSSupported; bool NoAsmVariants; // True if {|} are normal characters. unsigned char PointerWidth, PointerAlign; unsigned char BoolWidth, BoolAlign; unsigned char IntWidth, IntAlign; unsigned char HalfWidth, HalfAlign; unsigned char FloatWidth, FloatAlign; unsigned char DoubleWidth, DoubleAlign; unsigned char LongDoubleWidth, LongDoubleAlign; unsigned char LargeArrayMinWidth, LargeArrayAlign; unsigned char LongWidth, LongAlign; unsigned char LongLongWidth, LongLongAlign; unsigned char SuitableAlign; unsigned char DefaultAlignForAttributeAligned; unsigned char MinGlobalAlign; unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth; unsigned short MaxVectorAlign; unsigned short MaxTLSAlign; unsigned short SimdDefaultAlign; const char *DescriptionString; const char *UserLabelPrefix; const char *MCountName; const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat, *LongDoubleFormat; unsigned char RegParmMax, SSERegParmMax; TargetCXXABI TheCXXABI; const LangAS::Map *AddrSpaceMap; mutable StringRef PlatformName; mutable VersionTuple PlatformMinVersion; unsigned HasAlignMac68kSupport : 1; unsigned RealTypeUsesObjCFPRet : 3; unsigned ComplexLongDoubleUsesFP2Ret : 1; // TargetInfo Constructor. Default initializes all fields. TargetInfo(const llvm::Triple &T); public: /// \brief Construct a target for the given options. /// /// \param Opts - The options to use to initialize the target. The target may /// modify the options to canonicalize the target feature information to match /// what the backend expects. static TargetInfo * CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr<TargetOptions> &Opts); virtual ~TargetInfo(); /// \brief Retrieve the target options. TargetOptions &getTargetOpts() const { assert(TargetOpts && "Missing target options"); return *TargetOpts; } ///===---- Target Data Type Query Methods -------------------------------===// enum IntType { NoInt = 0, SignedChar, UnsignedChar, SignedShort, UnsignedShort, SignedInt, UnsignedInt, SignedLong, UnsignedLong, SignedLongLong, UnsignedLongLong }; enum RealType { NoFloat = 255, Float = 0, Double, LongDouble }; /// \brief The different kinds of __builtin_va_list types defined by /// the target implementation. enum BuiltinVaListKind { /// typedef char* __builtin_va_list; CharPtrBuiltinVaList = 0, /// typedef void* __builtin_va_list; VoidPtrBuiltinVaList, /// __builtin_va_list as defind by the AArch64 ABI /// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf AArch64ABIBuiltinVaList, /// __builtin_va_list as defined by the PNaCl ABI: /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types PNaClABIBuiltinVaList, /// __builtin_va_list as defined by the Power ABI: /// https://www.power.org /// /resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf PowerABIBuiltinVaList, /// __builtin_va_list as defined by the x86-64 ABI: /// http://www.x86-64.org/documentation/abi.pdf X86_64ABIBuiltinVaList, /// __builtin_va_list as defined by ARM AAPCS ABI /// http://infocenter.arm.com // /help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf AAPCSABIBuiltinVaList, // typedef struct __va_list_tag // { // long __gpr; // long __fpr; // void *__overflow_arg_area; // void *__reg_save_area; // } va_list[1]; SystemZBuiltinVaList }; protected: IntType SizeType, IntMaxType, PtrDiffType, IntPtrType, WCharType, WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType, ProcessIDType; /// \brief Whether Objective-C's built-in boolean type should be signed char. /// /// Otherwise, when this flag is not set, the normal built-in boolean type is /// used. unsigned UseSignedCharForObjCBool : 1; /// Control whether the alignment of bit-field types is respected when laying /// out structures. If true, then the alignment of the bit-field type will be /// used to (a) impact the alignment of the containing structure, and (b) /// ensure that the individual bit-field will not straddle an alignment /// boundary. unsigned UseBitFieldTypeAlignment : 1; /// \brief Whether zero length bitfields (e.g., int : 0;) force alignment of /// the next bitfield. /// /// If the alignment of the zero length bitfield is greater than the member /// that follows it, `bar', `bar' will be aligned as the type of the /// zero-length bitfield. unsigned UseZeroLengthBitfieldAlignment : 1; /// If non-zero, specifies a fixed alignment value for bitfields that follow /// zero length bitfield, regardless of the zero length bitfield type. unsigned ZeroLengthBitfieldBoundary; /// \brief Specify if mangling based on address space map should be used or /// not for language specific address spaces bool UseAddrSpaceMapMangling; public: IntType getSizeType() const { return SizeType; } IntType getIntMaxType() const { return IntMaxType; } IntType getUIntMaxType() const { return getCorrespondingUnsignedType(IntMaxType); } IntType getPtrDiffType(unsigned AddrSpace) const { return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace); } IntType getIntPtrType() const { return IntPtrType; } IntType getUIntPtrType() const { return getCorrespondingUnsignedType(IntPtrType); } IntType getWCharType() const { return WCharType; } IntType getWIntType() const { return WIntType; } IntType getChar16Type() const { return Char16Type; } IntType getChar32Type() const { return Char32Type; } IntType getInt64Type() const { return Int64Type; } IntType getUInt64Type() const { return getCorrespondingUnsignedType(Int64Type); } IntType getSigAtomicType() const { return SigAtomicType; } IntType getProcessIDType() const { return ProcessIDType; } static IntType getCorrespondingUnsignedType(IntType T) { switch (T) { case SignedChar: return UnsignedChar; case SignedShort: return UnsignedShort; case SignedInt: return UnsignedInt; case SignedLong: return UnsignedLong; case SignedLongLong: return UnsignedLongLong; default: llvm_unreachable("Unexpected signed integer type"); } } /// \brief Return the width (in bits) of the specified integer type enum. /// /// For example, SignedInt -> getIntWidth(). unsigned getTypeWidth(IntType T) const; /// \brief Return integer type with specified width. IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const; /// \brief Return the smallest integer type with at least the specified width. IntType getLeastIntTypeByWidth(unsigned BitWidth, bool IsSigned) const; /// \brief Return floating point type with specified width. RealType getRealTypeByWidth(unsigned BitWidth) const; /// \brief Return the alignment (in bits) of the specified integer type enum. /// /// For example, SignedInt -> getIntAlign(). unsigned getTypeAlign(IntType T) const; /// \brief Returns true if the type is signed; false otherwise. static bool isTypeSigned(IntType T); /// \brief Return the width of pointers on this target, for the /// specified address space. uint64_t getPointerWidth(unsigned AddrSpace) const { return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace); } uint64_t getPointerAlign(unsigned AddrSpace) const { return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace); } /// \brief Return the size of '_Bool' and C++ 'bool' for this target, in bits. unsigned getBoolWidth() const { return BoolWidth; } /// \brief Return the alignment of '_Bool' and C++ 'bool' for this target. unsigned getBoolAlign() const { return BoolAlign; } unsigned getCharWidth() const { return 8; } // FIXME unsigned getCharAlign() const { return 8; } // FIXME /// \brief Return the size of 'signed short' and 'unsigned short' for this /// target, in bits. unsigned getShortWidth() const { return 16; } // FIXME /// \brief Return the alignment of 'signed short' and 'unsigned short' for /// this target. unsigned getShortAlign() const { return 16; } // FIXME /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for /// this target, in bits. unsigned getIntWidth() const { return IntWidth; } unsigned getIntAlign() const { return IntAlign; } /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' /// for this target, in bits. unsigned getLongWidth() const { return LongWidth; } unsigned getLongAlign() const { return LongAlign; } /// getLongLongWidth/Align - Return the size of 'signed long long' and /// 'unsigned long long' for this target, in bits. unsigned getLongLongWidth() const { return LongLongWidth; } unsigned getLongLongAlign() const { return LongLongAlign; } /// \brief Determine whether the __int128 type is supported on this target. virtual bool hasInt128Type() const { return getPointerWidth(0) >= 64; } // FIXME /// \brief Return the alignment that is suitable for storing any /// object with a fundamental alignment requirement. unsigned getSuitableAlign() const { return SuitableAlign; } /// \brief Return the default alignment for __attribute__((aligned)) on /// this target, to be used if no alignment value is specified. unsigned getDefaultAlignForAttributeAligned() const { return DefaultAlignForAttributeAligned; } /// getMinGlobalAlign - Return the minimum alignment of a global variable, /// unless its alignment is explicitly reduced via attributes. unsigned getMinGlobalAlign() const { return MinGlobalAlign; } /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in /// bits. unsigned getWCharWidth() const { return getTypeWidth(WCharType); } unsigned getWCharAlign() const { return getTypeAlign(WCharType); } /// getChar16Width/Align - Return the size of 'char16_t' for this target, in /// bits. unsigned getChar16Width() const { return getTypeWidth(Char16Type); } unsigned getChar16Align() const { return getTypeAlign(Char16Type); } /// getChar32Width/Align - Return the size of 'char32_t' for this target, in /// bits. unsigned getChar32Width() const { return getTypeWidth(Char32Type); } unsigned getChar32Align() const { return getTypeAlign(Char32Type); } /// getHalfWidth/Align/Format - Return the size/align/format of 'half'. unsigned getHalfWidth() const { return HalfWidth; } unsigned getHalfAlign() const { return HalfAlign; } const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; } /// getFloatWidth/Align/Format - Return the size/align/format of 'float'. unsigned getFloatWidth() const { return FloatWidth; } unsigned getFloatAlign() const { return FloatAlign; } const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; } /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'. unsigned getDoubleWidth() const { return DoubleWidth; } unsigned getDoubleAlign() const { return DoubleAlign; } const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; } /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long /// double'. unsigned getLongDoubleWidth() const { return LongDoubleWidth; } unsigned getLongDoubleAlign() const { return LongDoubleAlign; } const llvm::fltSemantics &getLongDoubleFormat() const { return *LongDoubleFormat; } /// \brief Return true if the 'long double' type should be mangled like /// __float128. virtual bool useFloat128ManglingForLongDouble() const { return false; } /// \brief Return the value for the C99 FLT_EVAL_METHOD macro. virtual unsigned getFloatEvalMethod() const { return 0; } // getLargeArrayMinWidth/Align - Return the minimum array size that is // 'large' and its alignment. unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; } unsigned getLargeArrayAlign() const { return LargeArrayAlign; } /// \brief Return the maximum width lock-free atomic operation which will /// ever be supported for the given target unsigned getMaxAtomicPromoteWidth() const { return MaxAtomicPromoteWidth; } /// \brief Return the maximum width lock-free atomic operation which can be /// inlined given the supported features of the given target. unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; } /// \brief Returns true if the given target supports lock-free atomic /// operations at the specified width and alignment. virtual bool hasBuiltinAtomic(uint64_t AtomicSizeInBits, uint64_t AlignmentInBits) const { return AtomicSizeInBits <= AlignmentInBits && AtomicSizeInBits <= getMaxAtomicInlineWidth() && (AtomicSizeInBits <= getCharWidth() || llvm::isPowerOf2_64(AtomicSizeInBits / getCharWidth())); } /// \brief Return the maximum vector alignment supported for the given target. unsigned getMaxVectorAlign() const { return MaxVectorAlign; } /// \brief Return default simd alignment for the given target. Generally, this /// value is type-specific, but this alignment can be used for most of the /// types for the given target. unsigned getSimdDefaultAlign() const { return SimdDefaultAlign; } /// \brief Return the size of intmax_t and uintmax_t for this target, in bits. unsigned getIntMaxTWidth() const { return getTypeWidth(IntMaxType); } // Return the size of unwind_word for this target. unsigned getUnwindWordWidth() const { return getPointerWidth(0); } /// \brief Return the "preferred" register width on this target. unsigned getRegisterWidth() const { // Currently we assume the register width on the target matches the pointer // width, we can introduce a new variable for this if/when some target wants // it. return PointerWidth; } /// \brief Returns the default value of the __USER_LABEL_PREFIX__ macro, /// which is the prefix given to user symbols by default. /// /// On most platforms this is "_", but it is "" on some, and "." on others. const char *getUserLabelPrefix() const { return UserLabelPrefix; } /// \brief Returns the name of the mcount instrumentation function. const char *getMCountName() const { return MCountName; } /// \brief Check if the Objective-C built-in boolean type should be signed /// char. /// /// Otherwise, if this returns false, the normal built-in boolean type /// should also be used for Objective-C. bool useSignedCharForObjCBool() const { return UseSignedCharForObjCBool; } void noSignedCharForObjCBool() { UseSignedCharForObjCBool = false; } /// \brief Check whether the alignment of bit-field types is respected /// when laying out structures. bool useBitFieldTypeAlignment() const { return UseBitFieldTypeAlignment; } /// \brief Check whether zero length bitfields should force alignment of /// the next member. bool useZeroLengthBitfieldAlignment() const { return UseZeroLengthBitfieldAlignment; } /// \brief Get the fixed alignment value in bits for a member that follows /// a zero length bitfield. unsigned getZeroLengthBitfieldBoundary() const { return ZeroLengthBitfieldBoundary; } /// \brief Check whether this target support '\#pragma options align=mac68k'. bool hasAlignMac68kSupport() const { return HasAlignMac68kSupport; } /// \brief Return the user string for the specified integer type enum. /// /// For example, SignedShort -> "short". static const char *getTypeName(IntType T); /// \brief Return the constant suffix for the specified integer type enum. /// /// For example, SignedLong -> "L". const char *getTypeConstantSuffix(IntType T) const; /// \brief Return the printf format modifier for the specified /// integer type enum. /// /// For example, SignedLong -> "l". static const char *getTypeFormatModifier(IntType T); /// \brief Check whether the given real type should use the "fpret" flavor of /// Objective-C message passing on this target. bool useObjCFPRetForRealType(RealType T) const { return RealTypeUsesObjCFPRet & (1 << T); } /// \brief Check whether _Complex long double should use the "fp2ret" flavor /// of Objective-C message passing on this target. bool useObjCFP2RetForComplexLongDouble() const { return ComplexLongDoubleUsesFP2Ret; } /// \brief Specify if mangling based on address space map should be used or /// not for language specific address spaces bool useAddressSpaceMapMangling() const { return UseAddrSpaceMapMangling; } ///===---- Other target property query methods --------------------------===// /// \brief Appends the target-specific \#define values for this /// target set to the specified buffer. virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const = 0; /// Return information about target-specific builtins for /// the current primary target, and info about which builtins are non-portable /// across the current set of primary and secondary targets. virtual void getTargetBuiltins(const Builtin::Info *&Records, unsigned &NumRecords) const = 0; /// The __builtin_clz* and __builtin_ctz* built-in /// functions are specified to have undefined results for zero inputs, but /// on targets that support these operations in a way that provides /// well-defined results for zero without loss of performance, it is a good /// idea to avoid optimizing based on that undef behavior. virtual bool isCLZForZeroUndef() const { return true; } /// \brief Returns the kind of __builtin_va_list type that should be used /// with this target. virtual BuiltinVaListKind getBuiltinVaListKind() const = 0; /// \brief Returns whether the passed in string is a valid clobber in an /// inline asm statement. /// /// This is used by Sema. bool isValidClobber(StringRef Name) const; /// \brief Returns whether the passed in string is a valid register name /// according to GCC. /// /// This is used by Sema for inline asm statements. bool isValidGCCRegisterName(StringRef Name) const; /// \brief Returns the "normalized" GCC register name. /// /// For example, on x86 it will return "ax" when "eax" is passed in. StringRef getNormalizedGCCRegisterName(StringRef Name) const; struct ConstraintInfo { enum { CI_None = 0x00, CI_AllowsMemory = 0x01, CI_AllowsRegister = 0x02, CI_ReadWrite = 0x04, // "+r" output constraint (read and write). CI_HasMatchingInput = 0x08, // This output operand has a matching input. CI_ImmediateConstant = 0x10, // This operand must be an immediate constant CI_EarlyClobber = 0x20, // "&" output constraint (early clobber). }; unsigned Flags; int TiedOperand; struct { int Min; int Max; } ImmRange; std::string ConstraintStr; // constraint: "=rm" std::string Name; // Operand name: [foo] with no []'s. public: ConstraintInfo(StringRef ConstraintStr, StringRef Name) : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()), Name(Name.str()) { ImmRange.Min = ImmRange.Max = 0; } const std::string &getConstraintStr() const { return ConstraintStr; } const std::string &getName() const { return Name; } bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; } bool earlyClobber() { return (Flags & CI_EarlyClobber) != 0; } bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; } bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; } /// \brief Return true if this output operand has a matching /// (tied) input operand. bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; } /// \brief Return true if this input operand is a matching /// constraint that ties it to an output operand. /// /// If this returns true then getTiedOperand will indicate which output /// operand this is tied to. bool hasTiedOperand() const { return TiedOperand != -1; } unsigned getTiedOperand() const { assert(hasTiedOperand() && "Has no tied operand!"); return (unsigned)TiedOperand; } bool requiresImmediateConstant() const { return (Flags & CI_ImmediateConstant) != 0; } int getImmConstantMin() const { return ImmRange.Min; } int getImmConstantMax() const { return ImmRange.Max; } void setIsReadWrite() { Flags |= CI_ReadWrite; } void setEarlyClobber() { Flags |= CI_EarlyClobber; } void setAllowsMemory() { Flags |= CI_AllowsMemory; } void setAllowsRegister() { Flags |= CI_AllowsRegister; } void setHasMatchingInput() { Flags |= CI_HasMatchingInput; } void setRequiresImmediate(int Min, int Max) { Flags |= CI_ImmediateConstant; ImmRange.Min = Min; ImmRange.Max = Max; } /// \brief Indicate that this is an input operand that is tied to /// the specified output operand. /// /// Copy over the various constraint information from the output. void setTiedOperand(unsigned N, ConstraintInfo &Output) { Output.setHasMatchingInput(); Flags = Output.Flags; TiedOperand = N; // Don't copy Name or constraint string. } }; // Validate the contents of the __builtin_cpu_supports(const char*) argument. virtual bool validateCpuSupports(StringRef Name) const { return false; } // validateOutputConstraint, validateInputConstraint - Checks that // a constraint is valid and provides information about it. // FIXME: These should return a real error instead of just true/false. bool validateOutputConstraint(ConstraintInfo &Info) const; bool validateInputConstraint(ConstraintInfo *OutputConstraints, unsigned NumOutputs, ConstraintInfo &info) const; virtual bool validateOutputSize(StringRef /*Constraint*/, unsigned /*Size*/) const { return true; } virtual bool validateInputSize(StringRef /*Constraint*/, unsigned /*Size*/) const { return true; } virtual bool validateConstraintModifier(StringRef /*Constraint*/, char /*Modifier*/, unsigned /*Size*/, std::string &/*SuggestedModifier*/) const { return true; } bool resolveSymbolicName(const char *&Name, ConstraintInfo *OutputConstraints, unsigned NumOutputs, unsigned &Index) const; // Constraint parm will be left pointing at the last character of // the constraint. In practice, it won't be changed unless the // constraint is longer than one character. virtual std::string convertConstraint(const char *&Constraint) const { // 'p' defaults to 'r', but can be overridden by targets. if (*Constraint == 'p') return std::string("r"); return std::string(1, *Constraint); } /// \brief Returns true if NaN encoding is IEEE 754-2008. /// Only MIPS allows a different encoding. virtual bool isNan2008() const { return true; } /// \brief Returns a string of target-specific clobbers, in LLVM format. virtual const char *getClobbers() const = 0; /// \brief Returns the target triple of the primary target. const llvm::Triple &getTriple() const { return Triple; } const char *getTargetDescription() const { assert(DescriptionString); return DescriptionString; } struct GCCRegAlias { const char * const Aliases[5]; const char * const Register; }; struct AddlRegName { const char * const Names[5]; const unsigned RegNum; }; /// \brief Does this target support "protected" visibility? /// /// Any target which dynamic libraries will naturally support /// something like "default" (meaning that the symbol is visible /// outside this shared object) and "hidden" (meaning that it isn't) /// visibilities, but "protected" is really an ELF-specific concept /// with weird semantics designed around the convenience of dynamic /// linker implementations. Which is not to suggest that there's /// consistent target-independent semantics for "default" visibility /// either; the entire thing is pretty badly mangled. virtual bool hasProtectedVisibility() const { return true; } /// \brief An optional hook that targets can implement to perform semantic /// checking on attribute((section("foo"))) specifiers. /// /// In this case, "foo" is passed in to be checked. If the section /// specifier is invalid, the backend should return a non-empty string /// that indicates the problem. /// /// This hook is a simple quality of implementation feature to catch errors /// and give good diagnostics in cases when the assembler or code generator /// would otherwise reject the section specifier. /// virtual std::string isValidSectionSpecifier(StringRef SR) const { return ""; } /// \brief Set forced language options. /// /// Apply changes to the target information with respect to certain /// language options which change the target configuration. virtual void adjust(const LangOptions &Opts); /// \brief Get the default set of target features for the CPU; /// this should include all legal feature strings on the target. virtual void getDefaultFeatures(llvm::StringMap<bool> &Features) const { } /// \brief Get the ABI currently in use. virtual StringRef getABI() const { return StringRef(); } /// \brief Get the C++ ABI currently in use. TargetCXXABI getCXXABI() const { return TheCXXABI; } /// \brief Target the specified CPU. /// /// \return False on error (invalid CPU name). virtual bool setCPU(const std::string &Name) { return false; } /// \brief Use the specified ABI. /// /// \return False on error (invalid ABI name). virtual bool setABI(const std::string &Name) { return false; } /// \brief Use the specified unit for FP math. /// /// \return False on error (invalid unit name). virtual bool setFPMath(StringRef Name) { return false; } /// \brief Use this specified C++ ABI. /// /// \return False on error (invalid C++ ABI name). bool setCXXABI(llvm::StringRef name) { TargetCXXABI ABI; if (!ABI.tryParse(name)) return false; return setCXXABI(ABI); } /// \brief Set the C++ ABI to be used by this implementation. /// /// \return False on error (ABI not valid on this target) virtual bool setCXXABI(TargetCXXABI ABI) { TheCXXABI = ABI; return true; } /// \brief Enable or disable a specific target feature; /// the feature name must be valid. virtual void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name, bool Enabled) const { Features[Name] = Enabled; } /// \brief Perform initialization based on the user configured /// set of features (e.g., +sse4). /// /// The list is guaranteed to have at most one entry per feature. /// /// The target may modify the features list, to change which options are /// passed onwards to the backend. /// /// \return False on error. virtual bool handleTargetFeatures(std::vector<std::string> &Features, DiagnosticsEngine &Diags) { return true; } /// \brief Determine whether the given target has the given feature. virtual bool hasFeature(StringRef Feature) const { return false; } // \brief Returns maximal number of args passed in registers. unsigned getRegParmMax() const { assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle"); return RegParmMax; } /// \brief Whether the target supports thread-local storage. bool isTLSSupported() const { return TLSSupported; } /// \brief Return the maximum alignment (in bits) of a TLS variable /// /// Gets the maximum alignment (in bits) of a TLS variable on this target. /// Returns zero if there is no such constraint. unsigned short getMaxTLSAlign() const { return MaxTLSAlign; } /// \brief Whether the target supports SEH __try. bool isSEHTrySupported() const { return getTriple().isOSWindows() && (getTriple().getArch() == llvm::Triple::x86 || getTriple().getArch() == llvm::Triple::x86_64); } /// \brief Return true if {|} are normal characters in the asm string. /// /// If this returns false (the default), then {abc|xyz} is syntax /// that says that when compiling for asm variant #0, "abc" should be /// generated, but when compiling for asm variant #1, "xyz" should be /// generated. bool hasNoAsmVariants() const { return NoAsmVariants; } /// \brief Return the register number that __builtin_eh_return_regno would /// return with the specified argument. virtual int getEHDataRegisterNumber(unsigned RegNo) const { return -1; } /// \brief Return the section to use for C++ static initialization functions. virtual const char *getStaticInitSectionSpecifier() const { return nullptr; } const LangAS::Map &getAddressSpaceMap() const { return *AddrSpaceMap; } /// \brief Retrieve the name of the platform as it is used in the /// availability attribute. StringRef getPlatformName() const { return PlatformName; } /// \brief Retrieve the minimum desired version of the platform, to /// which the program should be compiled. VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; } bool isBigEndian() const { return BigEndian; } enum CallingConvMethodType { CCMT_Unknown, CCMT_Member, CCMT_NonMember }; /// \brief Gets the default calling convention for the given target and /// declaration context. virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const { // Not all targets will specify an explicit calling convention that we can // express. This will always do the right thing, even though it's not // an explicit calling convention. return CC_C; } enum CallingConvCheckResult { CCCR_OK, CCCR_Warning, CCCR_Ignore, }; /// \brief Determines whether a given calling convention is valid for the /// target. A calling convention can either be accepted, produce a warning /// and be substituted with the default calling convention, or (someday) /// produce an error (such as using thiscall on a non-instance function). virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const { switch (CC) { default: return CCCR_Warning; case CC_C: return CCCR_OK; } } /// Controls if __builtin_longjmp / __builtin_setjmp can be lowered to /// llvm.eh.sjlj.longjmp / llvm.eh.sjlj.setjmp. virtual bool hasSjLjLowering() const { return false; } protected: virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return PointerWidth; } virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { return PointerAlign; } virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const { return PtrDiffType; } virtual void getGCCRegNames(const char * const *&Names, unsigned &NumNames) const = 0; virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, unsigned &NumAliases) const = 0; virtual void getGCCAddlRegNames(const AddlRegName *&Addl, unsigned &NumAddl) const { Addl = nullptr; NumAddl = 0; } virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const= 0; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/DiagnosticCategories.h
//===- DiagnosticCategories.h - Diagnostic Categories Enumerators-*- C++ -*===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_DIAGNOSTICCATEGORIES_H #define LLVM_CLANG_BASIC_DIAGNOSTICCATEGORIES_H namespace clang { namespace diag { enum { #define GET_CATEGORY_TABLE #define CATEGORY(X, ENUM) ENUM, #include "clang/Basic/DiagnosticGroups.inc" #undef CATEGORY #undef GET_CATEGORY_TABLE DiagCat_NUM_CATEGORIES }; } // end namespace diag } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/AddressSpaces.h
//===--- AddressSpaces.h - Language-specific address spaces -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Provides definitions for the various language-specific address /// spaces. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_ADDRESSSPACES_H #define LLVM_CLANG_BASIC_ADDRESSSPACES_H namespace clang { namespace LangAS { /// \brief Defines the set of possible language-specific address spaces. /// /// This uses a high starting offset so as not to conflict with any address /// space used by a target. enum ID { Offset = 0xFFFF00, opencl_global = Offset, opencl_local, opencl_constant, opencl_generic, cuda_device, cuda_constant, cuda_shared, Last, Count = Last-Offset }; /// The type of a lookup table which maps from language-specific address spaces /// to target-specific ones. typedef unsigned Map[Count]; } } #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsDXIL.def
//===--- BuiltinsDXIL.def - DXIL Builtin function database ----*- C++ -*-===// /////////////////////////////////////////////////////////////////////////////// // // // BuiltinsDXIL.def // // Copyright (C) Microsoft Corporation. All rights reserved. // // This file is distributed under the University of Illinois Open Source // // License. See LICENSE.TXT for details. // // // // This file defines the PTX-specific builtin function database. Users of // // this file must define the BUILTIN macro to make use of this information. // // // /////////////////////////////////////////////////////////////////////////////// // The format of this database matches clang/Basic/Builtins.def. // // Just make DXILTargetInfo compiles for now. BUILTIN(__builtin_dxil_fabs, "ff", "n") BUILTIN(__builtin_dxil_fabsh, "hh", "n") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Module.h
//===--- Module.h - Describe a module ---------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::Module class, which describes a module in the /// source code. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_MODULE_H #define LLVM_CLANG_BASIC_MODULE_H #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include <string> #include <utility> #include <vector> namespace llvm { class raw_ostream; } namespace clang { class DirectoryEntry; class FileEntry; class FileManager; class LangOptions; class TargetInfo; class IdentifierInfo; /// \brief Describes the name of a module. typedef SmallVector<std::pair<std::string, SourceLocation>, 2> ModuleId; /// \brief Describes a module or submodule. class Module { public: /// \brief The name of this module. std::string Name; /// \brief The location of the module definition. SourceLocation DefinitionLoc; /// \brief The parent of this module. This will be NULL for the top-level /// module. Module *Parent; /// \brief The build directory of this module. This is the directory in /// which the module is notionally built, and relative to which its headers /// are found. const DirectoryEntry *Directory; /// \brief The umbrella header or directory. llvm::PointerUnion<const DirectoryEntry *, const FileEntry *> Umbrella; /// \brief The module signature. uint64_t Signature; /// \brief The name of the umbrella entry, as written in the module map. std::string UmbrellaAsWritten; private: /// \brief The submodules of this module, indexed by name. std::vector<Module *> SubModules; /// \brief A mapping from the submodule name to the index into the /// \c SubModules vector at which that submodule resides. llvm::StringMap<unsigned> SubModuleIndex; /// \brief The AST file if this is a top-level module which has a /// corresponding serialized AST file, or null otherwise. const FileEntry *ASTFile; /// \brief The top-level headers associated with this module. llvm::SmallSetVector<const FileEntry *, 2> TopHeaders; /// \brief top-level header filenames that aren't resolved to FileEntries yet. std::vector<std::string> TopHeaderNames; /// \brief Cache of modules visible to lookup in this module. mutable llvm::DenseSet<const Module*> VisibleModulesCache; /// The ID used when referencing this module within a VisibleModuleSet. unsigned VisibilityID; public: enum HeaderKind { HK_Normal, HK_Textual, HK_Private, HK_PrivateTextual, HK_Excluded }; static const int NumHeaderKinds = HK_Excluded + 1; /// \brief Information about a header directive as found in the module map /// file. struct Header { std::string NameAsWritten; const FileEntry *Entry; explicit operator bool() { return Entry; } }; /// \brief Information about a directory name as found in the module map /// file. struct DirectoryName { std::string NameAsWritten; const DirectoryEntry *Entry; explicit operator bool() { return Entry; } }; /// \brief The headers that are part of this module. SmallVector<Header, 2> Headers[5]; /// \brief Stored information about a header directive that was found in the /// module map file but has not been resolved to a file. struct UnresolvedHeaderDirective { SourceLocation FileNameLoc; std::string FileName; bool IsUmbrella; }; /// \brief Headers that are mentioned in the module map file but could not be /// found on the file system. SmallVector<UnresolvedHeaderDirective, 1> MissingHeaders; /// \brief An individual requirement: a feature name and a flag indicating /// the required state of that feature. typedef std::pair<std::string, bool> Requirement; /// \brief The set of language features required to use this module. /// /// If any of these requirements are not available, the \c IsAvailable bit /// will be false to indicate that this (sub)module is not available. SmallVector<Requirement, 2> Requirements; /// \brief Whether this module is missing a feature from \c Requirements. unsigned IsMissingRequirement : 1; /// \brief Whether this module is available in the current translation unit. /// /// If the module is missing headers or does not meet all requirements then /// this bit will be 0. unsigned IsAvailable : 1; /// \brief Whether this module was loaded from a module file. unsigned IsFromModuleFile : 1; /// \brief Whether this is a framework module. unsigned IsFramework : 1; /// \brief Whether this is an explicit submodule. unsigned IsExplicit : 1; /// \brief Whether this is a "system" module (which assumes that all /// headers in it are system headers). unsigned IsSystem : 1; /// \brief Whether this is an 'extern "C"' module (which implicitly puts all /// headers in it within an 'extern "C"' block, and allows the module to be /// imported within such a block). unsigned IsExternC : 1; /// \brief Whether this is an inferred submodule (module * { ... }). unsigned IsInferred : 1; /// \brief Whether we should infer submodules for this module based on /// the headers. /// /// Submodules can only be inferred for modules with an umbrella header. unsigned InferSubmodules : 1; /// \brief Whether, when inferring submodules, the inferred submodules /// should be explicit. unsigned InferExplicitSubmodules : 1; /// \brief Whether, when inferring submodules, the inferr submodules should /// export all modules they import (e.g., the equivalent of "export *"). unsigned InferExportWildcard : 1; /// \brief Whether the set of configuration macros is exhaustive. /// /// When the set of configuration macros is exhaustive, meaning /// that no identifier not in this list should affect how the module is /// built. unsigned ConfigMacrosExhaustive : 1; /// \brief Describes the visibility of the various names within a /// particular module. enum NameVisibilityKind { /// \brief All of the names in this module are hidden. Hidden, /// \brief All of the names in this module are visible. AllVisible }; /// \brief The visibility of names within this particular module. NameVisibilityKind NameVisibility; /// \brief The location of the inferred submodule. SourceLocation InferredSubmoduleLoc; /// \brief The set of modules imported by this module, and on which this /// module depends. llvm::SmallSetVector<Module *, 2> Imports; /// \brief Describes an exported module. /// /// The pointer is the module being re-exported, while the bit will be true /// to indicate that this is a wildcard export. typedef llvm::PointerIntPair<Module *, 1, bool> ExportDecl; /// \brief The set of export declarations. SmallVector<ExportDecl, 2> Exports; /// \brief Describes an exported module that has not yet been resolved /// (perhaps because the module it refers to has not yet been loaded). struct UnresolvedExportDecl { /// \brief The location of the 'export' keyword in the module map file. SourceLocation ExportLoc; /// \brief The name of the module. ModuleId Id; /// \brief Whether this export declaration ends in a wildcard, indicating /// that all of its submodules should be exported (rather than the named /// module itself). bool Wildcard; }; /// \brief The set of export declarations that have yet to be resolved. SmallVector<UnresolvedExportDecl, 2> UnresolvedExports; /// \brief The directly used modules. SmallVector<Module *, 2> DirectUses; /// \brief The set of use declarations that have yet to be resolved. SmallVector<ModuleId, 2> UnresolvedDirectUses; /// \brief A library or framework to link against when an entity from this /// module is used. struct LinkLibrary { LinkLibrary() : IsFramework(false) { } LinkLibrary(const std::string &Library, bool IsFramework) : Library(Library), IsFramework(IsFramework) { } /// \brief The library to link against. /// /// This will typically be a library or framework name, but can also /// be an absolute path to the library or framework. std::string Library; /// \brief Whether this is a framework rather than a library. bool IsFramework; }; /// \brief The set of libraries or frameworks to link against when /// an entity from this module is used. llvm::SmallVector<LinkLibrary, 2> LinkLibraries; /// \brief The set of "configuration macros", which are macros that /// (intentionally) change how this module is built. std::vector<std::string> ConfigMacros; /// \brief An unresolved conflict with another module. struct UnresolvedConflict { /// \brief The (unresolved) module id. ModuleId Id; /// \brief The message provided to the user when there is a conflict. std::string Message; }; /// \brief The list of conflicts for which the module-id has not yet been /// resolved. std::vector<UnresolvedConflict> UnresolvedConflicts; /// \brief A conflict between two modules. struct Conflict { /// \brief The module that this module conflicts with. Module *Other; /// \brief The message provided to the user when there is a conflict. std::string Message; }; /// \brief The list of conflicts. std::vector<Conflict> Conflicts; /// \brief Construct a new module or submodule. Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit, unsigned VisibilityID); ~Module(); /// \brief Determine whether this module is available for use within the /// current translation unit. bool isAvailable() const { return IsAvailable; } /// \brief Determine whether this module is available for use within the /// current translation unit. /// /// \param LangOpts The language options used for the current /// translation unit. /// /// \param Target The target options used for the current translation unit. /// /// \param Req If this module is unavailable, this parameter /// will be set to one of the requirements that is not met for use of /// this module. bool isAvailable(const LangOptions &LangOpts, const TargetInfo &Target, Requirement &Req, UnresolvedHeaderDirective &MissingHeader) const; /// \brief Determine whether this module is a submodule. bool isSubModule() const { return Parent != nullptr; } /// \brief Determine whether this module is a submodule of the given other /// module. bool isSubModuleOf(const Module *Other) const; /// \brief Determine whether this module is a part of a framework, /// either because it is a framework module or because it is a submodule /// of a framework module. bool isPartOfFramework() const { for (const Module *Mod = this; Mod; Mod = Mod->Parent) if (Mod->IsFramework) return true; return false; } /// \brief Determine whether this module is a subframework of another /// framework. bool isSubFramework() const { return IsFramework && Parent && Parent->isPartOfFramework(); } /// \brief Retrieve the full name of this module, including the path from /// its top-level module. std::string getFullModuleName() const; /// \brief Retrieve the top-level module for this (sub)module, which may /// be this module. Module *getTopLevelModule() { return const_cast<Module *>( const_cast<const Module *>(this)->getTopLevelModule()); } /// \brief Retrieve the top-level module for this (sub)module, which may /// be this module. const Module *getTopLevelModule() const; /// \brief Retrieve the name of the top-level module. /// StringRef getTopLevelModuleName() const { return getTopLevelModule()->Name; } /// \brief The serialized AST file for this module, if one was created. const FileEntry *getASTFile() const { return getTopLevelModule()->ASTFile; } /// \brief Set the serialized AST file for the top-level module of this module. void setASTFile(const FileEntry *File) { assert((File == nullptr || getASTFile() == nullptr || getASTFile() == File) && "file path changed"); getTopLevelModule()->ASTFile = File; } /// \brief Retrieve the directory for which this module serves as the /// umbrella. DirectoryName getUmbrellaDir() const; /// \brief Retrieve the header that serves as the umbrella header for this /// module. Header getUmbrellaHeader() const { if (auto *E = Umbrella.dyn_cast<const FileEntry *>()) return Header{UmbrellaAsWritten, E}; return Header{}; } /// \brief Determine whether this module has an umbrella directory that is /// not based on an umbrella header. bool hasUmbrellaDir() const { return Umbrella && Umbrella.is<const DirectoryEntry *>(); } /// \brief Add a top-level header associated with this module. void addTopHeader(const FileEntry *File) { assert(File); TopHeaders.insert(File); } /// \brief Add a top-level header filename associated with this module. void addTopHeaderFilename(StringRef Filename) { TopHeaderNames.push_back(Filename); } /// \brief The top-level headers associated with this module. ArrayRef<const FileEntry *> getTopHeaders(FileManager &FileMgr); /// \brief Determine whether this module has declared its intention to /// directly use another module. bool directlyUses(const Module *Requested) const; /// \brief Add the given feature requirement to the list of features /// required by this module. /// /// \param Feature The feature that is required by this module (and /// its submodules). /// /// \param RequiredState The required state of this feature: \c true /// if it must be present, \c false if it must be absent. /// /// \param LangOpts The set of language options that will be used to /// evaluate the availability of this feature. /// /// \param Target The target options that will be used to evaluate the /// availability of this feature. void addRequirement(StringRef Feature, bool RequiredState, const LangOptions &LangOpts, const TargetInfo &Target); /// \brief Mark this module and all of its submodules as unavailable. void markUnavailable(bool MissingRequirement = false); /// \brief Find the submodule with the given name. /// /// \returns The submodule if found, or NULL otherwise. Module *findSubmodule(StringRef Name) const; /// \brief Determine whether the specified module would be visible to /// a lookup at the end of this module. /// /// FIXME: This may return incorrect results for (submodules of) the /// module currently being built, if it's queried before we see all /// of its imports. bool isModuleVisible(const Module *M) const { if (VisibleModulesCache.empty()) buildVisibleModulesCache(); return VisibleModulesCache.count(M); } unsigned getVisibilityID() const { return VisibilityID; } typedef std::vector<Module *>::iterator submodule_iterator; typedef std::vector<Module *>::const_iterator submodule_const_iterator; submodule_iterator submodule_begin() { return SubModules.begin(); } submodule_const_iterator submodule_begin() const {return SubModules.begin();} submodule_iterator submodule_end() { return SubModules.end(); } submodule_const_iterator submodule_end() const { return SubModules.end(); } /// \brief Appends this module's list of exported modules to \p Exported. /// /// This provides a subset of immediately imported modules (the ones that are /// directly exported), not the complete set of exported modules. void getExportedModules(SmallVectorImpl<Module *> &Exported) const; static StringRef getModuleInputBufferName() { return "<module-includes>"; } /// \brief Print the module map for this module to the given stream. /// void print(raw_ostream &OS, unsigned Indent = 0) const; /// \brief Dump the contents of this module to the given output stream. void dump() const; private: void buildVisibleModulesCache() const; }; /// \brief A set of visible modules. class VisibleModuleSet { public: VisibleModuleSet() : Generation(0) {} VisibleModuleSet(VisibleModuleSet &&O) : ImportLocs(std::move(O.ImportLocs)), Generation(O.Generation ? 1 : 0) { O.ImportLocs.clear(); ++O.Generation; } /// Move from another visible modules set. Guaranteed to leave the source /// empty and bump the generation on both. VisibleModuleSet &operator=(VisibleModuleSet &&O) { ImportLocs = std::move(O.ImportLocs); O.ImportLocs.clear(); ++O.Generation; ++Generation; return *this; } /// \brief Get the current visibility generation. Incremented each time the /// set of visible modules changes in any way. unsigned getGeneration() const { return Generation; } /// \brief Determine whether a module is visible. bool isVisible(const Module *M) const { return getImportLoc(M).isValid(); } /// \brief Get the location at which the import of a module was triggered. SourceLocation getImportLoc(const Module *M) const { return M->getVisibilityID() < ImportLocs.size() ? ImportLocs[M->getVisibilityID()] : SourceLocation(); } /// \brief A callback to call when a module is made visible (directly or /// indirectly) by a call to \ref setVisible. typedef llvm::function_ref<void(Module *M)> VisibleCallback; /// \brief A callback to call when a module conflict is found. \p Path /// consists of a sequence of modules from the conflicting module to the one /// made visible, where each was exported by the next. typedef llvm::function_ref<void(ArrayRef<Module *> Path, Module *Conflict, StringRef Message)> ConflictCallback; /// \brief Make a specific module visible. void setVisible(Module *M, SourceLocation Loc, VisibleCallback Vis = [](Module *) {}, ConflictCallback Cb = [](ArrayRef<Module *>, Module *, StringRef) {}); private: /// Import locations for each visible module. Indexed by the module's /// VisibilityID. std::vector<SourceLocation> ImportLocs; /// Visibility generation, bumped every time the visibility state changes. unsigned Generation; }; } // end namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/VersionTuple.h
//===- VersionTuple.h - Version Number Handling -----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::VersionTuple class, which represents a version in /// the form major[.minor[.subminor]]. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_VERSIONTUPLE_H #define LLVM_CLANG_BASIC_VERSIONTUPLE_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/Optional.h" #include <string> #include <tuple> namespace clang { /// \brief Represents a version number in the form major[.minor[.subminor[.build]]]. class VersionTuple { unsigned Major : 31; unsigned Minor : 31; unsigned Subminor : 31; unsigned Build : 31; unsigned HasMinor : 1; unsigned HasSubminor : 1; unsigned HasBuild : 1; unsigned UsesUnderscores : 1; public: VersionTuple() : Major(0), Minor(0), Subminor(0), Build(0), HasMinor(false), HasSubminor(false), HasBuild(false), UsesUnderscores(false) {} explicit VersionTuple(unsigned Major) : Major(Major), Minor(0), Subminor(0), Build(0), HasMinor(false), HasSubminor(false), HasBuild(false), UsesUnderscores(false) {} explicit VersionTuple(unsigned Major, unsigned Minor, bool UsesUnderscores = false) : Major(Major), Minor(Minor), Subminor(0), Build(0), HasMinor(true), HasSubminor(false), HasBuild(false), UsesUnderscores(UsesUnderscores) {} explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, bool UsesUnderscores = false) : Major(Major), Minor(Minor), Subminor(Subminor), Build(0), HasMinor(true), HasSubminor(true), HasBuild(false), UsesUnderscores(UsesUnderscores) {} explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, unsigned Build, bool UsesUnderscores = false) : Major(Major), Minor(Minor), Subminor(Subminor), Build(Build), HasMinor(true), HasSubminor(true), HasBuild(true), UsesUnderscores(UsesUnderscores) {} /// \brief Determine whether this version information is empty /// (e.g., all version components are zero). bool empty() const { return Major == 0 && Minor == 0 && Subminor == 0 && Build == 0; } /// \brief Retrieve the major version number. unsigned getMajor() const { return Major; } /// \brief Retrieve the minor version number, if provided. Optional<unsigned> getMinor() const { if (!HasMinor) return None; return Minor; } /// \brief Retrieve the subminor version number, if provided. Optional<unsigned> getSubminor() const { if (!HasSubminor) return None; return Subminor; } /// \brief Retrieve the build version number, if provided. Optional<unsigned> getBuild() const { if (!HasBuild) return None; return Build; } bool usesUnderscores() const { return UsesUnderscores; } void UseDotAsSeparator() { UsesUnderscores = false; } /// \brief Determine if two version numbers are equivalent. If not /// provided, minor and subminor version numbers are considered to be zero. friend bool operator==(const VersionTuple& X, const VersionTuple &Y) { return X.Major == Y.Major && X.Minor == Y.Minor && X.Subminor == Y.Subminor && X.Build == Y.Build; } /// \brief Determine if two version numbers are not equivalent. /// /// If not provided, minor and subminor version numbers are considered to be /// zero. friend bool operator!=(const VersionTuple &X, const VersionTuple &Y) { return !(X == Y); } /// \brief Determine whether one version number precedes another. /// /// If not provided, minor and subminor version numbers are considered to be /// zero. friend bool operator<(const VersionTuple &X, const VersionTuple &Y) { return std::tie(X.Major, X.Minor, X.Subminor, X.Build) < std::tie(Y.Major, Y.Minor, Y.Subminor, Y.Build); } /// \brief Determine whether one version number follows another. /// /// If not provided, minor and subminor version numbers are considered to be /// zero. friend bool operator>(const VersionTuple &X, const VersionTuple &Y) { return Y < X; } /// \brief Determine whether one version number precedes or is /// equivalent to another. /// /// If not provided, minor and subminor version numbers are considered to be /// zero. friend bool operator<=(const VersionTuple &X, const VersionTuple &Y) { return !(Y < X); } /// \brief Determine whether one version number follows or is /// equivalent to another. /// /// If not provided, minor and subminor version numbers are considered to be /// zero. friend bool operator>=(const VersionTuple &X, const VersionTuple &Y) { return !(X < Y); } /// \brief Retrieve a string representation of the version number. std::string getAsString() const; /// \brief Try to parse the given string as a version number. /// \returns \c true if the string does not match the regular expression /// [0-9]+(\.[0-9]+){0,3} bool tryParse(StringRef string); }; /// \brief Print a version number. raw_ostream& operator<<(raw_ostream &Out, const VersionTuple &V); } // end namespace clang #endif // LLVM_CLANG_BASIC_VERSIONTUPLE_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TargetCXXABI.h
//===--- TargetCXXABI.h - C++ ABI Target Configuration ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the TargetCXXABI class, which abstracts details of the /// C++ ABI that we're targeting. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TARGETCXXABI_H #define LLVM_CLANG_BASIC_TARGETCXXABI_H #include "llvm/ADT/Triple.h" #include "llvm/Support/ErrorHandling.h" namespace clang { /// \brief The basic abstraction for the target C++ ABI. class TargetCXXABI { public: /// \brief The basic C++ ABI kind. enum Kind { /// The generic Itanium ABI is the standard ABI of most open-source /// and Unix-like platforms. It is the primary ABI targeted by /// many compilers, including Clang and GCC. /// /// It is documented here: /// http://www.codesourcery.com/public/cxx-abi/ GenericItanium, /// The generic ARM ABI is a modified version of the Itanium ABI /// proposed by ARM for use on ARM-based platforms. /// /// These changes include: /// - the representation of member function pointers is adjusted /// to not conflict with the 'thumb' bit of ARM function pointers; /// - constructors and destructors return 'this'; /// - guard variables are smaller; /// - inline functions are never key functions; /// - array cookies have a slightly different layout; /// - additional convenience functions are specified; /// - and more! /// /// It is documented here: /// http://infocenter.arm.com /// /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf GenericARM, /// The iOS ABI is a partial implementation of the ARM ABI. /// Several of the features of the ARM ABI were not fully implemented /// in the compilers that iOS was launched with. /// /// Essentially, the iOS ABI includes the ARM changes to: /// - member function pointers, /// - guard variables, /// - array cookies, and /// - constructor/destructor signatures. iOS, /// The iOS 64-bit ABI is follows ARM's published 64-bit ABI more /// closely, but we don't guarantee to follow it perfectly. /// /// It is documented here: /// http://infocenter.arm.com /// /help/topic/com.arm.doc.ihi0059a/IHI0059A_cppabi64.pdf iOS64, /// The generic AArch64 ABI is also a modified version of the Itanium ABI, /// but it has fewer divergences than the 32-bit ARM ABI. /// /// The relevant changes from the generic ABI in this case are: /// - representation of member function pointers adjusted as in ARM. /// - guard variables are smaller. GenericAArch64, /// The generic Mips ABI is a modified version of the Itanium ABI. /// /// At the moment, only change from the generic ABI in this case is: /// - representation of member function pointers adjusted as in ARM. GenericMIPS, /// The Microsoft ABI is the ABI used by Microsoft Visual Studio (and /// compatible compilers). /// /// FIXME: should this be split into Win32 and Win64 variants? /// /// Only scattered and incomplete official documentation exists. Microsoft }; private: // Right now, this class is passed around as a cheap value type. // If you add more members, especially non-POD members, please // audit the users to pass it by reference instead. Kind TheKind; public: /// A bogus initialization of the platform ABI. TargetCXXABI() : TheKind(GenericItanium) {} TargetCXXABI(Kind kind) : TheKind(kind) {} void set(Kind kind) { TheKind = kind; } Kind getKind() const { return TheKind; } /// \brief Does this ABI generally fall into the Itanium family of ABIs? bool isItaniumFamily() const { switch (getKind()) { case GenericAArch64: case GenericItanium: case GenericARM: case iOS: case iOS64: case GenericMIPS: return true; case Microsoft: return false; } llvm_unreachable("bad ABI kind"); } /// \brief Is this ABI an MSVC-compatible ABI? bool isMicrosoft() const { switch (getKind()) { case GenericAArch64: case GenericItanium: case GenericARM: case iOS: case iOS64: case GenericMIPS: return false; case Microsoft: return true; } llvm_unreachable("bad ABI kind"); } /// \brief Is the default C++ member function calling convention /// the same as the default calling convention? bool isMemberFunctionCCDefault() const { // Right now, this is always false for Microsoft. return !isMicrosoft(); } /// Are arguments to a call destroyed left to right in the callee? /// This is a fundamental language change, since it implies that objects /// passed by value do *not* live to the end of the full expression. /// Temporaries passed to a function taking a const reference live to the end /// of the full expression as usual. Both the caller and the callee must /// have access to the destructor, while only the caller needs the /// destructor if this is false. bool areArgsDestroyedLeftToRightInCallee() const { return isMicrosoft(); } /// \brief Does this ABI have different entrypoints for complete-object /// and base-subobject constructors? bool hasConstructorVariants() const { return isItaniumFamily(); } /// \brief Does this ABI allow virtual bases to be primary base classes? bool hasPrimaryVBases() const { return isItaniumFamily(); } /// \brief Does this ABI use key functions? If so, class data such as the /// vtable is emitted with strong linkage by the TU containing the key /// function. bool hasKeyFunctions() const { return isItaniumFamily(); } /// \brief Can an out-of-line inline function serve as a key function? /// /// This flag is only useful in ABIs where type data (for example, /// v-tables and type_info objects) are emitted only after processing /// the definition of a special "key" virtual function. (This is safe /// because the ODR requires that every virtual function be defined /// somewhere in a program.) This usually permits such data to be /// emitted in only a single object file, as opposed to redundantly /// in every object file that requires it. /// /// One simple and common definition of "key function" is the first /// virtual function in the class definition which is not defined there. /// This rule works very well when that function has a non-inline /// definition in some non-header file. Unfortunately, when that /// function is defined inline, this rule requires the type data /// to be emitted weakly, as if there were no key function. /// /// The ARM ABI observes that the ODR provides an additional guarantee: /// a virtual function is always ODR-used, so if it is defined inline, /// that definition must appear in every translation unit that defines /// the class. Therefore, there is no reason to allow such functions /// to serve as key functions. /// /// Because this changes the rules for emitting type data, /// it can cause type data to be emitted with both weak and strong /// linkage, which is not allowed on all platforms. Therefore, /// exploiting this observation requires an ABI break and cannot be /// done on a generic Itanium platform. bool canKeyFunctionBeInline() const { switch (getKind()) { case GenericARM: case iOS64: return false; case GenericAArch64: case GenericItanium: case iOS: // old iOS compilers did not follow this rule case Microsoft: case GenericMIPS: return true; } llvm_unreachable("bad ABI kind"); } /// When is record layout allowed to allocate objects in the tail /// padding of a base class? /// /// This decision cannot be changed without breaking platform ABI /// compatibility, and yet it is tied to language guarantees which /// the committee has so far seen fit to strengthen no less than /// three separate times: /// - originally, there were no restrictions at all; /// - C++98 declared that objects could not be allocated in the /// tail padding of a POD type; /// - C++03 extended the definition of POD to include classes /// containing member pointers; and /// - C++11 greatly broadened the definition of POD to include /// all trivial standard-layout classes. /// Each of these changes technically took several existing /// platforms and made them permanently non-conformant. enum TailPaddingUseRules { /// The tail-padding of a base class is always theoretically /// available, even if it's POD. This is not strictly conforming /// in any language mode. AlwaysUseTailPadding, /// Only allocate objects in the tail padding of a base class if /// the base class is not POD according to the rules of C++ TR1. /// This is non-strictly conforming in C++11 mode. UseTailPaddingUnlessPOD03, /// Only allocate objects in the tail padding of a base class if /// the base class is not POD according to the rules of C++11. UseTailPaddingUnlessPOD11 }; TailPaddingUseRules getTailPaddingUseRules() const { switch (getKind()) { // To preserve binary compatibility, the generic Itanium ABI has // permanently locked the definition of POD to the rules of C++ TR1, // and that trickles down to all the derived ABIs. case GenericItanium: case GenericAArch64: case GenericARM: case iOS: case GenericMIPS: return UseTailPaddingUnlessPOD03; // iOS on ARM64 uses the C++11 POD rules. It does not honor the // Itanium exception about classes with over-large bitfields. case iOS64: return UseTailPaddingUnlessPOD11; // MSVC always allocates fields in the tail-padding of a base class // subobject, even if they're POD. case Microsoft: return AlwaysUseTailPadding; } llvm_unreachable("bad ABI kind"); } /// Try to parse an ABI name, returning false on error. bool tryParse(llvm::StringRef name); friend bool operator==(const TargetCXXABI &left, const TargetCXXABI &right) { return left.getKind() == right.getKind(); } friend bool operator!=(const TargetCXXABI &left, const TargetCXXABI &right) { return !(left == right); } }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/LLVM.h
//===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // /// \file /// \brief Forward-declares and imports various common LLVM datatypes that /// clang wants to use unqualified. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_LLVM_H #define LLVM_CLANG_BASIC_LLVM_H // Do not proliferate #includes here, require clients to #include their // dependencies. // Casting.h has complex templates that cannot be easily forward declared. #include "llvm/Support/Casting.h" // None.h includes an enumerator that is desired & cannot be forward declared // without a definition of NoneType. #include "llvm/ADT/None.h" namespace llvm { // ADT's. class StringRef; class Twine; template<typename T> class ArrayRef; template<typename T> class MutableArrayRef; template<unsigned InternalLen> class SmallString; template<typename T, unsigned N> class SmallVector; template<typename T> class SmallVectorImpl; template<typename T> class Optional; template<typename T> struct SaveAndRestore; // Reference counting. template <typename T> class IntrusiveRefCntPtr; template <typename T> struct IntrusiveRefCntPtrInfo; template <class Derived> class RefCountedBase; class RefCountedBaseVPTR; class raw_ostream; class raw_pwrite_stream; // TODO: DenseMap, ... } namespace clang { // Casting operators. using llvm::isa; using llvm::cast; using llvm::dyn_cast; using llvm::dyn_cast_or_null; using llvm::cast_or_null; // ADT's. using llvm::None; using llvm::Optional; using llvm::StringRef; using llvm::Twine; using llvm::ArrayRef; using llvm::MutableArrayRef; using llvm::SmallString; using llvm::SmallVector; using llvm::SmallVectorImpl; using llvm::SaveAndRestore; // Reference counting. using llvm::IntrusiveRefCntPtr; using llvm::IntrusiveRefCntPtrInfo; using llvm::RefCountedBase; using llvm::RefCountedBaseVPTR; using llvm::raw_ostream; using llvm::raw_pwrite_stream; } // end namespace clang. #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/MacroBuilder.h
//===--- MacroBuilder.h - CPP Macro building utility ------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::MacroBuilder utility class. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_MACROBUILDER_H #define LLVM_CLANG_BASIC_MACROBUILDER_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/raw_ostream.h" namespace clang { class MacroBuilder { raw_ostream &Out; public: MacroBuilder(raw_ostream &Output) : Out(Output) {} /// Append a \#define line for macro of the form "\#define Name Value\n". void defineMacro(const Twine &Name, const Twine &Value = "1") { Out << "#define " << Name << ' ' << Value << '\n'; } /// Append a \#undef line for Name. Name should be of the form XXX /// and we emit "\#undef XXX". void undefineMacro(const Twine &Name) { Out << "#undef " << Name << '\n'; } /// Directly append Str and a newline to the underlying buffer. void append(const Twine &Str) { Out << Str << '\n'; } }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/CapturedStmt.h
//===--- CapturedStmt.h - Types for CapturedStmts ---------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_CAPTUREDSTMT_H #define LLVM_CLANG_BASIC_CAPTUREDSTMT_H namespace clang { /// \brief The different kinds of captured statement. enum CapturedRegionKind { CR_Default, CR_OpenMP }; } // end namespace clang #endif // LLVM_CLANG_BASIC_CAPTUREDSTMT_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/OpenCLExtensions.def
//===--- OpenCLExtensions.def - OpenCL extension list -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the list of supported OpenCL extensions. // //===----------------------------------------------------------------------===// OPENCLEXT(cl_khr_fp64) OPENCLEXT(cl_khr_int64_base_atomics) OPENCLEXT(cl_khr_int64_extended_atomics) OPENCLEXT(cl_khr_fp16) OPENCLEXT(cl_khr_gl_sharing) OPENCLEXT(cl_khr_gl_event) OPENCLEXT(cl_khr_d3d10_sharing) OPENCLEXT(cl_khr_global_int32_base_atomics) OPENCLEXT(cl_khr_global_int32_extended_atomics) OPENCLEXT(cl_khr_local_int32_base_atomics) OPENCLEXT(cl_khr_local_int32_extended_atomics) OPENCLEXT(cl_khr_byte_addressable_store) OPENCLEXT(cl_khr_3d_image_writes) // Clang Extensions. OPENCLEXT(cl_clang_storage_class_specifiers) #undef OPENCLEXT
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/PrettyStackTrace.h
//===- clang/Basic/PrettyStackTrace.h - Pretty Crash Handling --*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the PrettyStackTraceEntry class, which is used to make /// crashes give more contextual information about what the program was doing /// when it crashed. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H #define LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H #include "clang/Basic/SourceLocation.h" #include "llvm/Support/PrettyStackTrace.h" namespace clang { /// If a crash happens while one of these objects are live, the message /// is printed out along with the specified source location. class PrettyStackTraceLoc : public llvm::PrettyStackTraceEntry { SourceManager &SM; SourceLocation Loc; const char *Message; public: PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg) : SM(sm), Loc(L), Message(Msg) {} void print(raw_ostream &OS) const override; }; } #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/OpenMPKinds.h
//===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines some OpenMP-specific enums and functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H #define LLVM_CLANG_BASIC_OPENMPKINDS_H #include "llvm/ADT/StringRef.h" namespace clang { /// \brief OpenMP directives. enum OpenMPDirectiveKind { #define OPENMP_DIRECTIVE(Name) \ OMPD_##Name, #define OPENMP_DIRECTIVE_EXT(Name, Str) \ OMPD_##Name, #include "clang/Basic/OpenMPKinds.def" OMPD_unknown }; /// \brief OpenMP clauses. enum OpenMPClauseKind { #define OPENMP_CLAUSE(Name, Class) \ OMPC_##Name, #include "clang/Basic/OpenMPKinds.def" OMPC_threadprivate, OMPC_unknown }; /// \brief OpenMP attributes for 'default' clause. enum OpenMPDefaultClauseKind { #define OPENMP_DEFAULT_KIND(Name) \ OMPC_DEFAULT_##Name, #include "clang/Basic/OpenMPKinds.def" OMPC_DEFAULT_unknown }; /// \brief OpenMP attributes for 'proc_bind' clause. enum OpenMPProcBindClauseKind { #define OPENMP_PROC_BIND_KIND(Name) \ OMPC_PROC_BIND_##Name, #include "clang/Basic/OpenMPKinds.def" OMPC_PROC_BIND_unknown }; /// \brief OpenMP attributes for 'schedule' clause. enum OpenMPScheduleClauseKind { #define OPENMP_SCHEDULE_KIND(Name) \ OMPC_SCHEDULE_##Name, #include "clang/Basic/OpenMPKinds.def" OMPC_SCHEDULE_unknown }; /// \brief OpenMP attributes for 'depend' clause. enum OpenMPDependClauseKind { #define OPENMP_DEPEND_KIND(Name) \ OMPC_DEPEND_##Name, #include "clang/Basic/OpenMPKinds.def" OMPC_DEPEND_unknown }; OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str); const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind); OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str); const char *getOpenMPClauseName(OpenMPClauseKind Kind); unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str); const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type); bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind); /// \brief Checks if the specified directive is a directive with an associated /// loop construct. /// \param DKind Specified directive. /// \return true - the directive is a loop-associated directive like 'omp simd' /// or 'omp for' directive, otherwise - false. bool isOpenMPLoopDirective(OpenMPDirectiveKind DKind); /// \brief Checks if the specified directive is a worksharing directive. /// \param DKind Specified directive. /// \return true - the directive is a worksharing directive like 'omp for', /// otherwise - false. bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind); /// \brief Checks if the specified directive is a parallel-kind directive. /// \param DKind Specified directive. /// \return true - the directive is a parallel-like directive like 'omp /// parallel', otherwise - false. bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind); /// \brief Checks if the specified directive is a teams-kind directive. /// \param DKind Specified directive. /// \return true - the directive is a teams-like directive like 'omp teams', /// otherwise - false. bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind); /// \brief Checks if the specified directive is a simd directive. /// \param DKind Specified directive. /// \return true - the directive is a simd directive like 'omp simd', /// otherwise - false. bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind); /// \brief Checks if the specified clause is one of private clauses like /// 'private', 'firstprivate', 'reduction' etc.. /// \param Kind Clause kind. /// \return true - the clause is a private clause, otherwise - false. bool isOpenMPPrivate(OpenMPClauseKind Kind); /// \brief Checks if the specified clause is one of threadprivate clauses like /// 'threadprivate', 'copyin' or 'copyprivate'. /// \param Kind Clause kind. /// \return true - the clause is a threadprivate clause, otherwise - false. bool isOpenMPThreadPrivate(OpenMPClauseKind Kind); } #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/LangOptions.def
//===--- LangOptions.def - Language option database -------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the language options. Users of this file must // define the LANGOPT macro to make use of this information. // // Optionally, the user may also define: // // BENIGN_LANGOPT: for options that don't affect the construction of the AST in // any way (that is, the value can be different between an implicit module // and the user of that module). // // COMPATIBLE_LANGOPT: for options that affect the construction of the AST in // a way that doesn't prevent interoperability (that is, the value can be // different between an explicit module and the user of that module). // // ENUM_LANGOPT: for options that have enumeration, rather than unsigned, type. // // VALUE_LANGOPT: for options that describe a value rather than a flag. // // BENIGN_ENUM_LANGOPT, COMPATIBLE_ENUM_LANGOPT: combinations of the above. // // FIXME: Clients should be able to more easily select whether they want // different levels of compatibility versus how to handle different kinds // of option. //===----------------------------------------------------------------------===// #ifndef LANGOPT # error Define the LANGOPT macro to handle language options #endif #ifndef COMPATIBLE_LANGOPT # define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif #ifndef BENIGN_LANGOPT # define BENIGN_LANGOPT(Name, Bits, Default, Description) \ COMPATIBLE_LANGOPT(Name, Bits, Default, Description) #endif #ifndef ENUM_LANGOPT # define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif #ifndef COMPATIBLE_ENUM_LANGOPT # define COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ ENUM_LANGOPT(Name, Type, Bits, Default, Description) #endif #ifndef BENIGN_ENUM_LANGOPT # define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) #endif #ifndef VALUE_LANGOPT # define VALUE_LANGOPT(Name, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif // FIXME: A lot of the BENIGN_ options should be COMPATIBLE_ instead. LANGOPT(C99 , 1, 0, "C99") LANGOPT(C11 , 1, 0, "C11") LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode") LANGOPT(MicrosoftExt , 1, 0, "Microsoft C++ extensions") LANGOPT(AsmBlocks , 1, 0, "Microsoft inline asm blocks") LANGOPT(Borland , 1, 0, "Borland extensions") LANGOPT(CPlusPlus , 1, 0, "C++") LANGOPT(CPlusPlus11 , 1, 0, "C++11") LANGOPT(CPlusPlus14 , 1, 0, "C++14") LANGOPT(CPlusPlus1z , 1, 0, "C++1z") LANGOPT(ObjC1 , 1, 0, "Objective-C 1") LANGOPT(ObjC2 , 1, 0, "Objective-C 2") BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0, "Objective-C auto-synthesized properties") BENIGN_LANGOPT(EncodeExtendedBlockSig , 1, 0, "Encoding extended block type signature") BENIGN_LANGOPT(ObjCInferRelatedResultType , 1, 1, "Objective-C related result type inference") LANGOPT(AppExt , 1, 0, "Objective-C App Extension") LANGOPT(Trigraphs , 1, 0,"trigraphs") LANGOPT(LineComment , 1, 0, "'//' comments") LANGOPT(Bool , 1, 0, "bool, true, and false keywords") LANGOPT(Half , 1, 0, "half keyword") LANGOPT(WChar , 1, CPlusPlus, "wchar_t keyword") BENIGN_LANGOPT(DollarIdents , 1, 1, "'$' in identifiers") BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode") BENIGN_LANGOPT(GNUMode , 1, 1, "GNU extensions") LANGOPT(GNUKeywords , 1, 1, "GNU keywords") BENIGN_LANGOPT(ImplicitInt, 1, !C99 && !CPlusPlus, "C89 implicit 'int'") LANGOPT(Digraphs , 1, 0, "digraphs") BENIGN_LANGOPT(HexFloats , 1, C99, "C99 hexadecimal float constants") LANGOPT(CXXOperatorNames , 1, 0, "C++ operator name keywords") LANGOPT(AppleKext , 1, 0, "Apple kext support") BENIGN_LANGOPT(PascalStrings, 1, 0, "Pascal string support") LANGOPT(WritableStrings , 1, 0, "writable string support") LANGOPT(ConstStrings , 1, 0, "const-qualified string support") LANGOPT(LaxVectorConversions , 1, 1, "lax vector conversions") LANGOPT(AltiVec , 1, 0, "AltiVec-style vector initializers") LANGOPT(ZVector , 1, 0, "System z vector extensions") LANGOPT(Exceptions , 1, 0, "exception handling") LANGOPT(ObjCExceptions , 1, 0, "Objective-C exceptions") LANGOPT(CXXExceptions , 1, 0, "C++ exceptions") LANGOPT(SjLjExceptions , 1, 0, "setjmp-longjump exception handling") LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation") LANGOPT(RTTI , 1, 1, "run-time type information") LANGOPT(RTTIData , 1, 1, "emit run-time type information data") LANGOPT(MSBitfields , 1, 0, "Microsoft-compatible structure layout") LANGOPT(Freestanding, 1, 0, "freestanding implementation") LANGOPT(NoBuiltin , 1, 0, "disable builtin functions") LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions") LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly") BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers") LANGOPT(POSIXThreads , 1, 0, "POSIX thread support") LANGOPT(Blocks , 1, 0, "blocks extension to C") BENIGN_LANGOPT(EmitAllDecls , 1, 0, "support for emitting all declarations") LANGOPT(MathErrno , 1, 1, "errno support for math functions") BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really don't like and may be ripped out at any time") LANGOPT(Modules , 1, 0, "modules extension to C") COMPATIBLE_LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses") LANGOPT(ModulesSearchAll , 1, 1, "search even non-imported modules to find unresolved references") COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "require declaration of module uses and all headers to be in modules") BENIGN_LANGOPT(ModulesErrorRecovery, 1, 1, "automatically import modules as needed when performing error recovery") BENIGN_LANGOPT(ImplicitModules, 1, 1, "build modules that are not specified via -fmodule-file") COMPATIBLE_LANGOPT(ModulesLocalVisibility, 1, 0, "local submodule visibility") COMPATIBLE_LANGOPT(ModulesHideInternalLinkage, 1, 1, "hiding non-visible internal linkage declarations from redeclaration lookup") COMPATIBLE_LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro") COMPATIBLE_LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro") LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)") VALUE_LANGOPT(PackStruct , 32, 0, "default struct packing maximum alignment") VALUE_LANGOPT(MaxTypeAlign , 32, 0, "default maximum alignment for types") VALUE_LANGOPT(PICLevel , 2, 0, "__PIC__ level") VALUE_LANGOPT(PIELevel , 2, 0, "__PIE__ level") LANGOPT(GNUInline , 1, 0, "GNU inline semantics") COMPATIBLE_LANGOPT(NoInlineDefine , 1, 0, "__NO_INLINE__ predefined macro") COMPATIBLE_LANGOPT(Deprecated , 1, 0, "__DEPRECATED predefined macro") LANGOPT(FastMath , 1, 0, "__FAST_MATH__ predefined macro") LANGOPT(FiniteMathOnly , 1, 0, "__FINITE_MATH_ONLY__ predefined macro") BENIGN_LANGOPT(ObjCGCBitmapPrint , 1, 0, "printing of GC's bitmap layout for __weak/__strong ivars") BENIGN_LANGOPT(AccessControl , 1, 1, "C++ access control") LANGOPT(CharIsSigned , 1, 1, "signed char") LANGOPT(ShortWChar , 1, 0, "unsigned short wchar_t") ENUM_LANGOPT(MSPointerToMemberRepresentationMethod, PragmaMSPointersToMembersKind, 2, PPTMK_BestCase, "member-pointer representation method") LANGOPT(ShortEnums , 1, 0, "short enum types") LANGOPT(HLSL , 1, 0, "HLSL") // HLSL Change: LangOption for HLSL LANGOPT(OpenCL , 1, 0, "OpenCL") LANGOPT(OpenCLVersion , 32, 0, "OpenCL version") LANGOPT(NativeHalfType , 1, 0, "Native half type support") LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns") LANGOPT(CUDA , 1, 0, "CUDA") LANGOPT(OpenMP , 1, 0, "OpenMP support") LANGOPT(OpenMPUseTLS , 1, 0, "Use TLS for threadprivates or runtime calls") LANGOPT(CUDAIsDevice , 1, 0, "Compiling for CUDA device") LANGOPT(CUDAAllowHostCallsFromHostDevice, 1, 0, "Allow host device functions to call host functions") LANGOPT(CUDADisableTargetCallChecks, 1, 0, "Disable checks for call targets (host, device, etc.)") LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators") LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions") LANGOPT(ConceptsTS , 1, 0, "enable C++ Extensions for Concepts") BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision") BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd records") BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd records in a simple form") BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted vtables") LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings") BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden default visibility for inline C++ methods") BENIGN_LANGOPT(ParseUnknownAnytype, 1, 0, "__unknown_anytype") BENIGN_LANGOPT(DebuggerSupport , 1, 0, "debugger support") BENIGN_LANGOPT(DebuggerCastResultToId, 1, 0, "for 'po' in the debugger, cast the result to id if it is of unknown type") BENIGN_LANGOPT(DebuggerObjCLiteral , 1, 0, "debugger Objective-C literals and subscripting support") BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking") LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating point constants as single precision constants") LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math") LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT") LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment") LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility") LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting") LANGOPT(ObjCARCWeak , 1, 0, "__weak support in the ARC runtime") LANGOPT(ObjCSubscriptingLegacyRuntime , 1, 0, "Subscripting support in legacy ObjectiveC runtime") LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map") ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, "OpenCL address space map mangling mode") LANGOPT(MRTD , 1, 0, "-mrtd calling convention") BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing") LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime") ENUM_LANGOPT(GC, GCMode, 2, NonGC, "Objective-C Garbage Collection mode") ENUM_LANGOPT(ValueVisibilityMode, Visibility, 3, DefaultVisibility, "value symbol visibility") ENUM_LANGOPT(TypeVisibilityMode, Visibility, 3, DefaultVisibility, "type symbol visibility") ENUM_LANGOPT(StackProtector, StackProtectorMode, 2, SSPOff, "stack protector mode") ENUM_LANGOPT(SignedOverflowBehavior, SignedOverflowBehaviorTy, 2, SOB_Undefined, "signed integer overflow handling") BENIGN_LANGOPT(ArrowDepth, 32, 256, "maximum number of operator->s to follow") BENIGN_LANGOPT(InstantiationDepth, 32, 256, "maximum template instantiation depth") BENIGN_LANGOPT(ConstexprCallDepth, 32, 512, "maximum constexpr call depth") BENIGN_LANGOPT(ConstexprStepLimit, 32, 1048576, "maximum constexpr evaluation steps") BENIGN_LANGOPT(BracketDepth, 32, 256, "maximum bracket nesting depth") BENIGN_LANGOPT(NumLargeByValueCopy, 32, 0, "if non-zero, warn about parameter or return Warn if parameter/return value is larger in bytes than this setting. 0 is no check.") VALUE_LANGOPT(MSCompatibilityVersion, 32, 0, "Microsoft Visual C/C++ Version") VALUE_LANGOPT(VtorDispMode, 2, 1, "How many vtordisps to insert") LANGOPT(ApplePragmaPack, 1, 0, "Apple gcc-compatible #pragma pack handling") LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST") LANGOPT(SanitizeAddressFieldPadding, 2, 0, "controls how aggressive is ASan " "field padding (0: none, 1:least " "aggressive, 2: more aggressive)") #undef LANGOPT #undef COMPATIBLE_LANGOPT #undef BENIGN_LANGOPT #undef ENUM_LANGOPT #undef COMPATIBLE_ENUM_LANGOPT #undef BENIGN_ENUM_LANGOPT #undef VALUE_LANGOPT
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/CharInfo.h
//===--- clang/Basic/CharInfo.h - Classifying ASCII Characters ------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_CHARINFO_H #define LLVM_CLANG_BASIC_CHARINFO_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" namespace clang { namespace charinfo { extern const uint16_t InfoTable[256]; enum { CHAR_HORZ_WS = 0x0001, // '\t', '\f', '\v'. Note, no '\0' CHAR_VERT_WS = 0x0002, // '\r', '\n' CHAR_SPACE = 0x0004, // ' ' CHAR_DIGIT = 0x0008, // 0-9 CHAR_XLETTER = 0x0010, // a-f,A-F CHAR_UPPER = 0x0020, // A-Z CHAR_LOWER = 0x0040, // a-z CHAR_UNDER = 0x0080, // _ CHAR_PERIOD = 0x0100, // . CHAR_RAWDEL = 0x0200, // {}[]#<>%:;?*+-/^&|~!=,"' CHAR_PUNCT = 0x0400 // `$@() }; enum { CHAR_XUPPER = CHAR_XLETTER | CHAR_UPPER, CHAR_XLOWER = CHAR_XLETTER | CHAR_LOWER }; } // end namespace charinfo /// Returns true if this is an ASCII character. LLVM_READNONE static inline bool isASCII(char c) { return static_cast<unsigned char>(c) <= 127; } /// Returns true if this is a valid first character of a C identifier, /// which is [a-zA-Z_]. LLVM_READONLY static inline bool isIdentifierHead(unsigned char c, bool AllowDollar = false) { using namespace charinfo; if (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_UNDER)) return true; return AllowDollar && c == '$'; } /// Returns true if this is a body character of a C identifier, /// which is [a-zA-Z0-9_]. LLVM_READONLY static inline bool isIdentifierBody(unsigned char c, bool AllowDollar = false) { using namespace charinfo; if (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_DIGIT|CHAR_UNDER)) return true; return AllowDollar && c == '$'; } /// Returns true if this character is horizontal ASCII whitespace: /// ' ', '\\t', '\\f', '\\v'. /// /// Note that this returns false for '\\0'. LLVM_READONLY static inline bool isHorizontalWhitespace(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_HORZ_WS|CHAR_SPACE)) != 0; } /// Returns true if this character is vertical ASCII whitespace: '\\n', '\\r'. /// /// Note that this returns false for '\\0'. LLVM_READONLY static inline bool isVerticalWhitespace(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_VERT_WS) != 0; } /// Return true if this character is horizontal or vertical ASCII whitespace: /// ' ', '\\t', '\\f', '\\v', '\\n', '\\r'. /// /// Note that this returns false for '\\0'. LLVM_READONLY static inline bool isWhitespace(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_HORZ_WS|CHAR_VERT_WS|CHAR_SPACE)) != 0; } /// Return true if this character is an ASCII digit: [0-9] LLVM_READONLY static inline bool isDigit(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_DIGIT) != 0; } /// Return true if this character is a lowercase ASCII letter: [a-z] LLVM_READONLY static inline bool isLowercase(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_LOWER) != 0; } /// Return true if this character is an uppercase ASCII letter: [A-Z] LLVM_READONLY static inline bool isUppercase(unsigned char c) { using namespace charinfo; return (InfoTable[c] & CHAR_UPPER) != 0; } /// Return true if this character is an ASCII letter: [a-zA-Z] LLVM_READONLY static inline bool isLetter(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER)) != 0; } /// Return true if this character is an ASCII letter or digit: [a-zA-Z0-9] LLVM_READONLY static inline bool isAlphanumeric(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_DIGIT|CHAR_UPPER|CHAR_LOWER)) != 0; } /// Return true if this character is an ASCII hex digit: [0-9a-fA-F] LLVM_READONLY static inline bool isHexDigit(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_DIGIT|CHAR_XLETTER)) != 0; } /// Return true if this character is an ASCII punctuation character. /// /// Note that '_' is both a punctuation character and an identifier character! LLVM_READONLY static inline bool isPunctuation(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UNDER|CHAR_PERIOD|CHAR_RAWDEL|CHAR_PUNCT)) != 0; } /// Return true if this character is an ASCII printable character; that is, a /// character that should take exactly one column to print in a fixed-width /// terminal. LLVM_READONLY static inline bool isPrintable(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_PERIOD|CHAR_PUNCT| CHAR_DIGIT|CHAR_UNDER|CHAR_RAWDEL|CHAR_SPACE)) != 0; } /// Return true if this is the body character of a C preprocessing number, /// which is [a-zA-Z0-9_.]. LLVM_READONLY static inline bool isPreprocessingNumberBody(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_DIGIT|CHAR_UNDER|CHAR_PERIOD)) != 0; } /// Return true if this is the body character of a C++ raw string delimiter. LLVM_READONLY static inline bool isRawStringDelimBody(unsigned char c) { using namespace charinfo; return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_PERIOD| CHAR_DIGIT|CHAR_UNDER|CHAR_RAWDEL)) != 0; } /// Converts the given ASCII character to its lowercase equivalent. /// /// If the character is not an uppercase character, it is returned as is. LLVM_READONLY static inline char toLowercase(char c) { if (isUppercase(c)) return c + 'a' - 'A'; return c; } /// Converts the given ASCII character to its uppercase equivalent. /// /// If the character is not a lowercase character, it is returned as is. LLVM_READONLY static inline char toUppercase(char c) { if (isLowercase(c)) return c + 'A' - 'a'; return c; } /// Return true if this is a valid ASCII identifier. /// /// Note that this is a very simple check; it does not accept '$' or UCNs as /// valid identifier characters. LLVM_READONLY static inline bool isValidIdentifier(StringRef S) { if (S.empty() || !isIdentifierHead(S[0])) return false; for (StringRef::iterator I = S.begin(), E = S.end(); I != E; ++I) if (!isIdentifierBody(*I)) return false; return true; } } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/PlistSupport.h
//===---------- PlistSupport.h - Plist Output Utilities ---------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_PLISTSUPPORT_H #define LLVM_CLANG_BASIC_PLISTSUPPORT_H #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "llvm/Support/raw_ostream.h" namespace clang { namespace markup { typedef llvm::DenseMap<FileID, unsigned> FIDMap; inline void AddFID(FIDMap &FIDs, SmallVectorImpl<FileID> &V, const SourceManager &SM, SourceLocation L) { FileID FID = SM.getFileID(SM.getExpansionLoc(L)); FIDMap::iterator I = FIDs.find(FID); if (I != FIDs.end()) return; FIDs[FID] = V.size(); V.push_back(FID); } inline unsigned GetFID(const FIDMap &FIDs, const SourceManager &SM, SourceLocation L) { FileID FID = SM.getFileID(SM.getExpansionLoc(L)); FIDMap::const_iterator I = FIDs.find(FID); assert(I != FIDs.end()); return I->second; } inline raw_ostream &Indent(raw_ostream &o, const unsigned indent) { for (unsigned i = 0; i < indent; ++i) o << ' '; return o; } inline raw_ostream &EmitPlistHeader(raw_ostream &o) { static const char *PlistHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" " "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" "<plist version=\"1.0\">\n"; return o << PlistHeader; } inline raw_ostream &EmitInteger(raw_ostream &o, int64_t value) { o << "<integer>"; o << value; o << "</integer>"; return o; } inline raw_ostream &EmitString(raw_ostream &o, StringRef s) { o << "<string>"; for (StringRef::const_iterator I = s.begin(), E = s.end(); I != E; ++I) { char c = *I; switch (c) { default: o << c; break; case '&': o << "&amp;"; break; case '<': o << "&lt;"; break; case '>': o << "&gt;"; break; case '\'': o << "&apos;"; break; case '\"': o << "&quot;"; break; } } o << "</string>"; return o; } inline void EmitLocation(raw_ostream &o, const SourceManager &SM, SourceLocation L, const FIDMap &FM, unsigned indent) { if (L.isInvalid()) return; FullSourceLoc Loc(SM.getExpansionLoc(L), const_cast<SourceManager &>(SM)); Indent(o, indent) << "<dict>\n"; Indent(o, indent) << " <key>line</key>"; EmitInteger(o, Loc.getExpansionLineNumber()) << '\n'; Indent(o, indent) << " <key>col</key>"; EmitInteger(o, Loc.getExpansionColumnNumber()) << '\n'; Indent(o, indent) << " <key>file</key>"; EmitInteger(o, GetFID(FM, SM, Loc)) << '\n'; Indent(o, indent) << "</dict>\n"; } inline void EmitRange(raw_ostream &o, const SourceManager &SM, CharSourceRange R, const FIDMap &FM, unsigned indent) { if (R.isInvalid()) return; assert(R.isCharRange() && "cannot handle a token range"); Indent(o, indent) << "<array>\n"; EmitLocation(o, SM, R.getBegin(), FM, indent + 1); EmitLocation(o, SM, R.getEnd(), FM, indent + 1); Indent(o, indent) << "</array>\n"; } } } #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/LangOptions.h
//===--- LangOptions.h - C Language Family Language Options -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::LangOptions interface. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_LANGOPTIONS_H #define LLVM_CLANG_BASIC_LANGOPTIONS_H #include "dxc/DXIL/DxilConstants.h" // For DXIL::DefaultLinkage #include "dxc/Support/HLSLVersion.h" #include "clang/Basic/CommentOptions.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/ObjCRuntime.h" #include "clang/Basic/Sanitizers.h" #include "clang/Basic/Visibility.h" #include <string> #include <vector> namespace clang { /// Bitfields of LangOptions, split out from LangOptions in order to ensure that /// this large collection of bitfields is a trivial class type. class LangOptionsBase { public: // Define simple language options (with no accessors). #ifdef MS_SUPPORT_VARIABLE_LANGOPTS #define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits; #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) #include "clang/Basic/LangOptions.def" #else #define LANGOPT(Name, Bits, Default, Description) static const unsigned Name = Default; #define LANGOPT_BOOL(Name, Default, Description) static const bool Name = static_cast<bool>( Default ); #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) #include "clang/Basic/LangOptions.fixed.def" #endif protected: // Define language options of enumeration type. These are private, and will // have accessors (below). #ifdef MS_SUPPORT_VARIABLE_LANGOPTS #define LANGOPT(Name, Bits, Default, Description) #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ unsigned Name : Bits; #include "clang/Basic/LangOptions.def" #endif }; // #ifndef MS_SUPPORT_VARIABLE_LANGOPTS // #define LANGOPT(Name, Bits, Default, Description) __declspec(selectany) unsigned LangOptionsBase::#Name = Default; // #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) // #include "clang/Basic/LangOptions.fixed.def" // #endif /// \brief Keeps track of the various options that can be /// enabled, which controls the dialect of C or C++ that is accepted. class LangOptions : public LangOptionsBase { public: typedef clang::Visibility Visibility; enum GCMode { NonGC, GCOnly, HybridGC }; enum StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq }; enum SignedOverflowBehaviorTy { SOB_Undefined, // Default C standard behavior. SOB_Defined, // -fwrapv SOB_Trapping // -ftrapv }; enum PragmaMSPointersToMembersKind { PPTMK_BestCase, PPTMK_FullGeneralitySingleInheritance, PPTMK_FullGeneralityMultipleInheritance, PPTMK_FullGeneralityVirtualInheritance }; enum AddrSpaceMapMangling { ASMM_Target, ASMM_On, ASMM_Off }; enum MSVCMajorVersion { MSVC2010 = 16, MSVC2012 = 17, MSVC2013 = 18, MSVC2015 = 19 }; public: /// \brief Set of enabled sanitizers. SanitizerSet Sanitize; /// \brief Paths to blacklist files specifying which objects /// (files, functions, variables) should not be instrumented. std::vector<std::string> SanitizerBlacklistFiles; clang::ObjCRuntime ObjCRuntime; std::string ObjCConstantStringClass; /// \brief The name of the handler function to be called when -ftrapv is /// specified. /// /// If none is specified, abort (GCC-compatible behaviour). std::string OverflowHandler; /// \brief The name of the current module. std::string CurrentModule; /// \brief The name of the module that the translation unit is an /// implementation of. Prevents semantic imports, but does not otherwise /// treat this as the CurrentModule. std::string ImplementationOfModule; /// \brief The names of any features to enable in module 'requires' decls /// in addition to the hard-coded list in Module.cpp and the target features. /// /// This list is sorted. std::vector<std::string> ModuleFeatures; /// \brief Options for parsing comments. CommentOptions CommentOpts; LangOptions(); // Define accessors/mutators for language options of enumeration type. #ifdef MS_SUPPORT_VARIABLE_LANGOPTS #define LANGOPT(Name, Bits, Default, Description) #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ Type get##Name() const { return static_cast<Type>(Name); } \ void set##Name(Type Value) { Name = static_cast<unsigned>(Value); } #include "clang/Basic/LangOptions.def" #else #define LANGOPT(Name, Bits, Default, Description) #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ Type get##Name() const { return static_cast<Type>(Default); } \ void set##Name(Type Value) { assert(Value == Default); } #include "clang/Basic/LangOptions.fixed.def" #endif // HLSL Change Starts hlsl::LangStd HLSLVersion = hlsl::LangStd::vLatest; std::string HLSLEntryFunction; std::string HLSLProfile; unsigned RootSigMajor = 1; unsigned RootSigMinor = 1; bool IsHLSLLibrary = false; bool UseMinPrecision = true; // use min precision, not native precision. bool EnableDX9CompatMode = false; bool EnableFXCCompatMode = false; bool EnablePayloadAccessQualifiers = false; bool DumpImplicitTopLevelDecls = true; bool ExportShadersOnly = false; hlsl::DXIL::DefaultLinkage DefaultLinkage = hlsl::DXIL::DefaultLinkage::Default; /// Whether use row major as default matrix major. bool HLSLDefaultRowMajor = false; // HLSL Change Ends bool SPIRV = false; // SPIRV Change unsigned SpirvMajorVersion; // SPIRV Change unsigned SpirvMinorVersion; // SPIRV Change bool isSignedOverflowDefined() const { return getSignedOverflowBehavior() == SOB_Defined; } bool isSubscriptPointerArithmetic() const { return ObjCRuntime.isSubscriptPointerArithmetic() && !ObjCSubscriptingLegacyRuntime; } bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const { return MSCompatibilityVersion >= MajorVersion * 10000000U; } /// \brief Reset all of the options that are not considered when building a /// module. void resetNonModularOptions(); }; /// \brief Floating point control options class FPOptions { public: unsigned fp_contract : 1; FPOptions() : fp_contract(0) {} FPOptions(const LangOptions &LangOpts) : fp_contract(LangOpts.DefaultFPContract) {} }; /// \brief OpenCL volatile options class OpenCLOptions { public: #define OPENCLEXT(nm) unsigned nm : 1; #include "clang/Basic/OpenCLExtensions.def" OpenCLOptions() { #define OPENCLEXT(nm) nm = 0; #include "clang/Basic/OpenCLExtensions.def" } }; /// \brief Describes the kind of translation unit being processed. enum TranslationUnitKind { /// \brief The translation unit is a complete translation unit. TU_Complete, /// \brief The translation unit is a prefix to a translation unit, and is /// not complete. TU_Prefix, /// \brief The translation unit is a module. TU_Module }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/IdentifierTable.h
//===--- IdentifierTable.h - Hash table for identifier lookup ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::IdentifierInfo, clang::IdentifierTable, and /// clang::Selector interfaces. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_IDENTIFIERTABLE_H #define LLVM_CLANG_BASIC_IDENTIFIERTABLE_H #include "clang/Basic/LLVM.h" #include "clang/Basic/TokenKinds.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include <cassert> #include <string> namespace llvm { template <typename T> struct DenseMapInfo; } namespace clang { class LangOptions; class IdentifierInfo; class IdentifierTable; class SourceLocation; class MultiKeywordSelector; // private class used by Selector class DeclarationName; // AST class that stores declaration names /// \brief A simple pair of identifier info and location. typedef std::pair<IdentifierInfo*, SourceLocation> IdentifierLocPair; /// One of these records is kept for each identifier that /// is lexed. This contains information about whether the token was \#define'd, /// is a language keyword, or if it is a front-end token of some sort (e.g. a /// variable or function name). The preprocessor keeps this information in a /// set, and all tok::identifier tokens have a pointer to one of these. class IdentifierInfo { unsigned TokenID : 9; // Front-end token ID or tok::identifier. // Objective-C keyword ('protocol' in '@protocol') or builtin (__builtin_inf). // First NUM_OBJC_KEYWORDS values are for Objective-C, the remaining values // are for builtins. unsigned ObjCOrBuiltinID :13; bool HasMacro : 1; // True if there is a #define for this. bool HadMacro : 1; // True if there was a #define for this. bool IsExtension : 1; // True if identifier is a lang extension. bool IsFutureCompatKeyword : 1; // True if identifier is a keyword in a // newer Standard or proposed Standard. bool IsPoisoned : 1; // True if identifier is poisoned. bool IsCPPOperatorKeyword : 1; // True if ident is a C++ operator keyword. bool NeedsHandleIdentifier : 1; // See "RecomputeNeedsHandleIdentifier". bool IsFromAST : 1; // True if identifier was loaded (at least // partially) from an AST file. bool ChangedAfterLoad : 1; // True if identifier has changed from the // definition loaded from an AST file. bool RevertedTokenID : 1; // True if RevertTokenIDToIdentifier was // called. bool OutOfDate : 1; // True if there may be additional // information about this identifier // stored externally. bool IsModulesImport : 1; // True if this is the 'import' contextual // keyword. // 30 bit left in 64-bit word. void *FETokenInfo; // Managed by the language front-end. llvm::StringMapEntry<IdentifierInfo*> *Entry; IdentifierInfo(const IdentifierInfo&) = delete; void operator=(const IdentifierInfo&) = delete; friend class IdentifierTable; public: IdentifierInfo(); /// \brief Return true if this is the identifier for the specified string. /// /// This is intended to be used for string literals only: II->isStr("foo"). template <std::size_t StrLen> bool isStr(const char (&Str)[StrLen]) const { return getLength() == StrLen-1 && !memcmp(getNameStart(), Str, StrLen-1); } /// \brief Return the beginning of the actual null-terminated string for this /// identifier. /// const char *getNameStart() const { if (Entry) return Entry->getKeyData(); // FIXME: This is gross. It would be best not to embed specific details // of the PTH file format here. // The 'this' pointer really points to a // std::pair<IdentifierInfo, const char*>, where internal pointer // points to the external string data. typedef std::pair<IdentifierInfo, const char*> actualtype; return ((const actualtype*) this)->second; } /// \brief Efficiently return the length of this identifier info. /// unsigned getLength() const { if (Entry) return Entry->getKeyLength(); // FIXME: This is gross. It would be best not to embed specific details // of the PTH file format here. // The 'this' pointer really points to a // std::pair<IdentifierInfo, const char*>, where internal pointer // points to the external string data. typedef std::pair<IdentifierInfo, const char*> actualtype; const char* p = ((const actualtype*) this)->second - 2; return (((unsigned) p[0]) | (((unsigned) p[1]) << 8)) - 1; } /// \brief Return the actual identifier string. StringRef getName() const { return StringRef(getNameStart(), getLength()); } /// \brief Return true if this identifier is \#defined to some other value. /// \note The current definition may be in a module and not currently visible. bool hasMacroDefinition() const { return HasMacro; } void setHasMacroDefinition(bool Val) { if (HasMacro == Val) return; HasMacro = Val; if (Val) { NeedsHandleIdentifier = 1; HadMacro = true; } else { RecomputeNeedsHandleIdentifier(); } } /// \brief Returns true if this identifier was \#defined to some value at any /// moment. In this case there should be an entry for the identifier in the /// macro history table in Preprocessor. bool hadMacroDefinition() const { return HadMacro; } /// If this is a source-language token (e.g. 'for'), this API /// can be used to cause the lexer to map identifiers to source-language /// tokens. tok::TokenKind getTokenID() const { return (tok::TokenKind)TokenID; } /// \brief True if RevertTokenIDToIdentifier() was called. bool hasRevertedTokenIDToIdentifier() const { return RevertedTokenID; } /// \brief Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 /// compatibility. /// /// TokenID is normally read-only but there are 2 instances where we revert it /// to tok::identifier for libstdc++ 4.2. Keep track of when this happens /// using this method so we can inform serialization about it. void RevertTokenIDToIdentifier() { assert(TokenID != tok::identifier && "Already at tok::identifier"); TokenID = tok::identifier; RevertedTokenID = true; } /// \brief Return the preprocessor keyword ID for this identifier. /// /// For example, "define" will return tok::pp_define. tok::PPKeywordKind getPPKeywordID() const; /// \brief Return the Objective-C keyword ID for the this identifier. /// /// For example, 'class' will return tok::objc_class if ObjC is enabled. tok::ObjCKeywordKind getObjCKeywordID() const { if (ObjCOrBuiltinID < tok::NUM_OBJC_KEYWORDS) return tok::ObjCKeywordKind(ObjCOrBuiltinID); else return tok::objc_not_keyword; } void setObjCKeywordID(tok::ObjCKeywordKind ID) { ObjCOrBuiltinID = ID; } /// \brief Return a value indicating whether this is a builtin function. /// /// 0 is not-built-in. 1 is builtin-for-some-nonprimary-target. /// 2+ are specific builtin functions. unsigned getBuiltinID() const { if (ObjCOrBuiltinID >= tok::NUM_OBJC_KEYWORDS) return ObjCOrBuiltinID - tok::NUM_OBJC_KEYWORDS; else return 0; } void setBuiltinID(unsigned ID) { ObjCOrBuiltinID = ID + tok::NUM_OBJC_KEYWORDS; assert(ObjCOrBuiltinID - unsigned(tok::NUM_OBJC_KEYWORDS) == ID && "ID too large for field!"); } unsigned getObjCOrBuiltinID() const { return ObjCOrBuiltinID; } void setObjCOrBuiltinID(unsigned ID) { ObjCOrBuiltinID = ID; } /// get/setExtension - Initialize information about whether or not this /// language token is an extension. This controls extension warnings, and is /// only valid if a custom token ID is set. bool isExtensionToken() const { return IsExtension; } void setIsExtensionToken(bool Val) { IsExtension = Val; if (Val) NeedsHandleIdentifier = 1; else RecomputeNeedsHandleIdentifier(); } /// is/setIsFutureCompatKeyword - Initialize information about whether or not /// this language token is a keyword in a newer or proposed Standard. This /// controls compatibility warnings, and is only true when not parsing the /// corresponding Standard. Once a compatibility problem has been diagnosed /// with this keyword, the flag will be cleared. bool isFutureCompatKeyword() const { return IsFutureCompatKeyword; } void setIsFutureCompatKeyword(bool Val) { IsFutureCompatKeyword = Val; if (Val) NeedsHandleIdentifier = 1; else RecomputeNeedsHandleIdentifier(); } /// setIsPoisoned - Mark this identifier as poisoned. After poisoning, the /// Preprocessor will emit an error every time this token is used. void setIsPoisoned(bool Value = true) { IsPoisoned = Value; if (Value) NeedsHandleIdentifier = 1; else RecomputeNeedsHandleIdentifier(); } /// \brief Return true if this token has been poisoned. bool isPoisoned() const { return IsPoisoned; } /// isCPlusPlusOperatorKeyword/setIsCPlusPlusOperatorKeyword controls whether /// this identifier is a C++ alternate representation of an operator. void setIsCPlusPlusOperatorKeyword(bool Val = true) { IsCPPOperatorKeyword = Val; if (Val) NeedsHandleIdentifier = 1; else RecomputeNeedsHandleIdentifier(); } bool isCPlusPlusOperatorKeyword() const { return IsCPPOperatorKeyword; } /// \brief Return true if this token is a keyword in the specified language. bool isKeyword(const LangOptions &LangOpts); /// getFETokenInfo/setFETokenInfo - The language front-end is allowed to /// associate arbitrary metadata with this token. template<typename T> T *getFETokenInfo() const { return static_cast<T*>(FETokenInfo); } void setFETokenInfo(void *T) { FETokenInfo = T; } /// \brief Return true if the Preprocessor::HandleIdentifier must be called /// on a token of this identifier. /// /// If this returns false, we know that HandleIdentifier will not affect /// the token. bool isHandleIdentifierCase() const { return NeedsHandleIdentifier; } /// \brief Return true if the identifier in its current state was loaded /// from an AST file. bool isFromAST() const { return IsFromAST; } void setIsFromAST() { IsFromAST = true; } /// \brief Determine whether this identifier has changed since it was loaded /// from an AST file. bool hasChangedSinceDeserialization() const { return ChangedAfterLoad; } /// \brief Note that this identifier has changed since it was loaded from /// an AST file. void setChangedSinceDeserialization() { ChangedAfterLoad = true; } /// \brief Determine whether the information for this identifier is out of /// date with respect to the external source. bool isOutOfDate() const { return OutOfDate; } /// \brief Set whether the information for this identifier is out of /// date with respect to the external source. void setOutOfDate(bool OOD) { OutOfDate = OOD; if (OOD) NeedsHandleIdentifier = true; else RecomputeNeedsHandleIdentifier(); } /// \brief Determine whether this is the contextual keyword \c import. bool isModulesImport() const { return IsModulesImport; } /// \brief Set whether this identifier is the contextual keyword \c import. void setModulesImport(bool I) { IsModulesImport = I; if (I) NeedsHandleIdentifier = true; else RecomputeNeedsHandleIdentifier(); } /// \brief Provide less than operator for lexicographical sorting. bool operator<(const IdentifierInfo &RHS) const { return getName() < RHS.getName(); } private: /// The Preprocessor::HandleIdentifier does several special (but rare) /// things to identifiers of various sorts. For example, it changes the /// \c for keyword token from tok::identifier to tok::for. /// /// This method is very tied to the definition of HandleIdentifier. Any /// change to it should be reflected here. void RecomputeNeedsHandleIdentifier() { NeedsHandleIdentifier = (isPoisoned() || hasMacroDefinition() || isCPlusPlusOperatorKeyword() || isExtensionToken() || isFutureCompatKeyword() || isOutOfDate() || isModulesImport()); } }; /// \brief An RAII object for [un]poisoning an identifier within a scope. /// /// \p II is allowed to be null, in which case objects of this type have /// no effect. class PoisonIdentifierRAIIObject { IdentifierInfo *const II; const bool OldValue; public: PoisonIdentifierRAIIObject(IdentifierInfo *II, bool NewValue) : II(II), OldValue(II ? II->isPoisoned() : false) { if(II) II->setIsPoisoned(NewValue); } ~PoisonIdentifierRAIIObject() { if(II) II->setIsPoisoned(OldValue); } }; /// \brief An iterator that walks over all of the known identifiers /// in the lookup table. /// /// Since this iterator uses an abstract interface via virtual /// functions, it uses an object-oriented interface rather than the /// more standard C++ STL iterator interface. In this OO-style /// iteration, the single function \c Next() provides dereference, /// advance, and end-of-sequence checking in a single /// operation. Subclasses of this iterator type will provide the /// actual functionality. class IdentifierIterator { private: IdentifierIterator(const IdentifierIterator &) = delete; void operator=(const IdentifierIterator &) = delete; protected: IdentifierIterator() { } public: virtual ~IdentifierIterator(); /// \brief Retrieve the next string in the identifier table and /// advances the iterator for the following string. /// /// \returns The next string in the identifier table. If there is /// no such string, returns an empty \c StringRef. virtual StringRef Next() = 0; }; /// \brief Provides lookups to, and iteration over, IdentiferInfo objects. class IdentifierInfoLookup { public: virtual ~IdentifierInfoLookup(); /// \brief Return the IdentifierInfo for the specified named identifier. /// /// Unlike the version in IdentifierTable, this returns a pointer instead /// of a reference. If the pointer is null then the IdentifierInfo cannot /// be found. virtual IdentifierInfo* get(StringRef Name) = 0; /// \brief Retrieve an iterator into the set of all identifiers /// known to this identifier lookup source. /// /// This routine provides access to all of the identifiers known to /// the identifier lookup, allowing access to the contents of the /// identifiers without introducing the overhead of constructing /// IdentifierInfo objects for each. /// /// \returns A new iterator into the set of known identifiers. The /// caller is responsible for deleting this iterator. virtual IdentifierIterator *getIdentifiers(); }; /// \brief Implements an efficient mapping from strings to IdentifierInfo nodes. /// /// This has no other purpose, but this is an extremely performance-critical /// piece of the code, as each occurrence of every identifier goes through /// here when lexed. class IdentifierTable { // Shark shows that using MallocAllocator is *much* slower than using this // BumpPtrAllocator! typedef llvm::StringMap<IdentifierInfo*, llvm::BumpPtrAllocator> HashTableTy; HashTableTy HashTable; IdentifierInfoLookup* ExternalLookup; public: /// \brief Create the identifier table, populating it with info about the /// language keywords for the language specified by \p LangOpts. IdentifierTable(const LangOptions &LangOpts, IdentifierInfoLookup* externalLookup = nullptr); /// \brief Set the external identifier lookup mechanism. void setExternalIdentifierLookup(IdentifierInfoLookup *IILookup) { ExternalLookup = IILookup; } /// \brief Retrieve the external identifier lookup object, if any. IdentifierInfoLookup *getExternalIdentifierLookup() const { return ExternalLookup; } llvm::BumpPtrAllocator& getAllocator() { return HashTable.getAllocator(); } /// \brief Return the identifier token info for the specified named /// identifier. IdentifierInfo &get(StringRef Name) { auto &Entry = *HashTable.insert(std::make_pair(Name, nullptr)).first; IdentifierInfo *&II = Entry.second; if (II) return *II; // No entry; if we have an external lookup, look there first. if (ExternalLookup) { II = ExternalLookup->get(Name); if (II) return *II; } // Lookups failed, make a new IdentifierInfo. void *Mem = getAllocator().Allocate<IdentifierInfo>(); II = new (Mem) IdentifierInfo(); // Make sure getName() knows how to find the IdentifierInfo // contents. II->Entry = &Entry; return *II; } IdentifierInfo &get(StringRef Name, tok::TokenKind TokenCode) { IdentifierInfo &II = get(Name); II.TokenID = TokenCode; assert(II.TokenID == (unsigned) TokenCode && "TokenCode too large"); return II; } /// \brief Gets an IdentifierInfo for the given name without consulting /// external sources. /// /// This is a version of get() meant for external sources that want to /// introduce or modify an identifier. If they called get(), they would /// likely end up in a recursion. IdentifierInfo &getOwn(StringRef Name) { auto &Entry = *HashTable.insert(std::make_pair(Name, nullptr)).first; IdentifierInfo *&II = Entry.second; if (II) return *II; // Lookups failed, make a new IdentifierInfo. void *Mem = getAllocator().Allocate<IdentifierInfo>(); II = new (Mem) IdentifierInfo(); // Make sure getName() knows how to find the IdentifierInfo // contents. II->Entry = &Entry; // If this is the 'import' contextual keyword, mark it as such. if (Name.equals("import")) II->setModulesImport(true); return *II; } typedef HashTableTy::const_iterator iterator; typedef HashTableTy::const_iterator const_iterator; iterator begin() const { return HashTable.begin(); } iterator end() const { return HashTable.end(); } unsigned size() const { return HashTable.size(); } /// \brief Print some statistics to stderr that indicate how well the /// hashing is doing. void PrintStats() const; void AddKeywords(const LangOptions &LangOpts); }; /// \brief A family of Objective-C methods. /// /// These families have no inherent meaning in the language, but are /// nonetheless central enough in the existing implementations to /// merit direct AST support. While, in theory, arbitrary methods can /// be considered to form families, we focus here on the methods /// involving allocation and retain-count management, as these are the /// most "core" and the most likely to be useful to diverse clients /// without extra information. /// /// Both selectors and actual method declarations may be classified /// into families. Method families may impose additional restrictions /// beyond their selector name; for example, a method called '_init' /// that returns void is not considered to be in the 'init' family /// (but would be if it returned 'id'). It is also possible to /// explicitly change or remove a method's family. Therefore the /// method's family should be considered the single source of truth. enum ObjCMethodFamily { /// \brief No particular method family. OMF_None, // Selectors in these families may have arbitrary arity, may be // written with arbitrary leading underscores, and may have // additional CamelCase "words" in their first selector chunk // following the family name. OMF_alloc, OMF_copy, OMF_init, OMF_mutableCopy, OMF_new, // These families are singletons consisting only of the nullary // selector with the given name. OMF_autorelease, OMF_dealloc, OMF_finalize, OMF_release, OMF_retain, OMF_retainCount, OMF_self, OMF_initialize, // performSelector families OMF_performSelector }; /// Enough bits to store any enumerator in ObjCMethodFamily or /// InvalidObjCMethodFamily. enum { ObjCMethodFamilyBitWidth = 4 }; /// \brief An invalid value of ObjCMethodFamily. enum { InvalidObjCMethodFamily = (1 << ObjCMethodFamilyBitWidth) - 1 }; /// \brief A family of Objective-C methods. /// /// These are family of methods whose result type is initially 'id', but /// but are candidate for the result type to be changed to 'instancetype'. enum ObjCInstanceTypeFamily { OIT_None, OIT_Array, OIT_Dictionary, OIT_Singleton, OIT_Init, OIT_ReturnsSelf }; enum ObjCStringFormatFamily { SFF_None, SFF_NSString, SFF_CFString }; /// \brief Smart pointer class that efficiently represents Objective-C method /// names. /// /// This class will either point to an IdentifierInfo or a /// MultiKeywordSelector (which is private). This enables us to optimize /// selectors that take no arguments and selectors that take 1 argument, which /// accounts for 78% of all selectors in Cocoa.h. class Selector { friend class Diagnostic; enum IdentifierInfoFlag { // Empty selector = 0. ZeroArg = 0x1, OneArg = 0x2, MultiArg = 0x3, ArgFlags = ZeroArg|OneArg }; uintptr_t InfoPtr; // a pointer to the MultiKeywordSelector or IdentifierInfo. Selector(IdentifierInfo *II, unsigned nArgs) { InfoPtr = reinterpret_cast<uintptr_t>(II); assert((InfoPtr & ArgFlags) == 0 &&"Insufficiently aligned IdentifierInfo"); assert(nArgs < 2 && "nArgs not equal to 0/1"); InfoPtr |= nArgs+1; } Selector(MultiKeywordSelector *SI) { InfoPtr = reinterpret_cast<uintptr_t>(SI); assert((InfoPtr & ArgFlags) == 0 &&"Insufficiently aligned IdentifierInfo"); InfoPtr |= MultiArg; } IdentifierInfo *getAsIdentifierInfo() const { if (getIdentifierInfoFlag() < MultiArg) return reinterpret_cast<IdentifierInfo *>(InfoPtr & ~ArgFlags); return nullptr; } MultiKeywordSelector *getMultiKeywordSelector() const { return reinterpret_cast<MultiKeywordSelector *>(InfoPtr & ~ArgFlags); } unsigned getIdentifierInfoFlag() const { return InfoPtr & ArgFlags; } static ObjCMethodFamily getMethodFamilyImpl(Selector sel); static ObjCStringFormatFamily getStringFormatFamilyImpl(Selector sel); public: friend class SelectorTable; // only the SelectorTable can create these friend class DeclarationName; // and the AST's DeclarationName. /// The default ctor should only be used when creating data structures that /// will contain selectors. Selector() : InfoPtr(0) {} Selector(uintptr_t V) : InfoPtr(V) {} /// operator==/!= - Indicate whether the specified selectors are identical. bool operator==(Selector RHS) const { return InfoPtr == RHS.InfoPtr; } bool operator!=(Selector RHS) const { return InfoPtr != RHS.InfoPtr; } void *getAsOpaquePtr() const { return reinterpret_cast<void*>(InfoPtr); } /// \brief Determine whether this is the empty selector. bool isNull() const { return InfoPtr == 0; } // Predicates to identify the selector type. bool isKeywordSelector() const { return getIdentifierInfoFlag() != ZeroArg; } bool isUnarySelector() const { return getIdentifierInfoFlag() == ZeroArg; } unsigned getNumArgs() const; /// \brief Retrieve the identifier at a given position in the selector. /// /// Note that the identifier pointer returned may be NULL. Clients that only /// care about the text of the identifier string, and not the specific, /// uniqued identifier pointer, should use \c getNameForSlot(), which returns /// an empty string when the identifier pointer would be NULL. /// /// \param argIndex The index for which we want to retrieve the identifier. /// This index shall be less than \c getNumArgs() unless this is a keyword /// selector, in which case 0 is the only permissible value. /// /// \returns the uniqued identifier for this slot, or NULL if this slot has /// no corresponding identifier. IdentifierInfo *getIdentifierInfoForSlot(unsigned argIndex) const; /// \brief Retrieve the name at a given position in the selector. /// /// \param argIndex The index for which we want to retrieve the name. /// This index shall be less than \c getNumArgs() unless this is a keyword /// selector, in which case 0 is the only permissible value. /// /// \returns the name for this slot, which may be the empty string if no /// name was supplied. StringRef getNameForSlot(unsigned argIndex) const; /// \brief Derive the full selector name (e.g. "foo:bar:") and return /// it as an std::string. std::string getAsString() const; /// \brief Prints the full selector name (e.g. "foo:bar:"). void print(llvm::raw_ostream &OS) const; /// \brief Derive the conventional family of this method. ObjCMethodFamily getMethodFamily() const { return getMethodFamilyImpl(*this); } ObjCStringFormatFamily getStringFormatFamily() const { return getStringFormatFamilyImpl(*this); } static Selector getEmptyMarker() { return Selector(uintptr_t(-1)); } static Selector getTombstoneMarker() { return Selector(uintptr_t(-2)); } static ObjCInstanceTypeFamily getInstTypeMethodFamily(Selector sel); }; /// \brief This table allows us to fully hide how we implement /// multi-keyword caching. class SelectorTable { void *Impl; // Actually a SelectorTableImpl SelectorTable(const SelectorTable &) = delete; void operator=(const SelectorTable &) = delete; public: SelectorTable(); ~SelectorTable(); /// \brief Can create any sort of selector. /// /// \p NumArgs indicates whether this is a no argument selector "foo", a /// single argument selector "foo:" or multi-argument "foo:bar:". Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV); Selector getUnarySelector(IdentifierInfo *ID) { return Selector(ID, 1); } Selector getNullarySelector(IdentifierInfo *ID) { return Selector(ID, 0); } /// \brief Return the total amount of memory allocated for managing selectors. size_t getTotalMemory() const; /// \brief Return the default setter name for the given identifier. /// /// This is "set" + \p Name where the initial character of \p Name /// has been capitalized. static SmallString<64> constructSetterName(StringRef Name); /// \brief Return the default setter selector for the given identifier. /// /// This is "set" + \p Name where the initial character of \p Name /// has been capitalized. static Selector constructSetterSelector(IdentifierTable &Idents, SelectorTable &SelTable, const IdentifierInfo *Name); }; /// DeclarationNameExtra - Common base of the MultiKeywordSelector, /// CXXSpecialName, and CXXOperatorIdName classes, all of which are /// private classes that describe different kinds of names. class DeclarationNameExtra { public: /// ExtraKind - The kind of "extra" information stored in the /// DeclarationName. See @c ExtraKindOrNumArgs for an explanation of /// how these enumerator values are used. enum ExtraKind { CXXConstructor = 0, CXXDestructor, CXXConversionFunction, #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \ CXXOperator##Name, #include "clang/Basic/OperatorKinds.def" CXXLiteralOperator, CXXUsingDirective, NUM_EXTRA_KINDS }; /// ExtraKindOrNumArgs - Either the kind of C++ special name or /// operator-id (if the value is one of the CXX* enumerators of /// ExtraKind), in which case the DeclarationNameExtra is also a /// CXXSpecialName, (for CXXConstructor, CXXDestructor, or /// CXXConversionFunction) CXXOperatorIdName, or CXXLiteralOperatorName, /// it may be also name common to C++ using-directives (CXXUsingDirective), /// otherwise it is NUM_EXTRA_KINDS+NumArgs, where NumArgs is the number of /// arguments in the Objective-C selector, in which case the /// DeclarationNameExtra is also a MultiKeywordSelector. unsigned ExtraKindOrNumArgs; }; } // end namespace clang namespace llvm { /// Define DenseMapInfo so that Selectors can be used as keys in DenseMap and /// DenseSets. template <> struct DenseMapInfo<clang::Selector> { static inline clang::Selector getEmptyKey() { return clang::Selector::getEmptyMarker(); } static inline clang::Selector getTombstoneKey() { return clang::Selector::getTombstoneMarker(); } static unsigned getHashValue(clang::Selector S); static bool isEqual(clang::Selector LHS, clang::Selector RHS) { return LHS == RHS; } }; template <> struct isPodLike<clang::Selector> { static const bool value = true; }; template <typename T> class PointerLikeTypeTraits; template<> class PointerLikeTypeTraits<clang::Selector> { public: static inline const void *getAsVoidPointer(clang::Selector P) { return P.getAsOpaquePtr(); } static inline clang::Selector getFromVoidPointer(const void *P) { return clang::Selector(reinterpret_cast<uintptr_t>(P)); } enum { NumLowBitsAvailable = 0 }; }; // Provide PointerLikeTypeTraits for IdentifierInfo pointers, which // are not guaranteed to be 8-byte aligned. template<> class PointerLikeTypeTraits<clang::IdentifierInfo*> { public: static inline void *getAsVoidPointer(clang::IdentifierInfo* P) { return P; } static inline clang::IdentifierInfo *getFromVoidPointer(void *P) { return static_cast<clang::IdentifierInfo*>(P); } enum { NumLowBitsAvailable = 1 }; }; template<> class PointerLikeTypeTraits<const clang::IdentifierInfo*> { public: static inline const void *getAsVoidPointer(const clang::IdentifierInfo* P) { return P; } static inline const clang::IdentifierInfo *getFromVoidPointer(const void *P) { return static_cast<const clang::IdentifierInfo*>(P); } enum { NumLowBitsAvailable = 1 }; }; } // end namespace llvm #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/TypeTraits.h
//===--- TypeTraits.h - C++ Type Traits Support Enumerations ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines enumerations for the type traits support. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TYPETRAITS_H #define LLVM_CLANG_BASIC_TYPETRAITS_H namespace clang { /// \brief Names for traits that operate specifically on types. enum TypeTrait { UTT_HasNothrowAssign, UTT_HasNothrowMoveAssign, UTT_HasNothrowCopy, UTT_HasNothrowConstructor, UTT_HasTrivialAssign, UTT_HasTrivialMoveAssign, UTT_HasTrivialCopy, UTT_HasTrivialDefaultConstructor, UTT_HasTrivialMoveConstructor, UTT_HasTrivialDestructor, UTT_HasVirtualDestructor, UTT_IsAbstract, UTT_IsArithmetic, UTT_IsArray, UTT_IsClass, UTT_IsCompleteType, UTT_IsCompound, UTT_IsConst, UTT_IsDestructible, UTT_IsEmpty, UTT_IsEnum, UTT_IsFinal, UTT_IsFloatingPoint, UTT_IsFunction, UTT_IsFundamental, UTT_IsIntegral, UTT_IsInterfaceClass, UTT_IsLiteral, UTT_IsLvalueReference, UTT_IsMemberFunctionPointer, UTT_IsMemberObjectPointer, UTT_IsMemberPointer, UTT_IsNothrowDestructible, UTT_IsObject, UTT_IsPOD, UTT_IsPointer, UTT_IsPolymorphic, UTT_IsReference, UTT_IsRvalueReference, UTT_IsScalar, UTT_IsSealed, UTT_IsSigned, UTT_IsStandardLayout, UTT_IsTrivial, UTT_IsTriviallyCopyable, UTT_IsUnion, UTT_IsUnsigned, UTT_IsVoid, UTT_IsVolatile, UTT_Last = UTT_IsVolatile, BTT_IsBaseOf, BTT_IsConvertible, BTT_IsConvertibleTo, BTT_IsSame, BTT_TypeCompatible, BTT_IsNothrowAssignable, BTT_IsTriviallyAssignable, BTT_Last = BTT_IsTriviallyAssignable, TT_IsConstructible, TT_IsNothrowConstructible, TT_IsTriviallyConstructible }; /// \brief Names for the array type traits. enum ArrayTypeTrait { ATT_ArrayRank, ATT_ArrayExtent }; /// \brief Names for the "expression or type" traits. enum UnaryExprOrTypeTrait { UETT_SizeOf, UETT_AlignOf, UETT_VecStep, UETT_OpenMPRequiredSimdAlign, UETT_ArrayLength, // HLSL Change }; } #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsLe64.def
//==- BuiltinsLe64.def - Le64 Builtin function database ----------*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the Le64-specific builtin function database. Users of this // file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// BUILTIN(__clear_cache, "vv*v*", "i") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/Linkage.h
//===--- Linkage.h - Linkage enumeration and utilities ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the Linkage enumeration and various utility functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_LINKAGE_H #define LLVM_CLANG_BASIC_LINKAGE_H #include <assert.h> #include <stdint.h> #include <utility> namespace clang { /// \brief Describes the different kinds of linkage /// (C++ [basic.link], C99 6.2.2) that an entity may have. enum Linkage : unsigned char { /// \brief No linkage, which means that the entity is unique and /// can only be referred to from within its scope. NoLinkage = 0, /// \brief Internal linkage, which indicates that the entity can /// be referred to from within the translation unit (but not other /// translation units). InternalLinkage, /// \brief External linkage within a unique namespace. /// /// From the language perspective, these entities have external /// linkage. However, since they reside in an anonymous namespace, /// their names are unique to this translation unit, which is /// equivalent to having internal linkage from the code-generation /// point of view. UniqueExternalLinkage, /// \brief No linkage according to the standard, but is visible from other /// translation units because of types defined in a inline function. VisibleNoLinkage, /// \brief External linkage, which indicates that the entity can /// be referred to from other translation units. ExternalLinkage }; /// \brief Describes the different kinds of language linkage /// (C++ [dcl.link]) that an entity may have. enum LanguageLinkage { CLanguageLinkage, CXXLanguageLinkage, NoLanguageLinkage }; /// \brief A more specific kind of linkage than enum Linkage. /// /// This is relevant to CodeGen and AST file reading. enum GVALinkage { GVA_Internal, GVA_AvailableExternally, GVA_DiscardableODR, GVA_StrongExternal, GVA_StrongODR }; inline bool isExternallyVisible(Linkage L) { return L == ExternalLinkage || L == VisibleNoLinkage; } inline Linkage getFormalLinkage(Linkage L) { if (L == UniqueExternalLinkage) return ExternalLinkage; if (L == VisibleNoLinkage) return NoLinkage; return L; } inline bool isExternalFormalLinkage(Linkage L) { return getFormalLinkage(L) == ExternalLinkage; } /// \brief Compute the minimum linkage given two linkages. /// /// The linkage can be interpreted as a pair formed by the formal linkage and /// a boolean for external visibility. This is just what getFormalLinkage and /// isExternallyVisible return. We want the minimum of both components. The /// Linkage enum is defined in an order that makes this simple, we just need /// special cases for when VisibleNoLinkage would lose the visible bit and /// become NoLinkage. inline Linkage minLinkage(Linkage L1, Linkage L2) { if (L2 == VisibleNoLinkage) std::swap(L1, L2); if (L1 == VisibleNoLinkage) { if (L2 == InternalLinkage) return NoLinkage; if (L2 == UniqueExternalLinkage) return NoLinkage; } return L1 < L2 ? L1 : L2; } } // end namespace clang #endif // LLVM_CLANG_BASIC_LINKAGE_H
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/ABI.h
//===----- ABI.h - ABI related declarations ---------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Enums/classes describing ABI related information about constructors, /// destructors and thunks. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_ABI_H #define LLVM_CLANG_BASIC_ABI_H #include "llvm/Support/DataTypes.h" #include <cstring> namespace clang { /// \brief C++ constructor types. enum CXXCtorType { Ctor_Complete, ///< Complete object ctor Ctor_Base, ///< Base object ctor Ctor_Comdat, ///< The COMDAT used for ctors Ctor_CopyingClosure, ///< Copying closure variant of a ctor Ctor_DefaultClosure, ///< Default closure variant of a ctor }; /// \brief C++ destructor types. enum CXXDtorType { Dtor_Deleting, ///< Deleting dtor Dtor_Complete, ///< Complete object dtor Dtor_Base, ///< Base object dtor Dtor_Comdat ///< The COMDAT used for dtors }; /// \brief A return adjustment. struct ReturnAdjustment { /// \brief The non-virtual adjustment from the derived object to its /// nearest virtual base. int64_t NonVirtual; /// \brief Holds the ABI-specific information about the virtual return /// adjustment, if needed. union VirtualAdjustment { // Itanium ABI struct { /// \brief The offset (in bytes), relative to the address point /// of the virtual base class offset. int64_t VBaseOffsetOffset; } Itanium; // Microsoft ABI struct { /// \brief The offset (in bytes) of the vbptr, relative to the beginning /// of the derived class. uint32_t VBPtrOffset; /// \brief Index of the virtual base in the vbtable. uint32_t VBIndex; } Microsoft; VirtualAdjustment() { memset(this, 0, sizeof(*this)); } bool Equals(const VirtualAdjustment &Other) const { return memcmp(this, &Other, sizeof(Other)) == 0; } bool isEmpty() const { VirtualAdjustment Zero; return Equals(Zero); } bool Less(const VirtualAdjustment &RHS) const { return memcmp(this, &RHS, sizeof(RHS)) < 0; } } Virtual; ReturnAdjustment() : NonVirtual(0) {} bool isEmpty() const { return !NonVirtual && Virtual.isEmpty(); } friend bool operator==(const ReturnAdjustment &LHS, const ReturnAdjustment &RHS) { return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Equals(RHS.Virtual); } friend bool operator!=(const ReturnAdjustment &LHS, const ReturnAdjustment &RHS) { return !(LHS == RHS); } friend bool operator<(const ReturnAdjustment &LHS, const ReturnAdjustment &RHS) { if (LHS.NonVirtual < RHS.NonVirtual) return true; return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Less(RHS.Virtual); } }; /// \brief A \c this pointer adjustment. struct ThisAdjustment { /// \brief The non-virtual adjustment from the derived object to its /// nearest virtual base. int64_t NonVirtual; /// \brief Holds the ABI-specific information about the virtual this /// adjustment, if needed. union VirtualAdjustment { // Itanium ABI struct { /// \brief The offset (in bytes), relative to the address point, /// of the virtual call offset. int64_t VCallOffsetOffset; } Itanium; struct { /// \brief The offset of the vtordisp (in bytes), relative to the ECX. int32_t VtordispOffset; /// \brief The offset of the vbptr of the derived class (in bytes), /// relative to the ECX after vtordisp adjustment. int32_t VBPtrOffset; /// \brief The offset (in bytes) of the vbase offset in the vbtable. int32_t VBOffsetOffset; } Microsoft; VirtualAdjustment() { memset(this, 0, sizeof(*this)); } bool Equals(const VirtualAdjustment &Other) const { return memcmp(this, &Other, sizeof(Other)) == 0; } bool isEmpty() const { VirtualAdjustment Zero; return Equals(Zero); } bool Less(const VirtualAdjustment &RHS) const { return memcmp(this, &RHS, sizeof(RHS)) < 0; } } Virtual; ThisAdjustment() : NonVirtual(0) { } bool isEmpty() const { return !NonVirtual && Virtual.isEmpty(); } friend bool operator==(const ThisAdjustment &LHS, const ThisAdjustment &RHS) { return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Equals(RHS.Virtual); } friend bool operator!=(const ThisAdjustment &LHS, const ThisAdjustment &RHS) { return !(LHS == RHS); } friend bool operator<(const ThisAdjustment &LHS, const ThisAdjustment &RHS) { if (LHS.NonVirtual < RHS.NonVirtual) return true; return LHS.NonVirtual == RHS.NonVirtual && LHS.Virtual.Less(RHS.Virtual); } }; class CXXMethodDecl; /// \brief The \c this pointer adjustment as well as an optional return /// adjustment for a thunk. struct ThunkInfo { /// \brief The \c this pointer adjustment. ThisAdjustment This; /// \brief The return adjustment. ReturnAdjustment Return; /// \brief Holds a pointer to the overridden method this thunk is for, /// if needed by the ABI to distinguish different thunks with equal /// adjustments. Otherwise, null. /// CAUTION: In the unlikely event you need to sort ThunkInfos, consider using /// an ABI-specific comparator. const CXXMethodDecl *Method; ThunkInfo() : Method(nullptr) { } ThunkInfo(const ThisAdjustment &This, const ReturnAdjustment &Return, const CXXMethodDecl *Method = nullptr) : This(This), Return(Return), Method(Method) {} friend bool operator==(const ThunkInfo &LHS, const ThunkInfo &RHS) { return LHS.This == RHS.This && LHS.Return == RHS.Return && LHS.Method == RHS.Method; } bool isEmpty() const { return This.isEmpty() && Return.isEmpty() && Method == nullptr; } }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/FileManager.h
//===--- FileManager.h - File System Probing and Caching --------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the clang::FileManager interface and associated types. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_FILEMANAGER_H #define LLVM_CLANG_BASIC_FILEMANAGER_H #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/VirtualFileSystem.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" #include <memory> #include <map> namespace llvm { class MemoryBuffer; } namespace clang { class FileManager; class FileSystemStatCache; /// \brief Cached information about one directory (either on disk or in /// the virtual file system). class DirectoryEntry { const char *Name; // Name of the directory. friend class FileManager; public: DirectoryEntry() : Name(nullptr) {} const char *getName() const { return Name; } }; /// \brief Cached information about one file (either on disk /// or in the virtual file system). /// /// If the 'File' member is valid, then this FileEntry has an open file /// descriptor for the file. class FileEntry { const char *Name; // Name of the file. off_t Size; // File size in bytes. time_t ModTime; // Modification time of file. const DirectoryEntry *Dir; // Directory file lives in. unsigned UID; // A unique (small) ID for the file. llvm::sys::fs::UniqueID UniqueID; bool IsNamedPipe; bool InPCH; bool IsValid; // Is this \c FileEntry initialized and valid? /// \brief The open file, if it is owned by the \p FileEntry. mutable std::unique_ptr<vfs::File> File; friend class FileManager; void operator=(const FileEntry &) = delete; public: FileEntry() : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false) {} // FIXME: this is here to allow putting FileEntry in std::map. Once we have // emplace, we shouldn't need a copy constructor anymore. /// Intentionally does not copy fields that are not set in an uninitialized /// \c FileEntry. FileEntry(const FileEntry &FE) : UniqueID(FE.UniqueID), IsNamedPipe(FE.IsNamedPipe), InPCH(FE.InPCH), IsValid(FE.IsValid) { assert(!isValid() && "Cannot copy an initialized FileEntry"); } const char *getName() const { return Name; } bool isValid() const { return IsValid; } off_t getSize() const { return Size; } unsigned getUID() const { return UID; } const llvm::sys::fs::UniqueID &getUniqueID() const { return UniqueID; } bool isInPCH() const { return InPCH; } time_t getModificationTime() const { return ModTime; } /// \brief Return the directory the file lives in. const DirectoryEntry *getDir() const { return Dir; } bool operator<(const FileEntry &RHS) const { return UniqueID < RHS.UniqueID; } /// \brief Check whether the file is a named pipe (and thus can't be opened by /// the native FileManager methods). bool isNamedPipe() const { return IsNamedPipe; } void closeFile() const { File.reset(); // rely on destructor to close File } }; struct FileData; /// \brief Implements support for file system lookup, file system caching, /// and directory search management. /// /// This also handles more advanced properties, such as uniquing files based /// on "inode", so that a file with two names (e.g. symlinked) will be treated /// as a single file. /// class FileManager : public RefCountedBase<FileManager> { IntrusiveRefCntPtr<vfs::FileSystem> FS; FileSystemOptions FileSystemOpts; /// \brief Cache for existing real directories. std::map<llvm::sys::fs::UniqueID, DirectoryEntry> UniqueRealDirs; /// \brief Cache for existing real files. std::map<llvm::sys::fs::UniqueID, FileEntry> UniqueRealFiles; /// \brief The virtual directories that we have allocated. /// /// For each virtual file (e.g. foo/bar/baz.cpp), we add all of its parent /// directories (foo/ and foo/bar/) here. SmallVector<DirectoryEntry*, 4> VirtualDirectoryEntries; /// \brief The virtual files that we have allocated. SmallVector<FileEntry*, 4> VirtualFileEntries; /// \brief A cache that maps paths to directory entries (either real or /// virtual) we have looked up /// /// The actual Entries for real directories/files are /// owned by UniqueRealDirs/UniqueRealFiles above, while the Entries /// for virtual directories/files are owned by /// VirtualDirectoryEntries/VirtualFileEntries above. /// llvm::StringMap<DirectoryEntry*, llvm::BumpPtrAllocator> SeenDirEntries; /// \brief A cache that maps paths to file entries (either real or /// virtual) we have looked up. /// /// \see SeenDirEntries llvm::StringMap<FileEntry*, llvm::BumpPtrAllocator> SeenFileEntries; /// \brief The canonical names of directories. llvm::DenseMap<const DirectoryEntry *, llvm::StringRef> CanonicalDirNames; /// \brief Storage for canonical names that we have computed. llvm::BumpPtrAllocator CanonicalNameStorage; /// \brief Each FileEntry we create is assigned a unique ID #. /// unsigned NextFileUID; // Statistics. unsigned NumDirLookups, NumFileLookups; unsigned NumDirCacheMisses, NumFileCacheMisses; // Caching. std::unique_ptr<FileSystemStatCache> StatCache; bool getStatValue(const char *Path, FileData &Data, bool isFile, std::unique_ptr<vfs::File> *F); /// Add all ancestors of the given path (pointing to either a file /// or a directory) as virtual directories. void addAncestorsAsVirtualDirs(StringRef Path); public: FileManager(const FileSystemOptions &FileSystemOpts, IntrusiveRefCntPtr<vfs::FileSystem> FS = nullptr); ~FileManager(); /// \brief Installs the provided FileSystemStatCache object within /// the FileManager. /// /// Ownership of this object is transferred to the FileManager. /// /// \param statCache the new stat cache to install. Ownership of this /// object is transferred to the FileManager. /// /// \param AtBeginning whether this new stat cache must be installed at the /// beginning of the chain of stat caches. Otherwise, it will be added to /// the end of the chain. void addStatCache(std::unique_ptr<FileSystemStatCache> statCache, bool AtBeginning = false); /// \brief Removes the specified FileSystemStatCache object from the manager. void removeStatCache(FileSystemStatCache *statCache); /// \brief Removes all FileSystemStatCache objects from the manager. void clearStatCaches(); /// \brief Lookup, cache, and verify the specified directory (real or /// virtual). /// /// This returns NULL if the directory doesn't exist. /// /// \param CacheFailure If true and the file does not exist, we'll cache /// the failure to find this file. const DirectoryEntry *getDirectory(StringRef DirName, bool CacheFailure = true); /// \brief Lookup, cache, and verify the specified file (real or /// virtual). /// /// This returns NULL if the file doesn't exist. /// /// \param OpenFile if true and the file exists, it will be opened. /// /// \param CacheFailure If true and the file does not exist, we'll cache /// the failure to find this file. const FileEntry *getFile(StringRef Filename, bool OpenFile = false, bool CacheFailure = true); /// \brief Returns the current file system options const FileSystemOptions &getFileSystemOptions() { return FileSystemOpts; } IntrusiveRefCntPtr<vfs::FileSystem> getVirtualFileSystem() const { return FS; } /// \brief Retrieve a file entry for a "virtual" file that acts as /// if there were a file with the given name on disk. /// /// The file itself is not accessed. const FileEntry *getVirtualFile(StringRef Filename, off_t Size, time_t ModificationTime); /// \brief Open the specified file as a MemoryBuffer, returning a new /// MemoryBuffer if successful, otherwise returning null. llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBufferForFile(const FileEntry *Entry, bool isVolatile = false, bool ShouldCloseOpenFile = true); llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBufferForFile(StringRef Filename); /// \brief Get the 'stat' information for the given \p Path. /// /// If the path is relative, it will be resolved against the WorkingDir of the /// FileManager's FileSystemOptions. /// /// \returns false on success, true on error. bool getNoncachedStatValue(StringRef Path, vfs::Status &Result); /// \brief Remove the real file \p Entry from the cache. void invalidateCache(const FileEntry *Entry); /// \brief If path is not absolute and FileSystemOptions set the working /// directory, the path is modified to be relative to the given /// working directory. void FixupRelativePath(SmallVectorImpl<char> &path) const; /// \brief Produce an array mapping from the unique IDs assigned to each /// file to the corresponding FileEntry pointer. void GetUniqueIDMapping( SmallVectorImpl<const FileEntry *> &UIDToFiles) const; /// \brief Modifies the size and modification time of a previously created /// FileEntry. Use with caution. static void modifyFileEntry(FileEntry *File, off_t Size, time_t ModificationTime); /// \brief Remove any './' components from a path. static bool removeDotPaths(SmallVectorImpl<char> &Path); /// \brief Retrieve the canonical name for a given directory. /// /// This is a very expensive operation, despite its results being cached, /// and should only be used when the physical layout of the file system is /// required, which is (almost) never. StringRef getCanonicalName(const DirectoryEntry *Dir); void PrintStats() const; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/DiagnosticIDs.h
//===--- DiagnosticIDs.h - Diagnostic IDs Handling --------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines the Diagnostic IDs-related interfaces. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_DIAGNOSTICIDS_H #define LLVM_CLANG_BASIC_DIAGNOSTICIDS_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringRef.h" namespace clang { class DiagnosticsEngine; class SourceLocation; // Import the diagnostic enums themselves. namespace diag { // Start position for diagnostics. enum { DIAG_START_COMMON = 0, DIAG_START_DRIVER = DIAG_START_COMMON + 300, DIAG_START_FRONTEND = DIAG_START_DRIVER + 100, DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + 100, DIAG_START_LEX = DIAG_START_SERIALIZATION + 120, DIAG_START_PARSE = DIAG_START_LEX + 300, DIAG_START_AST = DIAG_START_PARSE + 500, DIAG_START_COMMENT = DIAG_START_AST + 110, DIAG_START_SEMA = DIAG_START_COMMENT + 100, // HLSL Change: SEMA group length increased from 3000. DIAG_START_ANALYSIS = DIAG_START_SEMA + 3100, DIAG_UPPER_LIMIT = DIAG_START_ANALYSIS + 100 }; class CustomDiagInfo; /// \brief All of the diagnostics that can be emitted by the frontend. typedef unsigned kind; // Get typedefs for common diagnostics. enum { #define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, CATEGORY, \ NOWERROR, SHOWINSYSHEADER) \ ENUM, #define COMMONSTART #include "clang/Basic/DiagnosticCommonKinds.inc" NUM_BUILTIN_COMMON_DIAGNOSTICS #undef DIAG }; /// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs /// to either Ignore (nothing), Remark (emit a remark), Warning /// (emit a warning) or Error (emit as an error). It allows clients to /// map ERRORs to Error or Fatal (stop emitting diagnostics after this one). enum class Severity { // NOTE: 0 means "uncomputed". Ignored = 1, ///< Do not present this diagnostic, ignore it. Remark = 2, ///< Present this diagnostic as a remark. Warning = 3, ///< Present this diagnostic as a warning. Error = 4, ///< Present this diagnostic as an error. Fatal = 5 ///< Present this diagnostic as a fatal error. }; /// Flavors of diagnostics we can emit. Used to filter for a particular /// kind of diagnostic (for instance, for -W/-R flags). enum class Flavor { WarningOrError, ///< A diagnostic that indicates a problem or potential ///< problem. Can be made fatal by -Werror. Remark ///< A diagnostic that indicates normal progress through ///< compilation. }; } class DiagnosticMapping { unsigned Severity : 3; unsigned IsUser : 1; unsigned IsPragma : 1; unsigned HasNoWarningAsError : 1; unsigned HasNoErrorAsFatal : 1; public: static DiagnosticMapping Make(diag::Severity Severity, bool IsUser, bool IsPragma) { DiagnosticMapping Result; Result.Severity = (unsigned)Severity; Result.IsUser = IsUser; Result.IsPragma = IsPragma; Result.HasNoWarningAsError = 0; Result.HasNoErrorAsFatal = 0; return Result; } diag::Severity getSeverity() const { return (diag::Severity)Severity; } void setSeverity(diag::Severity Value) { Severity = (unsigned)Value; } bool isUser() const { return IsUser; } bool isPragma() const { return IsPragma; } bool hasNoWarningAsError() const { return HasNoWarningAsError; } void setNoWarningAsError(bool Value) { HasNoWarningAsError = Value; } bool hasNoErrorAsFatal() const { return HasNoErrorAsFatal; } void setNoErrorAsFatal(bool Value) { HasNoErrorAsFatal = Value; } }; /// \brief Used for handling and querying diagnostic IDs. /// /// Can be used and shared by multiple Diagnostics for multiple translation units. class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> { public: /// \brief The level of the diagnostic, after it has been through mapping. enum Level { Ignored, Note, Remark, Warning, Error, Fatal }; private: /// \brief Information for uniquing and looking up custom diags. diag::CustomDiagInfo *CustomDiagInfo; public: DiagnosticIDs(); ~DiagnosticIDs(); /// \brief Return an ID for a diagnostic with the specified format string and /// level. /// /// If this is the first request for this diagnostic, it is registered and /// created, otherwise the existing ID is returned. // FIXME: Replace this function with a create-only facilty like // createCustomDiagIDFromFormatString() to enforce safe usage. At the time of // writing, nearly all callers of this function were invalid. unsigned getCustomDiagID(Level L, StringRef FormatString); //===--------------------------------------------------------------------===// // Diagnostic classification and reporting interfaces. // /// \brief Given a diagnostic ID, return a description of the issue. StringRef getDescription(unsigned DiagID) const; /// \brief Return true if the unmapped diagnostic levelof the specified /// diagnostic ID is a Warning or Extension. /// /// This only works on builtin diagnostics, not custom ones, and is not /// legal to call on NOTEs. static bool isBuiltinWarningOrExtension(unsigned DiagID); /// \brief Return true if the specified diagnostic is mapped to errors by /// default. static bool isDefaultMappingAsError(unsigned DiagID); /// \brief Determine whether the given built-in diagnostic ID is a Note. static bool isBuiltinNote(unsigned DiagID); /// \brief Determine whether the given built-in diagnostic ID is for an /// extension of some sort. static bool isBuiltinExtensionDiag(unsigned DiagID) { bool ignored; return isBuiltinExtensionDiag(DiagID, ignored); } /// \brief Determine whether the given built-in diagnostic ID is for an /// extension of some sort, and whether it is enabled by default. /// /// This also returns EnabledByDefault, which is set to indicate whether the /// diagnostic is ignored by default (in which case -pedantic enables it) or /// treated as a warning/error by default. /// static bool isBuiltinExtensionDiag(unsigned DiagID, bool &EnabledByDefault); /// \brief Return the lowest-level warning option that enables the specified /// diagnostic. /// /// If there is no -Wfoo flag that controls the diagnostic, this returns null. static StringRef getWarningOptionForDiag(unsigned DiagID); /// \brief Return the category number that a specified \p DiagID belongs to, /// or 0 if no category. static unsigned getCategoryNumberForDiag(unsigned DiagID); /// \brief Return the number of diagnostic categories. static unsigned getNumberOfCategories(); /// \brief Given a category ID, return the name of the category. static StringRef getCategoryNameFromID(unsigned CategoryID); /// \brief Return true if a given diagnostic falls into an ARC diagnostic /// category. static bool isARCDiagnostic(unsigned DiagID); /// \brief Enumeration describing how the emission of a diagnostic should /// be treated when it occurs during C++ template argument deduction. enum SFINAEResponse { /// \brief The diagnostic should not be reported, but it should cause /// template argument deduction to fail. /// /// The vast majority of errors that occur during template argument /// deduction fall into this category. SFINAE_SubstitutionFailure, /// \brief The diagnostic should be suppressed entirely. /// /// Warnings generally fall into this category. SFINAE_Suppress, /// \brief The diagnostic should be reported. /// /// The diagnostic should be reported. Various fatal errors (e.g., /// template instantiation depth exceeded) fall into this category. SFINAE_Report, /// \brief The diagnostic is an access-control diagnostic, which will be /// substitution failures in some contexts and reported in others. SFINAE_AccessControl }; /// \brief Determines whether the given built-in diagnostic ID is /// for an error that is suppressed if it occurs during C++ template /// argument deduction. /// /// When an error is suppressed due to SFINAE, the template argument /// deduction fails but no diagnostic is emitted. Certain classes of /// errors, such as those errors that involve C++ access control, /// are not SFINAE errors. static SFINAEResponse getDiagnosticSFINAEResponse(unsigned DiagID); /// \brief Get the set of all diagnostic IDs in the group with the given name. /// /// \param[out] Diags - On return, the diagnostics in the group. /// \returns \c true if the given group is unknown, \c false otherwise. bool getDiagnosticsInGroup(diag::Flavor Flavor, StringRef Group, SmallVectorImpl<diag::kind> &Diags) const; /// \brief Get the set of all diagnostic IDs. void getAllDiagnostics(diag::Flavor Flavor, SmallVectorImpl<diag::kind> &Diags) const; /// \brief Get the diagnostic option with the closest edit distance to the /// given group name. static StringRef getNearestOption(diag::Flavor Flavor, StringRef Group); private: /// \brief Classify the specified diagnostic ID into a Level, consumable by /// the DiagnosticClient. /// /// The classification is based on the way the client configured the /// DiagnosticsEngine object. /// /// \param Loc The source location for which we are interested in finding out /// the diagnostic state. Can be null in order to query the latest state. DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, const DiagnosticsEngine &Diag) const LLVM_READONLY; diag::Severity getDiagnosticSeverity(unsigned DiagID, SourceLocation Loc, const DiagnosticsEngine &Diag) const LLVM_READONLY; /// \brief Used to report a diagnostic that is finally fully formed. /// /// \returns \c true if the diagnostic was emitted, \c false if it was /// suppressed. bool ProcessDiag(DiagnosticsEngine &Diag) const; /// \brief Used to emit a diagnostic that is finally fully formed, /// ignoring suppression. void EmitDiag(DiagnosticsEngine &Diag, Level DiagLevel) const; /// \brief Whether the diagnostic may leave the AST in a state where some /// invariants can break. bool isUnrecoverable(unsigned DiagID) const; friend class DiagnosticsEngine; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsSystemZ.def
//===-- BuiltinsSystemZ.def - SystemZ Builtin function database -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the SystemZ-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// // Transactional-memory intrinsics BUILTIN(__builtin_tbegin, "iv*", "j") BUILTIN(__builtin_tbegin_nofloat, "iv*", "j") BUILTIN(__builtin_tbeginc, "v", "nj") BUILTIN(__builtin_tabort, "vi", "r") BUILTIN(__builtin_tend, "i", "n") BUILTIN(__builtin_tx_nesting_depth, "i", "nc") BUILTIN(__builtin_tx_assist, "vi", "n") BUILTIN(__builtin_non_tx_store, "vULi*ULi", "") // Vector intrinsics. // These all map directly to z instructions, except that some variants ending // in "s" have a final "int *" that receives the post-instruction CC value. // Vector support instructions (chapter 21 of the PoP) BUILTIN(__builtin_s390_lcbb, "UivC*Ii", "nc") BUILTIN(__builtin_s390_vlbb, "V16ScvC*Ii", "") BUILTIN(__builtin_s390_vll, "V16ScUivC*", "") BUILTIN(__builtin_s390_vstl, "vV16ScUiv*", "") BUILTIN(__builtin_s390_vperm, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vpdi, "V2ULLiV2ULLiV2ULLiIi", "nc") BUILTIN(__builtin_s390_vpksh, "V16ScV8SsV8Ss", "nc") BUILTIN(__builtin_s390_vpkshs, "V16ScV8SsV8Ssi*", "nc") BUILTIN(__builtin_s390_vpksf, "V8SsV4SiV4Si", "nc") BUILTIN(__builtin_s390_vpksfs, "V8SsV4SiV4Sii*", "nc") BUILTIN(__builtin_s390_vpksg, "V4SiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_s390_vpksgs, "V4SiV2SLLiV2SLLii*", "nc") BUILTIN(__builtin_s390_vpklsh, "V16UcV8UsV8Us", "nc") BUILTIN(__builtin_s390_vpklshs, "V16UcV8UsV8Usi*", "nc") BUILTIN(__builtin_s390_vpklsf, "V8UsV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vpklsfs, "V8UsV4UiV4Uii*", "nc") BUILTIN(__builtin_s390_vpklsg, "V4UiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vpklsgs, "V4UiV2ULLiV2ULLii*", "nc") BUILTIN(__builtin_s390_vuphb, "V8SsV16Sc", "nc") BUILTIN(__builtin_s390_vuphh, "V4SiV8Ss", "nc") BUILTIN(__builtin_s390_vuphf, "V2SLLiV4Si", "nc") BUILTIN(__builtin_s390_vuplb, "V8SsV16Sc", "nc") BUILTIN(__builtin_s390_vuplhw, "V4SiV8Ss", "nc") BUILTIN(__builtin_s390_vuplf, "V2SLLiV4Si", "nc") BUILTIN(__builtin_s390_vuplhb, "V8UsV16Uc", "nc") BUILTIN(__builtin_s390_vuplhh, "V4UiV8Us", "nc") BUILTIN(__builtin_s390_vuplhf, "V2ULLiV4Ui", "nc") BUILTIN(__builtin_s390_vupllb, "V8UsV16Uc", "nc") BUILTIN(__builtin_s390_vupllh, "V4UiV8Us", "nc") BUILTIN(__builtin_s390_vupllf, "V2ULLiV4Ui", "nc") // Vector integer instructions (chapter 22 of the PoP) BUILTIN(__builtin_s390_vaq, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vacq, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vaccb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vacch, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vaccf, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vaccg, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vaccq, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vacccq, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vavgb, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_s390_vavgh, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_s390_vavgf, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_s390_vavgg, "V2SLLiV2SLLiV2SLLi", "nc") BUILTIN(__builtin_s390_vavglb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vavglh, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vavglf, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vavglg, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vceqbs, "V16ScV16ScV16Sci*", "nc") BUILTIN(__builtin_s390_vceqhs, "V8SsV8SsV8Ssi*", "nc") BUILTIN(__builtin_s390_vceqfs, "V4SiV4SiV4Sii*", "nc") BUILTIN(__builtin_s390_vceqgs, "V2SLLiV2SLLiV2SLLii*", "nc") BUILTIN(__builtin_s390_vchbs, "V16ScV16ScV16Sci*", "nc") BUILTIN(__builtin_s390_vchhs, "V8SsV8SsV8Ssi*", "nc") BUILTIN(__builtin_s390_vchfs, "V4SiV4SiV4Sii*", "nc") BUILTIN(__builtin_s390_vchgs, "V2SLLiV2SLLiV2SLLii*", "nc") BUILTIN(__builtin_s390_vchlbs, "V16ScV16UcV16Uci*", "nc") BUILTIN(__builtin_s390_vchlhs, "V8SsV8UsV8Usi*", "nc") BUILTIN(__builtin_s390_vchlfs, "V4SiV4UiV4Uii*", "nc") BUILTIN(__builtin_s390_vchlgs, "V2SLLiV2ULLiV2ULLii*", "nc") BUILTIN(__builtin_s390_vcksm, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vclzb, "V16UcV16Uc", "nc") BUILTIN(__builtin_s390_vclzh, "V8UsV8Us", "nc") BUILTIN(__builtin_s390_vclzf, "V4UiV4Ui", "nc") BUILTIN(__builtin_s390_vclzg, "V2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vctzb, "V16UcV16Uc", "nc") BUILTIN(__builtin_s390_vctzh, "V8UsV8Us", "nc") BUILTIN(__builtin_s390_vctzf, "V4UiV4Ui", "nc") BUILTIN(__builtin_s390_vctzg, "V2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_verimb, "V16UcV16UcV16UcV16UcIi", "nc") BUILTIN(__builtin_s390_verimh, "V8UsV8UsV8UsV8UsIi", "nc") BUILTIN(__builtin_s390_verimf, "V4UiV4UiV4UiV4UiIi", "nc") BUILTIN(__builtin_s390_verimg, "V2ULLiV2ULLiV2ULLiV2ULLiIi", "nc") BUILTIN(__builtin_s390_verllb, "V16UcV16UcUi", "nc") BUILTIN(__builtin_s390_verllh, "V8UsV8UsUi", "nc") BUILTIN(__builtin_s390_verllf, "V4UiV4UiUi", "nc") BUILTIN(__builtin_s390_verllg, "V2ULLiV2ULLiUi", "nc") BUILTIN(__builtin_s390_verllvb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_verllvh, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_verllvf, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_verllvg, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vgfmb, "V8UsV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vgfmh, "V4UiV8UsV8Us", "nc") BUILTIN(__builtin_s390_vgfmf, "V2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vgfmg, "V16UcV2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vgfmab, "V8UsV16UcV16UcV8Us", "nc") BUILTIN(__builtin_s390_vgfmah, "V4UiV8UsV8UsV4Ui", "nc") BUILTIN(__builtin_s390_vgfmaf, "V2ULLiV4UiV4UiV2ULLi", "nc") BUILTIN(__builtin_s390_vgfmag, "V16UcV2ULLiV2ULLiV16Uc", "nc") BUILTIN(__builtin_s390_vmahb, "V16ScV16ScV16ScV16Sc", "nc") BUILTIN(__builtin_s390_vmahh, "V8SsV8SsV8SsV8Ss", "nc") BUILTIN(__builtin_s390_vmahf, "V4SiV4SiV4SiV4Si", "nc") BUILTIN(__builtin_s390_vmalhb, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vmalhh, "V8UsV8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vmalhf, "V4UiV4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vmaeb, "V8SsV16ScV16ScV8Ss", "nc") BUILTIN(__builtin_s390_vmaeh, "V4SiV8SsV8SsV4Si", "nc") BUILTIN(__builtin_s390_vmaef, "V2SLLiV4SiV4SiV2SLLi", "nc") BUILTIN(__builtin_s390_vmaleb, "V8UsV16UcV16UcV8Us", "nc") BUILTIN(__builtin_s390_vmaleh, "V4UiV8UsV8UsV4Ui", "nc") BUILTIN(__builtin_s390_vmalef, "V2ULLiV4UiV4UiV2ULLi", "nc") BUILTIN(__builtin_s390_vmaob, "V8SsV16ScV16ScV8Ss", "nc") BUILTIN(__builtin_s390_vmaoh, "V4SiV8SsV8SsV4Si", "nc") BUILTIN(__builtin_s390_vmaof, "V2SLLiV4SiV4SiV2SLLi", "nc") BUILTIN(__builtin_s390_vmalob, "V8UsV16UcV16UcV8Us", "nc") BUILTIN(__builtin_s390_vmaloh, "V4UiV8UsV8UsV4Ui", "nc") BUILTIN(__builtin_s390_vmalof, "V2ULLiV4UiV4UiV2ULLi", "nc") BUILTIN(__builtin_s390_vmhb, "V16ScV16ScV16Sc", "nc") BUILTIN(__builtin_s390_vmhh, "V8SsV8SsV8Ss", "nc") BUILTIN(__builtin_s390_vmhf, "V4SiV4SiV4Si", "nc") BUILTIN(__builtin_s390_vmlhb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vmlhh, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vmlhf, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vmeb, "V8SsV16ScV16Sc", "nc") BUILTIN(__builtin_s390_vmeh, "V4SiV8SsV8Ss", "nc") BUILTIN(__builtin_s390_vmef, "V2SLLiV4SiV4Si", "nc") BUILTIN(__builtin_s390_vmleb, "V8UsV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vmleh, "V4UiV8UsV8Us", "nc") BUILTIN(__builtin_s390_vmlef, "V2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vmob, "V8SsV16ScV16Sc", "nc") BUILTIN(__builtin_s390_vmoh, "V4SiV8SsV8Ss", "nc") BUILTIN(__builtin_s390_vmof, "V2SLLiV4SiV4Si", "nc") BUILTIN(__builtin_s390_vmlob, "V8UsV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vmloh, "V4UiV8UsV8Us", "nc") BUILTIN(__builtin_s390_vmlof, "V2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vpopctb, "V16UcV16Uc", "nc") BUILTIN(__builtin_s390_vpopcth, "V8UsV8Us", "nc") BUILTIN(__builtin_s390_vpopctf, "V4UiV4Ui", "nc") BUILTIN(__builtin_s390_vpopctg, "V2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vsq, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsbcbiq, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsbiq, "V16UcV16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vscbib, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vscbih, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vscbif, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vscbig, "V2ULLiV2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vscbiq, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsl, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vslb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsldb, "V16UcV16UcV16UcIi", "nc") BUILTIN(__builtin_s390_vsra, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsrab, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsrl, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsrlb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsumb, "V4UiV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vsumh, "V4UiV8UsV8Us", "nc") BUILTIN(__builtin_s390_vsumgh, "V2ULLiV8UsV8Us", "nc") BUILTIN(__builtin_s390_vsumgf, "V2ULLiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vsumqf, "V16UcV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vsumqg, "V16UcV2ULLiV2ULLi", "nc") BUILTIN(__builtin_s390_vtm, "iV16UcV16Uc", "nc") // Vector string instructions (chapter 23 of the PoP) BUILTIN(__builtin_s390_vfaeb, "V16UcV16UcV16UcIi", "nc") BUILTIN(__builtin_s390_vfaebs, "V16UcV16UcV16UcIii*", "nc") BUILTIN(__builtin_s390_vfaeh, "V8UsV8UsV8UsIi", "nc") BUILTIN(__builtin_s390_vfaehs, "V8UsV8UsV8UsIii*", "nc") BUILTIN(__builtin_s390_vfaef, "V4UiV4UiV4UiIi", "nc") BUILTIN(__builtin_s390_vfaefs, "V4UiV4UiV4UiIii*", "nc") BUILTIN(__builtin_s390_vfaezb, "V16UcV16UcV16UcIi", "nc") BUILTIN(__builtin_s390_vfaezbs, "V16UcV16UcV16UcIii*", "nc") BUILTIN(__builtin_s390_vfaezh, "V8UsV8UsV8UsIi", "nc") BUILTIN(__builtin_s390_vfaezhs, "V8UsV8UsV8UsIii*", "nc") BUILTIN(__builtin_s390_vfaezf, "V4UiV4UiV4UiIi", "nc") BUILTIN(__builtin_s390_vfaezfs, "V4UiV4UiV4UiIii*", "nc") BUILTIN(__builtin_s390_vfeeb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vfeebs, "V16UcV16UcV16Uci*", "nc") BUILTIN(__builtin_s390_vfeeh, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vfeehs, "V8UsV8UsV8Usi*", "nc") BUILTIN(__builtin_s390_vfeef, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vfeefs, "V4UiV4UiV4Uii*", "nc") BUILTIN(__builtin_s390_vfeezb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vfeezbs, "V16UcV16UcV16Uci*", "nc") BUILTIN(__builtin_s390_vfeezh, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vfeezhs, "V8UsV8UsV8Usi*", "nc") BUILTIN(__builtin_s390_vfeezf, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vfeezfs, "V4UiV4UiV4Uii*", "nc") BUILTIN(__builtin_s390_vfeneb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vfenebs, "V16UcV16UcV16Uci*", "nc") BUILTIN(__builtin_s390_vfeneh, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vfenehs, "V8UsV8UsV8Usi*", "nc") BUILTIN(__builtin_s390_vfenef, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vfenefs, "V4UiV4UiV4Uii*", "nc") BUILTIN(__builtin_s390_vfenezb, "V16UcV16UcV16Uc", "nc") BUILTIN(__builtin_s390_vfenezbs, "V16UcV16UcV16Uci*", "nc") BUILTIN(__builtin_s390_vfenezh, "V8UsV8UsV8Us", "nc") BUILTIN(__builtin_s390_vfenezhs, "V8UsV8UsV8Usi*", "nc") BUILTIN(__builtin_s390_vfenezf, "V4UiV4UiV4Ui", "nc") BUILTIN(__builtin_s390_vfenezfs, "V4UiV4UiV4Uii*", "nc") BUILTIN(__builtin_s390_vistrb, "V16UcV16Uc", "nc") BUILTIN(__builtin_s390_vistrbs, "V16UcV16Uci*", "nc") BUILTIN(__builtin_s390_vistrh, "V8UsV8Us", "nc") BUILTIN(__builtin_s390_vistrhs, "V8UsV8Usi*", "nc") BUILTIN(__builtin_s390_vistrf, "V4UiV4Ui", "nc") BUILTIN(__builtin_s390_vistrfs, "V4UiV4Uii*", "nc") BUILTIN(__builtin_s390_vstrcb, "V16UcV16UcV16UcV16UcIi", "nc") BUILTIN(__builtin_s390_vstrcbs, "V16UcV16UcV16UcV16UcIii*", "nc") BUILTIN(__builtin_s390_vstrch, "V8UsV8UsV8UsV8UsIi", "nc") BUILTIN(__builtin_s390_vstrchs, "V8UsV8UsV8UsV8UsIii*", "nc") BUILTIN(__builtin_s390_vstrcf, "V4UiV4UiV4UiV4UiIi", "nc") BUILTIN(__builtin_s390_vstrcfs, "V4UiV4UiV4UiV4UiIii*", "nc") BUILTIN(__builtin_s390_vstrczb, "V16UcV16UcV16UcV16UcIi", "nc") BUILTIN(__builtin_s390_vstrczbs, "V16UcV16UcV16UcV16UcIii*", "nc") BUILTIN(__builtin_s390_vstrczh, "V8UsV8UsV8UsV8UsIi", "nc") BUILTIN(__builtin_s390_vstrczhs, "V8UsV8UsV8UsV8UsIii*", "nc") BUILTIN(__builtin_s390_vstrczf, "V4UiV4UiV4UiV4UiIi", "nc") BUILTIN(__builtin_s390_vstrczfs, "V4UiV4UiV4UiV4UiIii*", "nc") // Vector floating-point instructions (chapter 24 of the PoP) BUILTIN(__builtin_s390_vfcedbs, "V2SLLiV2dV2di*", "nc") BUILTIN(__builtin_s390_vfchdbs, "V2SLLiV2dV2di*", "nc") BUILTIN(__builtin_s390_vfchedbs, "V2SLLiV2dV2di*", "nc") BUILTIN(__builtin_s390_vfidb, "V2dV2dIiIi", "nc") BUILTIN(__builtin_s390_vflndb, "V2dV2d", "nc") BUILTIN(__builtin_s390_vflpdb, "V2dV2d", "nc") BUILTIN(__builtin_s390_vfmadb, "V2dV2dV2dV2d", "nc") BUILTIN(__builtin_s390_vfmsdb, "V2dV2dV2dV2d", "nc") BUILTIN(__builtin_s390_vfsqdb, "V2dV2d", "nc") BUILTIN(__builtin_s390_vftcidb, "V2SLLiV2dIii*", "nc") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/VirtualFileSystem.h
//===- VirtualFileSystem.h - Virtual File System Layer ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// \file /// \brief Defines the virtual file system interface vfs::FileSystem. //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_VIRTUALFILESYSTEM_H #define LLVM_CLANG_BASIC_VIRTUALFILESYSTEM_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" namespace llvm { class MemoryBuffer; } namespace clang { namespace vfs { /// \brief The result of a \p status operation. class Status { std::string Name; llvm::sys::fs::UniqueID UID; llvm::sys::TimeValue MTime; uint32_t User; uint32_t Group; uint64_t Size; llvm::sys::fs::file_type Type; llvm::sys::fs::perms Perms; public: bool IsVFSMapped; // FIXME: remove when files support multiple names public: Status() : Type(llvm::sys::fs::file_type::status_error) {} Status(const llvm::sys::fs::file_status &Status); Status(StringRef Name, StringRef RealName, llvm::sys::fs::UniqueID UID, llvm::sys::TimeValue MTime, uint32_t User, uint32_t Group, uint64_t Size, llvm::sys::fs::file_type Type, llvm::sys::fs::perms Perms); /// \brief Returns the name that should be used for this file or directory. StringRef getName() const { return Name; } void setName(StringRef N) { Name = N; } /// @name Status interface from llvm::sys::fs /// @{ llvm::sys::fs::file_type getType() const { return Type; } llvm::sys::fs::perms getPermissions() const { return Perms; } llvm::sys::TimeValue getLastModificationTime() const { return MTime; } llvm::sys::fs::UniqueID getUniqueID() const { return UID; } uint32_t getUser() const { return User; } uint32_t getGroup() const { return Group; } uint64_t getSize() const { return Size; } void setType(llvm::sys::fs::file_type v) { Type = v; } void setPermissions(llvm::sys::fs::perms p) { Perms = p; } /// @} /// @name Status queries /// These are static queries in llvm::sys::fs. /// @{ bool equivalent(const Status &Other) const; bool isDirectory() const; bool isRegularFile() const; bool isOther() const; bool isSymlink() const; bool isStatusKnown() const; bool exists() const; /// @} }; /// \brief Represents an open file. class File { public: /// \brief Destroy the file after closing it (if open). /// Sub-classes should generally call close() inside their destructors. We /// cannot do that from the base class, since close is virtual. virtual ~File(); /// \brief Get the status of the file. virtual llvm::ErrorOr<Status> status() = 0; /// \brief Get the contents of the file as a \p MemoryBuffer. virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBuffer(const Twine &Name, int64_t FileSize = -1, bool RequiresNullTerminator = true, bool IsVolatile = false) = 0; /// \brief Closes the file. virtual std::error_code close() = 0; /// \brief Sets the name to use for this file. virtual void setName(StringRef Name) = 0; }; namespace detail { /// \brief An interface for virtual file systems to provide an iterator over the /// (non-recursive) contents of a directory. struct DirIterImpl { virtual ~DirIterImpl(); /// \brief Sets \c CurrentEntry to the next entry in the directory on success, /// or returns a system-defined \c error_code. virtual std::error_code increment() = 0; Status CurrentEntry; }; } // end namespace detail /// \brief An input iterator over the entries in a virtual path, similar to /// llvm::sys::fs::directory_iterator. class directory_iterator { std::shared_ptr<detail::DirIterImpl> Impl; // Input iterator semantics on copy public: directory_iterator(std::shared_ptr<detail::DirIterImpl> I) : Impl(I) { assert(Impl.get() != nullptr && "requires non-null implementation"); if (!Impl->CurrentEntry.isStatusKnown()) Impl.reset(); // Normalize the end iterator to Impl == nullptr. } /// \brief Construct an 'end' iterator. directory_iterator() { } /// \brief Equivalent to operator++, with an error code. directory_iterator &increment(std::error_code &EC) { assert(Impl && "attempting to increment past end"); EC = Impl->increment(); if (EC || !Impl->CurrentEntry.isStatusKnown()) Impl.reset(); // Normalize the end iterator to Impl == nullptr. return *this; } const Status &operator*() const { return Impl->CurrentEntry; } const Status *operator->() const { return &Impl->CurrentEntry; } bool operator==(const directory_iterator &RHS) const { if (Impl && RHS.Impl) return Impl->CurrentEntry.equivalent(RHS.Impl->CurrentEntry); return !Impl && !RHS.Impl; } bool operator!=(const directory_iterator &RHS) const { return !(*this == RHS); } }; class FileSystem; /// \brief An input iterator over the recursive contents of a virtual path, /// similar to llvm::sys::fs::recursive_directory_iterator. class recursive_directory_iterator { typedef std::stack<directory_iterator, std::vector<directory_iterator>> IterState; FileSystem *FS; std::shared_ptr<IterState> State; // Input iterator semantics on copy. public: recursive_directory_iterator(FileSystem &FS, const Twine &Path, std::error_code &EC); /// \brief Construct an 'end' iterator. recursive_directory_iterator() { } /// \brief Equivalent to operator++, with an error code. recursive_directory_iterator &increment(std::error_code &EC); const Status &operator*() const { return *State->top(); } const Status *operator->() const { return &*State->top(); } bool operator==(const recursive_directory_iterator &Other) const { return State == Other.State; // identity } bool operator!=(const recursive_directory_iterator &RHS) const { return !(*this == RHS); } }; /// \brief The virtual file system interface. class FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem> { public: virtual ~FileSystem(); /// \brief Get the status of the entry at \p Path, if one exists. virtual llvm::ErrorOr<Status> status(const Twine &Path) = 0; /// \brief Get a \p File object for the file at \p Path, if one exists. virtual llvm::ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path) = 0; /// This is a convenience method that opens a file, gets its content and then /// closes the file. llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBufferForFile(const Twine &Name, int64_t FileSize = -1, bool RequiresNullTerminator = true, bool IsVolatile = false); /// \brief Get a directory_iterator for \p Dir. /// \note The 'end' iterator is directory_iterator(). virtual directory_iterator dir_begin(const Twine &Dir, std::error_code &EC) = 0; }; /// \brief Gets an \p vfs::FileSystem for the 'real' file system, as seen by /// the operating system. IntrusiveRefCntPtr<FileSystem> getRealFileSystem(); /// \brief A file system that allows overlaying one \p AbstractFileSystem on top /// of another. /// /// Consists of a stack of >=1 \p FileSystem objects, which are treated as being /// one merged file system. When there is a directory that exists in more than /// one file system, the \p OverlayFileSystem contains a directory containing /// the union of their contents. The attributes (permissions, etc.) of the /// top-most (most recently added) directory are used. When there is a file /// that exists in more than one file system, the file in the top-most file /// system overrides the other(s). class OverlayFileSystem : public FileSystem { typedef SmallVector<IntrusiveRefCntPtr<FileSystem>, 1> FileSystemList; /// \brief The stack of file systems, implemented as a list in order of /// their addition. FileSystemList FSList; public: OverlayFileSystem(IntrusiveRefCntPtr<FileSystem> Base); /// \brief Pushes a file system on top of the stack. void pushOverlay(IntrusiveRefCntPtr<FileSystem> FS); llvm::ErrorOr<Status> status(const Twine &Path) override; llvm::ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path) override; directory_iterator dir_begin(const Twine &Dir, std::error_code &EC) override; typedef FileSystemList::reverse_iterator iterator; /// \brief Get an iterator pointing to the most recently added file system. iterator overlays_begin() { return FSList.rbegin(); } /// \brief Get an iterator pointing one-past the least recently added file /// system. iterator overlays_end() { return FSList.rend(); } }; /// \brief Get a globally unique ID for a virtual file or directory. llvm::sys::fs::UniqueID getNextVirtualUniqueID(); /// \brief Gets a \p FileSystem for a virtual file system described in YAML /// format. IntrusiveRefCntPtr<FileSystem> getVFSFromYAML(std::unique_ptr<llvm::MemoryBuffer> Buffer, llvm::SourceMgr::DiagHandlerTy DiagHandler, void *DiagContext = nullptr, IntrusiveRefCntPtr<FileSystem> ExternalFS = getRealFileSystem()); struct YAMLVFSEntry { template <typename T1, typename T2> YAMLVFSEntry(T1 &&VPath, T2 &&RPath) : VPath(std::forward<T1>(VPath)), RPath(std::forward<T2>(RPath)) {} std::string VPath; std::string RPath; }; class YAMLVFSWriter { std::vector<YAMLVFSEntry> Mappings; Optional<bool> IsCaseSensitive; public: YAMLVFSWriter() {} void addFileMapping(StringRef VirtualPath, StringRef RealPath); void setCaseSensitivity(bool CaseSensitive) { IsCaseSensitive = CaseSensitive; } void write(llvm::raw_ostream &OS); }; } // end namespace vfs } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Basic/BuiltinsXCore.def
//===--- BuiltinsXCore.def - XCore Builtin function database ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the XCore-specific builtin function database. Users of // this file must define the BUILTIN macro to make use of this information. // //===----------------------------------------------------------------------===// BUILTIN(__builtin_bitrev, "UiUi", "nc") BUILTIN(__builtin_getid, "Si", "nc") BUILTIN(__builtin_getps, "UiUi", "n") BUILTIN(__builtin_setps, "vUiUi", "n") #undef BUILTIN
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Parse/ParseAST.h
//===--- ParseAST.h - Define the ParseAST method ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the clang::ParseAST method. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_PARSE_PARSEAST_H #define LLVM_CLANG_PARSE_PARSEAST_H #include "clang/Basic/LangOptions.h" namespace clang { class Preprocessor; class ASTConsumer; class ASTContext; class CodeCompleteConsumer; class Sema; /// \brief Parse the entire file specified, notifying the ASTConsumer as /// the file is parsed. /// /// This operation inserts the parsed decls into the translation /// unit held by Ctx. /// /// \param TUKind The kind of translation unit being parsed. /// /// \param CompletionConsumer If given, an object to consume code completion /// results. void ParseAST(Preprocessor &pp, ASTConsumer *C, ASTContext &Ctx, bool PrintStats = false, TranslationUnitKind TUKind = TU_Complete, CodeCompleteConsumer *CompletionConsumer = nullptr, bool SkipFunctionBodies = false); /// \brief Parse the main file known to the preprocessor, producing an /// abstract syntax tree. void ParseAST(Sema &S, bool PrintStats = false, bool SkipFunctionBodies = false); } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Parse/ParseDiagnostic.h
//===--- DiagnosticParse.h - Diagnostics for libparse -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_PARSE_PARSEDIAGNOSTIC_H #define LLVM_CLANG_PARSE_PARSEDIAGNOSTIC_H #include "clang/Basic/Diagnostic.h" namespace clang { namespace diag { enum { #define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, #define PARSESTART #include "clang/Basic/DiagnosticParseKinds.inc" #undef DIAG NUM_BUILTIN_PARSE_DIAGNOSTICS }; } // end namespace diag } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Parse/Parser.h
//===--- Parser.h - C Language Parser ---------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the Parser interface. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_PARSE_PARSER_H #define LLVM_CLANG_PARSE_PARSER_H #include "clang/Basic/OpenMPKinds.h" #include "clang/Basic/OperatorPrecedence.h" #include "clang/Basic/Specifiers.h" #include "clang/Lex/CodeCompletionHandler.h" #include "clang/Lex/Preprocessor.h" #include "clang/Sema/DeclSpec.h" #include "clang/Sema/LoopHint.h" #include "clang/Sema/Sema.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/SaveAndRestore.h" #include <memory> #include <stack> #include "llvm/Support/OacrIgnoreCond.h" // HLSL Change - all parser use is heavily language-dependant namespace clang { class PragmaHandler; class Scope; class BalancedDelimiterTracker; class CorrectionCandidateCallback; class DeclGroupRef; class DiagnosticBuilder; class Parser; class ParsingDeclRAIIObject; class ParsingDeclSpec; class ParsingDeclarator; class ParsingFieldDeclarator; class ColonProtectionRAIIObject; class InMessageExpressionRAIIObject; class PoisonSEHIdentifiersRAIIObject; class VersionTuple; class OMPClause; class ObjCTypeParamList; class ObjCTypeParameter; /// Parser - This implements a parser for the C family of languages. After /// parsing units of the grammar, productions are invoked to handle whatever has /// been read. /// class Parser : public CodeCompletionHandler { friend class ColonProtectionRAIIObject; friend class InMessageExpressionRAIIObject; friend class PoisonSEHIdentifiersRAIIObject; friend class ObjCDeclContextSwitch; friend class ParenBraceBracketBalancer; friend class BalancedDelimiterTracker; Preprocessor &PP; /// Tok - The current token we are peeking ahead. All parsing methods assume /// that this is valid. Token Tok; // PrevTokLocation - The location of the token we previously // consumed. This token is used for diagnostics where we expected to // see a token following another token (e.g., the ';' at the end of // a statement). SourceLocation PrevTokLocation; unsigned short ParenCount, BracketCount, BraceCount; /// Actions - These are the callbacks we invoke as we parse various constructs /// in the file. Sema &Actions; DiagnosticsEngine &Diags; /// ScopeCache - Cache scopes to reduce malloc traffic. enum { ScopeCacheSize = 16 }; unsigned NumCachedScopes; Scope *ScopeCache[ScopeCacheSize]; /// Identifiers used for SEH handling in Borland. These are only /// allowed in particular circumstances // __except block IdentifierInfo *Ident__exception_code, *Ident___exception_code, *Ident_GetExceptionCode; // __except filter expression IdentifierInfo *Ident__exception_info, *Ident___exception_info, *Ident_GetExceptionInfo; // __finally IdentifierInfo *Ident__abnormal_termination, *Ident___abnormal_termination, *Ident_AbnormalTermination; /// Contextual keywords for Microsoft extensions. IdentifierInfo *Ident__except; mutable IdentifierInfo *Ident_sealed; /// Ident_super - IdentifierInfo for "super", to support fast /// comparison. IdentifierInfo *Ident_super; /// Ident_vector, Ident_bool - cached IdentifierInfos for "vector" and /// "bool" fast comparison. Only present if AltiVec or ZVector are enabled. IdentifierInfo *Ident_vector; IdentifierInfo *Ident_bool; /// Ident_pixel - cached IdentifierInfos for "pixel" fast comparison. /// Only present if AltiVec enabled. IdentifierInfo *Ident_pixel; /// Objective-C contextual keywords. mutable IdentifierInfo *Ident_instancetype; /// \brief Identifier for "introduced". IdentifierInfo *Ident_introduced; /// \brief Identifier for "deprecated". IdentifierInfo *Ident_deprecated; /// \brief Identifier for "obsoleted". IdentifierInfo *Ident_obsoleted; /// \brief Identifier for "unavailable". IdentifierInfo *Ident_unavailable; /// \brief Identifier for "message". IdentifierInfo *Ident_message; /// C++0x contextual keywords. mutable IdentifierInfo *Ident_final; mutable IdentifierInfo *Ident_override; // C++ type trait keywords that can be reverted to identifiers and still be // used as type traits. llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind> RevertibleTypeTraits; std::unique_ptr<PragmaHandler> AlignHandler; std::unique_ptr<PragmaHandler> GCCVisibilityHandler; std::unique_ptr<PragmaHandler> OptionsHandler; std::unique_ptr<PragmaHandler> PackHandler; std::unique_ptr<PragmaHandler> MSStructHandler; std::unique_ptr<PragmaHandler> UnusedHandler; std::unique_ptr<PragmaHandler> WeakHandler; std::unique_ptr<PragmaHandler> RedefineExtnameHandler; std::unique_ptr<PragmaHandler> FPContractHandler; std::unique_ptr<PragmaHandler> OpenCLExtensionHandler; std::unique_ptr<PragmaHandler> OpenMPHandler; std::unique_ptr<PragmaHandler> MSCommentHandler; std::unique_ptr<PragmaHandler> MSDetectMismatchHandler; std::unique_ptr<PragmaHandler> MSPointersToMembers; std::unique_ptr<PragmaHandler> MSVtorDisp; std::unique_ptr<PragmaHandler> MSInitSeg; std::unique_ptr<PragmaHandler> MSDataSeg; std::unique_ptr<PragmaHandler> MSBSSSeg; std::unique_ptr<PragmaHandler> MSConstSeg; std::unique_ptr<PragmaHandler> MSCodeSeg; std::unique_ptr<PragmaHandler> MSSection; std::unique_ptr<PragmaHandler> OptimizeHandler; std::unique_ptr<PragmaHandler> LoopHintHandler; std::unique_ptr<PragmaHandler> UnrollHintHandler; std::unique_ptr<PragmaHandler> NoUnrollHintHandler; PragmaHandler *pPackMatrixHandler = nullptr; // // HLSL Change -packmatrix std::unique_ptr<CommentHandler> CommentSemaHandler; /// Whether the '>' token acts as an operator or not. This will be /// true except when we are parsing an expression within a C++ /// template argument list, where the '>' closes the template /// argument list. bool GreaterThanIsOperator; /// ColonIsSacred - When this is false, we aggressively try to recover from /// code like "foo : bar" as if it were a typo for "foo :: bar". This is not /// safe in case statements and a few other things. This is managed by the /// ColonProtectionRAIIObject RAII object. bool ColonIsSacred; /// \brief When true, we are directly inside an Objective-C message /// send expression. /// /// This is managed by the \c InMessageExpressionRAIIObject class, and /// should not be set directly. bool InMessageExpression; /// The "depth" of the template parameters currently being parsed. unsigned TemplateParameterDepth; /// \brief RAII class that manages the template parameter depth. class TemplateParameterDepthRAII { unsigned &Depth; unsigned AddedLevels; public: explicit TemplateParameterDepthRAII(unsigned &Depth) : Depth(Depth), AddedLevels(0) {} ~TemplateParameterDepthRAII() { Depth -= AddedLevels; } void operator++() { ++Depth; ++AddedLevels; } void addDepth(unsigned D) { Depth += D; AddedLevels += D; } unsigned getDepth() const { return Depth; } }; /// Factory object for creating AttributeList objects. AttributeFactory AttrFactory; /// \brief Gathers and cleans up TemplateIdAnnotations when parsing of a /// top-level declaration is finished. SmallVector<TemplateIdAnnotation *, 16> TemplateIds; /// \brief Identifiers which have been declared within a tentative parse. SmallVector<IdentifierInfo *, 8> TentativelyDeclaredIdentifiers; IdentifierInfo *getSEHExceptKeyword(); /// True if we are within an Objective-C container while parsing C-like decls. /// /// This is necessary because Sema thinks we have left the container /// to parse the C-like decls, meaning Actions.getObjCDeclContext() will /// be NULL. bool ParsingInObjCContainer; bool SkipFunctionBodies; public: Parser(Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies); ~Parser() override; const LangOptions &getLangOpts() const { return PP.getLangOpts(); } const TargetInfo &getTargetInfo() const { return PP.getTargetInfo(); } Preprocessor &getPreprocessor() const { return PP; } Sema &getActions() const { return Actions; } AttributeFactory &getAttrFactory() { return AttrFactory; } const Token &getCurToken() const { return Tok; } Scope *getCurScope() const { return Actions.getCurScope(); } void incrementMSManglingNumber() const { return Actions.incrementMSManglingNumber(); } Decl *getObjCDeclContext() const { return Actions.getObjCDeclContext(); } // Type forwarding. All of these are statically 'void*', but they may all be // different actual classes based on the actions in place. typedef OpaquePtr<DeclGroupRef> DeclGroupPtrTy; typedef OpaquePtr<TemplateName> TemplateTy; typedef SmallVector<TemplateParameterList *, 4> TemplateParameterLists; typedef Sema::FullExprArg FullExprArg; // Parsing methods. /// Initialize - Warm up the parser. /// void Initialize(); /// ParseTopLevelDecl - Parse one top-level declaration. Returns true if /// the EOF was encountered. bool ParseTopLevelDecl(DeclGroupPtrTy &Result); bool ParseTopLevelDecl() { DeclGroupPtrTy Result; return ParseTopLevelDecl(Result); } /// ConsumeToken - Consume the current 'peek token' and lex the next one. /// This does not work with special tokens: string literals, code completion /// and balanced tokens must be handled using the specific consume methods. /// Returns the location of the consumed token. SourceLocation ConsumeToken() { assert(!isTokenSpecial() && "Should consume special tokens with Consume*Token"); PrevTokLocation = Tok.getLocation(); PP.Lex(Tok); return PrevTokLocation; } bool TryConsumeToken(tok::TokenKind Expected) { if (Tok.isNot(Expected)) return false; assert(!isTokenSpecial() && "Should consume special tokens with Consume*Token"); PrevTokLocation = Tok.getLocation(); PP.Lex(Tok); return true; } bool TryConsumeToken(tok::TokenKind Expected, SourceLocation &Loc) { if (!TryConsumeToken(Expected)) return false; Loc = PrevTokLocation; return true; } /// Retrieve the underscored keyword (_Nonnull, _Nullable) that corresponds /// to the given nullability kind. IdentifierInfo *getNullabilityKeyword(NullabilityKind nullability) { return Actions.getNullabilityKeyword(nullability); } private: //===--------------------------------------------------------------------===// // Low-Level token peeking and consumption methods. // /// isTokenParen - Return true if the cur token is '(' or ')'. bool isTokenParen() const { return Tok.getKind() == tok::l_paren || Tok.getKind() == tok::r_paren; } /// isTokenBracket - Return true if the cur token is '[' or ']'. bool isTokenBracket() const { return Tok.getKind() == tok::l_square || Tok.getKind() == tok::r_square; } /// isTokenBrace - Return true if the cur token is '{' or '}'. bool isTokenBrace() const { return Tok.getKind() == tok::l_brace || Tok.getKind() == tok::r_brace; } /// isTokenStringLiteral - True if this token is a string-literal. bool isTokenStringLiteral() const { return tok::isStringLiteral(Tok.getKind()); } /// isTokenSpecial - True if this token requires special consumption methods. bool isTokenSpecial() const { return isTokenStringLiteral() || isTokenParen() || isTokenBracket() || isTokenBrace() || Tok.is(tok::code_completion); } /// \brief Returns true if the current token is '=' or is a type of '='. /// For typos, give a fixit to '=' bool isTokenEqualOrEqualTypo(); /// \brief Return the current token to the token stream and make the given /// token the current token. void UnconsumeToken(Token &Consumed) { Token Next = Tok; PP.EnterToken(Consumed); PP.Lex(Tok); PP.EnterToken(Next); } /// ConsumeAnyToken - Dispatch to the right Consume* method based on the /// current token type. This should only be used in cases where the type of /// the token really isn't known, e.g. in error recovery. SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok = false) { if (isTokenParen()) return ConsumeParen(); if (isTokenBracket()) return ConsumeBracket(); if (isTokenBrace()) return ConsumeBrace(); if (isTokenStringLiteral()) return ConsumeStringToken(); if (Tok.is(tok::code_completion)) return ConsumeCodeCompletionTok ? ConsumeCodeCompletionToken() : handleUnexpectedCodeCompletionToken(); return ConsumeToken(); } /// ConsumeParen - This consume method keeps the paren count up-to-date. /// SourceLocation ConsumeParen() { assert(isTokenParen() && "wrong consume method"); if (Tok.getKind() == tok::l_paren) ++ParenCount; else if (ParenCount) --ParenCount; // Don't let unbalanced )'s drive the count negative. PrevTokLocation = Tok.getLocation(); PP.Lex(Tok); return PrevTokLocation; } /// ConsumeBracket - This consume method keeps the bracket count up-to-date. /// SourceLocation ConsumeBracket() { assert(isTokenBracket() && "wrong consume method"); if (Tok.getKind() == tok::l_square) ++BracketCount; else if (BracketCount) --BracketCount; // Don't let unbalanced ]'s drive the count negative. PrevTokLocation = Tok.getLocation(); PP.Lex(Tok); return PrevTokLocation; } /// ConsumeBrace - This consume method keeps the brace count up-to-date. /// SourceLocation ConsumeBrace() { assert(isTokenBrace() && "wrong consume method"); if (Tok.getKind() == tok::l_brace) ++BraceCount; else if (BraceCount) --BraceCount; // Don't let unbalanced }'s drive the count negative. PrevTokLocation = Tok.getLocation(); PP.Lex(Tok); return PrevTokLocation; } /// ConsumeStringToken - Consume the current 'peek token', lexing a new one /// and returning the token kind. This method is specific to strings, as it /// handles string literal concatenation, as per C99 5.1.1.2, translation /// phase #6. SourceLocation ConsumeStringToken() { assert(isTokenStringLiteral() && "Should only consume string literals with this method"); PrevTokLocation = Tok.getLocation(); PP.Lex(Tok); return PrevTokLocation; } /// \brief Consume the current code-completion token. /// /// This routine can be called to consume the code-completion token and /// continue processing in special cases where \c cutOffParsing() isn't /// desired, such as token caching or completion with lookahead. SourceLocation ConsumeCodeCompletionToken() { assert(Tok.is(tok::code_completion)); PrevTokLocation = Tok.getLocation(); PP.Lex(Tok); return PrevTokLocation; } ///\ brief When we are consuming a code-completion token without having /// matched specific position in the grammar, provide code-completion results /// based on context. /// /// \returns the source location of the code-completion token. SourceLocation handleUnexpectedCodeCompletionToken(); /// \brief Abruptly cut off parsing; mainly used when we have reached the /// code-completion point. void cutOffParsing() { if (PP.isCodeCompletionEnabled()) PP.setCodeCompletionReached(); // Cut off parsing by acting as if we reached the end-of-file. Tok.setKind(tok::eof); } /// \brief Determine if we're at the end of the file or at a transition /// between modules. bool isEofOrEom() { tok::TokenKind Kind = Tok.getKind(); return Kind == tok::eof || Kind == tok::annot_module_begin || Kind == tok::annot_module_end || Kind == tok::annot_module_include; } /// \brief Initialize all pragma handlers. void initializePragmaHandlers(); /// \brief Destroy and reset all pragma handlers. void resetPragmaHandlers(); /// \brief Handle the annotation token produced for #pragma unused(...) void HandlePragmaUnused(); /// \brief Handle the annotation token produced for /// #pragma GCC visibility... void HandlePragmaVisibility(); /// \brief Handle the annotation token produced for /// #pragma pack... void HandlePragmaPack(); /// \brief Handle the annotation token produced for /// #pragma ms_struct... void HandlePragmaMSStruct(); /// \brief Handle the annotation token produced for /// #pragma comment... void HandlePragmaMSComment(); void HandlePragmaMSPointersToMembers(); void HandlePragmaMSVtorDisp(); void HandlePragmaMSPragma(); bool HandlePragmaMSSection(StringRef PragmaName, SourceLocation PragmaLocation); bool HandlePragmaMSSegment(StringRef PragmaName, SourceLocation PragmaLocation); bool HandlePragmaMSInitSeg(StringRef PragmaName, SourceLocation PragmaLocation); /// \brief Handle the annotation token produced for /// #pragma align... void HandlePragmaAlign(); /// \brief Handle the annotation token produced for /// #pragma weak id... void HandlePragmaWeak(); /// \brief Handle the annotation token produced for /// #pragma weak id = id... void HandlePragmaWeakAlias(); /// \brief Handle the annotation token produced for /// #pragma redefine_extname... void HandlePragmaRedefineExtname(); /// \brief Handle the annotation token produced for /// #pragma STDC FP_CONTRACT... void HandlePragmaFPContract(); /// \brief Handle the annotation token produced for /// #pragma OPENCL EXTENSION... void HandlePragmaOpenCLExtension(); /// \brief Handle the annotation token produced for /// #pragma clang __debug captured StmtResult HandlePragmaCaptured(); /// \brief Handle the annotation token produced for /// #pragma clang loop and #pragma unroll. bool HandlePragmaLoopHint(LoopHint &Hint); // HLSL Change Starts /// \brief Handle the hlsl discard keyword StmtResult HandleHLSLDiscardStmt(Expr *Fn); // HLSL Change Ends /// GetLookAheadToken - This peeks ahead N tokens and returns that token /// without consuming any tokens. LookAhead(0) returns 'Tok', LookAhead(1) /// returns the token after Tok, etc. /// /// Note that this differs from the Preprocessor's LookAhead method, because /// the Parser always has one token lexed that the preprocessor doesn't. /// const Token &GetLookAheadToken(unsigned N) { if (N == 0 || Tok.is(tok::eof)) return Tok; return PP.LookAhead(N-1); } public: /// NextToken - This peeks ahead one token and returns it without /// consuming it. const Token &NextToken() { return PP.LookAhead(0); } /// getTypeAnnotation - Read a parsed type out of an annotation token. static ParsedType getTypeAnnotation(Token &Tok) { return ParsedType::getFromOpaquePtr(Tok.getAnnotationValue()); } private: static void setTypeAnnotation(Token &Tok, ParsedType T) { Tok.setAnnotationValue(T.getAsOpaquePtr()); } /// \brief Read an already-translated primary expression out of an annotation /// token. static ExprResult getExprAnnotation(Token &Tok) { return ExprResult::getFromOpaquePointer(Tok.getAnnotationValue()); } /// \brief Set the primary expression corresponding to the given annotation /// token. static void setExprAnnotation(Token &Tok, ExprResult ER) { Tok.setAnnotationValue(ER.getAsOpaquePointer()); } public: // If NeedType is true, then TryAnnotateTypeOrScopeToken will try harder to // find a type name by attempting typo correction. bool TryAnnotateTypeOrScopeToken(bool EnteringContext = false, bool NeedType = false); bool TryAnnotateTypeOrScopeTokenAfterScopeSpec(bool EnteringContext, bool NeedType, CXXScopeSpec &SS, bool IsNewScope); bool TryAnnotateCXXScopeToken(bool EnteringContext = false); private: enum AnnotatedNameKind { /// Annotation has failed and emitted an error. ANK_Error, /// The identifier is a tentatively-declared name. ANK_TentativeDecl, /// The identifier is a template name. FIXME: Add an annotation for that. ANK_TemplateName, /// The identifier can't be resolved. ANK_Unresolved, /// Annotation was successful. ANK_Success }; AnnotatedNameKind TryAnnotateName(bool IsAddressOfOperand, std::unique_ptr<CorrectionCandidateCallback> CCC = nullptr); /// Push a tok::annot_cxxscope token onto the token stream. void AnnotateScopeToken(CXXScopeSpec &SS, bool IsNewAnnotation); /// TryAltiVecToken - Check for context-sensitive AltiVec identifier tokens, /// replacing them with the non-context-sensitive keywords. This returns /// true if the token was replaced. bool TryAltiVecToken(DeclSpec &DS, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, bool &isInvalid) { if (!getLangOpts().AltiVec && !getLangOpts().ZVector) return false; if (Tok.getIdentifierInfo() != Ident_vector && Tok.getIdentifierInfo() != Ident_bool && (!getLangOpts().AltiVec || Tok.getIdentifierInfo() != Ident_pixel)) return false; return TryAltiVecTokenOutOfLine(DS, Loc, PrevSpec, DiagID, isInvalid); } /// TryAltiVecVectorToken - Check for context-sensitive AltiVec vector /// identifier token, replacing it with the non-context-sensitive __vector. /// This returns true if the token was replaced. bool TryAltiVecVectorToken() { if ((!getLangOpts().AltiVec && !getLangOpts().ZVector) || Tok.getIdentifierInfo() != Ident_vector) return false; return TryAltiVecVectorTokenOutOfLine(); } bool TryAltiVecVectorTokenOutOfLine(); bool TryAltiVecTokenOutOfLine(DeclSpec &DS, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, bool &isInvalid); /// Returns true if the current token is the identifier 'instancetype'. /// /// Should only be used in Objective-C language modes. bool isObjCInstancetype() { assert(getLangOpts().ObjC1); if (!Ident_instancetype) Ident_instancetype = PP.getIdentifierInfo("instancetype"); return Tok.getIdentifierInfo() == Ident_instancetype; } /// TryKeywordIdentFallback - For compatibility with system headers using /// keywords as identifiers, attempt to convert the current token to an /// identifier and optionally disable the keyword for the remainder of the /// translation unit. This returns false if the token was not replaced, /// otherwise emits a diagnostic and returns true. bool TryKeywordIdentFallback(bool DisableKeyword); /// \brief Get the TemplateIdAnnotation from the token. TemplateIdAnnotation *takeTemplateIdAnnotation(const Token &tok); /// TentativeParsingAction - An object that is used as a kind of "tentative /// parsing transaction". It gets instantiated to mark the token position and /// after the token consumption is done, Commit() or Revert() is called to /// either "commit the consumed tokens" or revert to the previously marked /// token position. Example: /// /// TentativeParsingAction TPA(*this); /// ConsumeToken(); /// .... /// TPA.Revert(); /// class TentativeParsingAction { Parser &P; Token PrevTok; size_t PrevTentativelyDeclaredIdentifierCount; unsigned short PrevParenCount, PrevBracketCount, PrevBraceCount; bool isActive; public: explicit TentativeParsingAction(Parser& p) : P(p) { PrevTok = P.Tok; PrevTentativelyDeclaredIdentifierCount = P.TentativelyDeclaredIdentifiers.size(); PrevParenCount = P.ParenCount; PrevBracketCount = P.BracketCount; PrevBraceCount = P.BraceCount; P.PP.EnableBacktrackAtThisPos(); isActive = true; } void Commit() { assert(isActive && "Parsing action was finished!"); P.TentativelyDeclaredIdentifiers.resize( PrevTentativelyDeclaredIdentifierCount); P.PP.CommitBacktrackedTokens(); isActive = false; } void Revert() { assert(isActive && "Parsing action was finished!"); P.PP.Backtrack(); P.Tok = PrevTok; P.TentativelyDeclaredIdentifiers.resize( PrevTentativelyDeclaredIdentifierCount); P.ParenCount = PrevParenCount; P.BracketCount = PrevBracketCount; P.BraceCount = PrevBraceCount; isActive = false; } ~TentativeParsingAction() { assert(!isActive && "Forgot to call Commit or Revert!"); } }; class UnannotatedTentativeParsingAction; /// ObjCDeclContextSwitch - An object used to switch context from /// an objective-c decl context to its enclosing decl context and /// back. class ObjCDeclContextSwitch { Parser &P; Decl *DC; SaveAndRestore<bool> WithinObjCContainer; public: explicit ObjCDeclContextSwitch(Parser &p) : P(p), DC(p.getObjCDeclContext()), WithinObjCContainer(P.ParsingInObjCContainer, DC != nullptr) { if (DC) P.Actions.ActOnObjCTemporaryExitContainerContext(cast<DeclContext>(DC)); } ~ObjCDeclContextSwitch() { if (DC) P.Actions.ActOnObjCReenterContainerContext(cast<DeclContext>(DC)); } }; /// ExpectAndConsume - The parser expects that 'ExpectedTok' is next in the /// input. If so, it is consumed and false is returned. /// /// If a trivial punctuator misspelling is encountered, a FixIt error /// diagnostic is issued and false is returned after recovery. /// /// If the input is malformed, this emits the specified diagnostic and true is /// returned. bool ExpectAndConsume(tok::TokenKind ExpectedTok, unsigned Diag = diag::err_expected, StringRef DiagMsg = ""); /// \brief The parser expects a semicolon and, if present, will consume it. /// /// If the next token is not a semicolon, this emits the specified diagnostic, /// or, if there's just some closing-delimiter noise (e.g., ')' or ']') prior /// to the semicolon, consumes that extra token. bool ExpectAndConsumeSemi(unsigned DiagID); /// \brief The kind of extra semi diagnostic to emit. enum ExtraSemiKind { OutsideFunction = 0, InsideStruct = 1, InstanceVariableList = 2, AfterMemberFunctionDefinition = 3 }; /// \brief Consume any extra semi-colons until the end of the line. void ConsumeExtraSemi(ExtraSemiKind Kind, unsigned TST = TST_unspecified); public: //===--------------------------------------------------------------------===// // Scope manipulation /// ParseScope - Introduces a new scope for parsing. The kind of /// scope is determined by ScopeFlags. Objects of this type should /// be created on the stack to coincide with the position where the /// parser enters the new scope, and this object's constructor will /// create that new scope. Similarly, once the object is destroyed /// the parser will exit the scope. class ParseScope { Parser *Self; ParseScope(const ParseScope &) = delete; void operator=(const ParseScope &) = delete; public: // ParseScope - Construct a new object to manage a scope in the // parser Self where the new Scope is created with the flags // ScopeFlags, but only when we aren't about to enter a compound statement. ParseScope(Parser *Self, unsigned ScopeFlags, bool EnteredScope = true, bool BeforeCompoundStmt = false) : Self(Self) { if (EnteredScope && !BeforeCompoundStmt) Self->EnterScope(ScopeFlags); else { if (BeforeCompoundStmt) Self->incrementMSManglingNumber(); this->Self = nullptr; } } // Exit - Exit the scope associated with this object now, rather // than waiting until the object is destroyed. void Exit() { if (Self) { Self->ExitScope(); Self = nullptr; } } ~ParseScope() { Exit(); } }; /// EnterScope - Start a new scope. void EnterScope(unsigned ScopeFlags); /// ExitScope - Pop a scope off the scope stack. void ExitScope(); private: /// \brief RAII object used to modify the scope flags for the current scope. class ParseScopeFlags { Scope *CurScope; unsigned OldFlags; ParseScopeFlags(const ParseScopeFlags &) = delete; void operator=(const ParseScopeFlags &) = delete; public: ParseScopeFlags(Parser *Self, unsigned ScopeFlags, bool ManageFlags = true); ~ParseScopeFlags(); }; //===--------------------------------------------------------------------===// // Diagnostic Emission and Error recovery. public: DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID); DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID); DiagnosticBuilder Diag(unsigned DiagID) { return Diag(Tok, DiagID); } private: void SuggestParentheses(SourceLocation Loc, unsigned DK, SourceRange ParenRange); void CheckNestedObjCContexts(SourceLocation AtLoc); public: /// \brief Control flags for SkipUntil functions. enum SkipUntilFlags { StopAtSemi = 1 << 0, ///< Stop skipping at semicolon /// \brief Stop skipping at specified token, but don't skip the token itself StopBeforeMatch = 1 << 1, StopAtCodeCompletion = 1 << 2 ///< Stop at code completion }; friend LLVM_CONSTEXPR SkipUntilFlags operator|(SkipUntilFlags L, SkipUntilFlags R) { return static_cast<SkipUntilFlags>(static_cast<unsigned>(L) | static_cast<unsigned>(R)); } /// SkipUntil - Read tokens until we get to the specified token, then consume /// it (unless StopBeforeMatch is specified). Because we cannot guarantee /// that the token will ever occur, this skips to the next token, or to some /// likely good stopping point. If Flags has StopAtSemi flag, skipping will /// stop at a ';' character. /// /// If SkipUntil finds the specified token, it returns true, otherwise it /// returns false. bool SkipUntil(tok::TokenKind T, SkipUntilFlags Flags = static_cast<SkipUntilFlags>(0)) { return SkipUntil(llvm::makeArrayRef(T), Flags); } bool SkipUntil(tok::TokenKind T1, tok::TokenKind T2, SkipUntilFlags Flags = static_cast<SkipUntilFlags>(0)) { tok::TokenKind TokArray[] = {T1, T2}; return SkipUntil(TokArray, Flags); } bool SkipUntil(tok::TokenKind T1, tok::TokenKind T2, tok::TokenKind T3, SkipUntilFlags Flags = static_cast<SkipUntilFlags>(0)) { tok::TokenKind TokArray[] = {T1, T2, T3}; return SkipUntil(TokArray, Flags); } bool SkipUntil(ArrayRef<tok::TokenKind> Toks, SkipUntilFlags Flags = static_cast<SkipUntilFlags>(0)); /// SkipMalformedDecl - Read tokens until we get to some likely good stopping /// point for skipping past a simple-declaration. void SkipMalformedDecl(); private: //===--------------------------------------------------------------------===// // Lexing and parsing of C++ inline methods. struct ParsingClass; /// [class.mem]p1: "... the class is regarded as complete within /// - function bodies /// - default arguments /// - exception-specifications (TODO: C++0x) /// - and brace-or-equal-initializers for non-static data members /// (including such things in nested classes)." /// LateParsedDeclarations build the tree of those elements so they can /// be parsed after parsing the top-level class. class LateParsedDeclaration { public: virtual ~LateParsedDeclaration(); virtual void ParseLexedMethodDeclarations(); virtual void ParseLexedMemberInitializers(); virtual void ParseLexedMethodDefs(); virtual void ParseLexedAttributes(); }; /// Inner node of the LateParsedDeclaration tree that parses /// all its members recursively. class LateParsedClass : public LateParsedDeclaration { public: LateParsedClass(Parser *P, ParsingClass *C); ~LateParsedClass() override; void ParseLexedMethodDeclarations() override; void ParseLexedMemberInitializers() override; void ParseLexedMethodDefs() override; void ParseLexedAttributes() override; private: Parser *Self; ParsingClass *Class; }; /// Contains the lexed tokens of an attribute with arguments that /// may reference member variables and so need to be parsed at the /// end of the class declaration after parsing all other member /// member declarations. /// FIXME: Perhaps we should change the name of LateParsedDeclaration to /// LateParsedTokens. struct LateParsedAttribute : public LateParsedDeclaration { Parser *Self; CachedTokens Toks; IdentifierInfo &AttrName; SourceLocation AttrNameLoc; SmallVector<Decl*, 2> Decls; explicit LateParsedAttribute(Parser *P, IdentifierInfo &Name, SourceLocation Loc) : Self(P), AttrName(Name), AttrNameLoc(Loc) {} void ParseLexedAttributes() override; void addDecl(Decl *D) { Decls.push_back(D); } }; // A list of late-parsed attributes. Used by ParseGNUAttributes. class LateParsedAttrList: public SmallVector<LateParsedAttribute *, 2> { public: LateParsedAttrList(bool PSoon = false) : ParseSoon(PSoon) { } bool parseSoon() { return ParseSoon; } private: bool ParseSoon; // Are we planning to parse these shortly after creation? }; /// Contains the lexed tokens of a member function definition /// which needs to be parsed at the end of the class declaration /// after parsing all other member declarations. struct LexedMethod : public LateParsedDeclaration { Parser *Self; Decl *D; CachedTokens Toks; /// \brief Whether this member function had an associated template /// scope. When true, D is a template declaration. /// otherwise, it is a member function declaration. bool TemplateScope; explicit LexedMethod(Parser* P, Decl *MD) : Self(P), D(MD), TemplateScope(false) {} void ParseLexedMethodDefs() override; }; /// LateParsedDefaultArgument - Keeps track of a parameter that may /// have a default argument that cannot be parsed yet because it /// occurs within a member function declaration inside the class /// (C++ [class.mem]p2). struct LateParsedDefaultArgument { explicit LateParsedDefaultArgument(Decl *P, CachedTokens *Toks = nullptr) : Param(P), Toks(Toks) { } /// Param - The parameter declaration for this parameter. Decl *Param; /// Toks - The sequence of tokens that comprises the default /// argument expression, not including the '=' or the terminating /// ')' or ','. This will be NULL for parameters that have no /// default argument. CachedTokens *Toks; }; /// LateParsedMethodDeclaration - A method declaration inside a class that /// contains at least one entity whose parsing needs to be delayed /// until the class itself is completely-defined, such as a default /// argument (C++ [class.mem]p2). struct LateParsedMethodDeclaration : public LateParsedDeclaration { explicit LateParsedMethodDeclaration(Parser *P, Decl *M) : Self(P), Method(M), TemplateScope(false), ExceptionSpecTokens(nullptr) {} void ParseLexedMethodDeclarations() override; Parser* Self; /// Method - The method declaration. Decl *Method; /// \brief Whether this member function had an associated template /// scope. When true, D is a template declaration. /// othewise, it is a member function declaration. bool TemplateScope; /// DefaultArgs - Contains the parameters of the function and /// their default arguments. At least one of the parameters will /// have a default argument, but all of the parameters of the /// method will be stored so that they can be reintroduced into /// scope at the appropriate times. SmallVector<LateParsedDefaultArgument, 8> DefaultArgs; /// \brief The set of tokens that make up an exception-specification that /// has not yet been parsed. CachedTokens *ExceptionSpecTokens; }; /// LateParsedMemberInitializer - An initializer for a non-static class data /// member whose parsing must to be delayed until the class is completely /// defined (C++11 [class.mem]p2). struct LateParsedMemberInitializer : public LateParsedDeclaration { LateParsedMemberInitializer(Parser *P, Decl *FD) : Self(P), Field(FD) { } void ParseLexedMemberInitializers() override; Parser *Self; /// Field - The field declaration. Decl *Field; /// CachedTokens - The sequence of tokens that comprises the initializer, /// including any leading '='. CachedTokens Toks; }; /// LateParsedDeclarationsContainer - During parsing of a top (non-nested) /// C++ class, its method declarations that contain parts that won't be /// parsed until after the definition is completed (C++ [class.mem]p2), /// the method declarations and possibly attached inline definitions /// will be stored here with the tokens that will be parsed to create those /// entities. typedef SmallVector<LateParsedDeclaration*,2> LateParsedDeclarationsContainer; /// \brief Representation of a class that has been parsed, including /// any member function declarations or definitions that need to be /// parsed after the corresponding top-level class is complete. struct ParsingClass { ParsingClass(Decl *TagOrTemplate, bool TopLevelClass, bool IsInterface) : TopLevelClass(TopLevelClass), TemplateScope(false), IsInterface(IsInterface), TagOrTemplate(TagOrTemplate) { } /// \brief Whether this is a "top-level" class, meaning that it is /// not nested within another class. bool TopLevelClass : 1; /// \brief Whether this class had an associated template /// scope. When true, TagOrTemplate is a template declaration; /// othewise, it is a tag declaration. bool TemplateScope : 1; /// \brief Whether this class is an __interface. bool IsInterface : 1; /// \brief The class or class template whose definition we are parsing. Decl *TagOrTemplate; /// LateParsedDeclarations - Method declarations, inline definitions and /// nested classes that contain pieces whose parsing will be delayed until /// the top-level class is fully defined. LateParsedDeclarationsContainer LateParsedDeclarations; }; /// \brief The stack of classes that is currently being /// parsed. Nested and local classes will be pushed onto this stack /// when they are parsed, and removed afterward. std::stack<ParsingClass *> ClassStack; ParsingClass &getCurrentClass() { assert(!ClassStack.empty() && "No lexed method stacks!"); return *ClassStack.top(); } /// \brief RAII object used to manage the parsing of a class definition. class ParsingClassDefinition { Parser &P; bool Popped; Sema::ParsingClassState State; public: ParsingClassDefinition(Parser &P, Decl *TagOrTemplate, bool TopLevelClass, bool IsInterface) : P(P), Popped(false), State(P.PushParsingClass(TagOrTemplate, TopLevelClass, IsInterface)) { } /// \brief Pop this class of the stack. void Pop() { assert(!Popped && "Nested class has already been popped"); Popped = true; P.PopParsingClass(State); } ~ParsingClassDefinition() { if (!Popped) P.PopParsingClass(State); } }; /// \brief Contains information about any template-specific /// information that has been parsed prior to parsing declaration /// specifiers. struct ParsedTemplateInfo { ParsedTemplateInfo() : Kind(NonTemplate), TemplateParams(nullptr), TemplateLoc() { } ParsedTemplateInfo(TemplateParameterLists *TemplateParams, bool isSpecialization, bool lastParameterListWasEmpty = false) : Kind(isSpecialization? ExplicitSpecialization : Template), TemplateParams(TemplateParams), LastParameterListWasEmpty(lastParameterListWasEmpty) { } explicit ParsedTemplateInfo(SourceLocation ExternLoc, SourceLocation TemplateLoc) : Kind(ExplicitInstantiation), TemplateParams(nullptr), ExternLoc(ExternLoc), TemplateLoc(TemplateLoc), LastParameterListWasEmpty(false){ } /// \brief The kind of template we are parsing. enum { /// \brief We are not parsing a template at all. NonTemplate = 0, /// \brief We are parsing a template declaration. Template, /// \brief We are parsing an explicit specialization. ExplicitSpecialization, /// \brief We are parsing an explicit instantiation. ExplicitInstantiation } Kind; /// \brief The template parameter lists, for template declarations /// and explicit specializations. TemplateParameterLists *TemplateParams; /// \brief The location of the 'extern' keyword, if any, for an explicit /// instantiation SourceLocation ExternLoc; /// \brief The location of the 'template' keyword, for an explicit /// instantiation. SourceLocation TemplateLoc; /// \brief Whether the last template parameter list was empty. bool LastParameterListWasEmpty; SourceRange getSourceRange() const LLVM_READONLY; }; void LexTemplateFunctionForLateParsing(CachedTokens &Toks); void ParseLateTemplatedFuncDef(LateParsedTemplate &LPT); static void LateTemplateParserCallback(void *P, LateParsedTemplate &LPT); static void LateTemplateParserCleanupCallback(void *P); Sema::ParsingClassState PushParsingClass(Decl *TagOrTemplate, bool TopLevelClass, bool IsInterface); void DeallocateParsedClasses(ParsingClass *Class); void PopParsingClass(Sema::ParsingClassState); enum CachedInitKind { CIK_DefaultArgument, CIK_DefaultInitializer }; NamedDecl *ParseCXXInlineMethodDef(AccessSpecifier AS, AttributeList *AccessAttrs, ParsingDeclarator &D, const ParsedTemplateInfo &TemplateInfo, const VirtSpecifiers& VS, SourceLocation PureSpecLoc); void ParseCXXNonStaticMemberInitializer(Decl *VarD); void ParseLexedAttributes(ParsingClass &Class); void ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D, bool EnterScope, bool OnDefinition); void ParseLexedAttribute(LateParsedAttribute &LA, bool EnterScope, bool OnDefinition); void ParseLexedMethodDeclarations(ParsingClass &Class); void ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM); void ParseLexedMethodDefs(ParsingClass &Class); void ParseLexedMethodDef(LexedMethod &LM); void ParseLexedMemberInitializers(ParsingClass &Class); void ParseLexedMemberInitializer(LateParsedMemberInitializer &MI); void ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod); bool ConsumeAndStoreFunctionPrologue(CachedTokens &Toks); bool ConsumeAndStoreInitializer(CachedTokens &Toks, CachedInitKind CIK); bool ConsumeAndStoreConditional(CachedTokens &Toks); bool ConsumeAndStoreUntil(tok::TokenKind T1, CachedTokens &Toks, bool StopAtSemi = true, bool ConsumeFinalToken = true) { return ConsumeAndStoreUntil(T1, T1, Toks, StopAtSemi, ConsumeFinalToken); } bool ConsumeAndStoreUntil(tok::TokenKind T1, tok::TokenKind T2, CachedTokens &Toks, bool StopAtSemi = true, bool ConsumeFinalToken = true); //===--------------------------------------------------------------------===// // C99 6.9: External Definitions. struct ParsedAttributesWithRange : ParsedAttributes { ParsedAttributesWithRange(AttributeFactory &factory) : ParsedAttributes(factory) {} SourceRange Range; }; DeclGroupPtrTy ParseExternalDeclaration(ParsedAttributesWithRange &attrs, ParsingDeclSpec *DS = nullptr); bool isDeclarationAfterDeclarator(); bool isStartOfFunctionDefinition(const ParsingDeclarator &Declarator); DeclGroupPtrTy ParseDeclarationOrFunctionDefinition( ParsedAttributesWithRange &attrs, ParsingDeclSpec *DS = nullptr, AccessSpecifier AS = AS_none); DeclGroupPtrTy ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs, ParsingDeclSpec &DS, AccessSpecifier AS); Decl *ParseFunctionDefinition(ParsingDeclarator &D, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), LateParsedAttrList *LateParsedAttrs = nullptr); void ParseKNRParamDeclarations(Declarator &D); // EndLoc, if non-NULL, is filled with the location of the last token of // the simple-asm. ExprResult ParseSimpleAsm(SourceLocation *EndLoc = nullptr); ExprResult ParseAsmStringLiteral(); // Objective-C External Declarations void MaybeSkipAttributes(tok::ObjCKeywordKind Kind); DeclGroupPtrTy ParseObjCAtDirectives(); DeclGroupPtrTy ParseObjCAtClassDeclaration(SourceLocation atLoc); Decl *ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc, ParsedAttributes &prefixAttrs); ObjCTypeParamList *parseObjCTypeParamList(); ObjCTypeParamList *parseObjCTypeParamListOrProtocolRefs( SourceLocation &lAngleLoc, SmallVectorImpl<IdentifierLocPair> &protocolIdents, SourceLocation &rAngleLoc, bool mayBeProtocolList = true); void HelperActionsForIvarDeclarations(Decl *interfaceDecl, SourceLocation atLoc, BalancedDelimiterTracker &T, SmallVectorImpl<Decl *> &AllIvarDecls, bool RBraceMissing); void ParseObjCClassInstanceVariables(Decl *interfaceDecl, tok::ObjCKeywordKind visibility, SourceLocation atLoc); bool ParseObjCProtocolReferences(SmallVectorImpl<Decl *> &P, SmallVectorImpl<SourceLocation> &PLocs, bool WarnOnDeclarations, bool ForObjCContainer, SourceLocation &LAngleLoc, SourceLocation &EndProtoLoc, bool consumeLastToken); /// Parse the first angle-bracket-delimited clause for an /// Objective-C object or object pointer type, which may be either /// type arguments or protocol qualifiers. void parseObjCTypeArgsOrProtocolQualifiers( ParsedType baseType, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl<Decl *> &protocols, SmallVectorImpl<SourceLocation> &protocolLocs, SourceLocation &protocolRAngleLoc, bool consumeLastToken, bool warnOnIncompleteProtocols); /// Parse either Objective-C type arguments or protocol qualifiers; if the /// former, also parse protocol qualifiers afterward. void parseObjCTypeArgsAndProtocolQualifiers( ParsedType baseType, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl<Decl *> &protocols, SmallVectorImpl<SourceLocation> &protocolLocs, SourceLocation &protocolRAngleLoc, bool consumeLastToken); /// Parse a protocol qualifier type such as '<NSCopying>', which is /// an anachronistic way of writing 'id<NSCopying>'. TypeResult parseObjCProtocolQualifierType(SourceLocation &rAngleLoc); /// Parse Objective-C type arguments and protocol qualifiers, extending the /// current type with the parsed result. TypeResult parseObjCTypeArgsAndProtocolQualifiers(SourceLocation loc, ParsedType type, bool consumeLastToken, SourceLocation &endLoc); void ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, Decl *CDecl); DeclGroupPtrTy ParseObjCAtProtocolDeclaration(SourceLocation atLoc, ParsedAttributes &prefixAttrs); struct ObjCImplParsingDataRAII { Parser &P; Decl *Dcl; bool HasCFunction; typedef SmallVector<LexedMethod*, 8> LateParsedObjCMethodContainer; LateParsedObjCMethodContainer LateParsedObjCMethods; ObjCImplParsingDataRAII(Parser &parser, Decl *D) : P(parser), Dcl(D), HasCFunction(false) { P.CurParsedObjCImpl = this; Finished = false; } ~ObjCImplParsingDataRAII(); void finish(SourceRange AtEnd); bool isFinished() const { return Finished; } private: bool Finished; }; ObjCImplParsingDataRAII *CurParsedObjCImpl; void StashAwayMethodOrFunctionBodyTokens(Decl *MDecl); DeclGroupPtrTy ParseObjCAtImplementationDeclaration(SourceLocation AtLoc); DeclGroupPtrTy ParseObjCAtEndDeclaration(SourceRange atEnd); Decl *ParseObjCAtAliasDeclaration(SourceLocation atLoc); Decl *ParseObjCPropertySynthesize(SourceLocation atLoc); Decl *ParseObjCPropertyDynamic(SourceLocation atLoc); IdentifierInfo *ParseObjCSelectorPiece(SourceLocation &MethodLocation); // Definitions for Objective-c context sensitive keywords recognition. enum ObjCTypeQual { objc_in=0, objc_out, objc_inout, objc_oneway, objc_bycopy, objc_byref, objc_nonnull, objc_nullable, objc_null_unspecified, objc_NumQuals }; IdentifierInfo *ObjCTypeQuals[objc_NumQuals]; bool isTokIdentifier_in() const; ParsedType ParseObjCTypeName(ObjCDeclSpec &DS, Declarator::TheContext Ctx, ParsedAttributes *ParamAttrs); void ParseObjCMethodRequirement(); Decl *ParseObjCMethodPrototype( tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword, bool MethodDefinition = true); Decl *ParseObjCMethodDecl(SourceLocation mLoc, tok::TokenKind mType, tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword, bool MethodDefinition=true); void ParseObjCPropertyAttribute(ObjCDeclSpec &DS); Decl *ParseObjCMethodDefinition(); public: //===--------------------------------------------------------------------===// // C99 6.5: Expressions. /// TypeCastState - State whether an expression is or may be a type cast. enum TypeCastState { NotTypeCast = 0, MaybeTypeCast, IsTypeCast }; ExprResult ParseExpression(TypeCastState isTypeCast = NotTypeCast); ExprResult ParseConstantExpression(TypeCastState isTypeCast = NotTypeCast); ExprResult ParseConstraintExpression(); // Expr that doesn't include commas. ExprResult ParseAssignmentExpression(TypeCastState isTypeCast = NotTypeCast); ExprResult ParseMSAsmIdentifier(llvm::SmallVectorImpl<Token> &LineToks, unsigned &NumLineToksConsumed, void *Info, bool IsUnevaluated); private: ExprResult ParseExpressionWithLeadingAt(SourceLocation AtLoc); ExprResult ParseExpressionWithLeadingExtension(SourceLocation ExtLoc); ExprResult ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec); ExprResult ParseCastExpression(bool isUnaryExpression, bool isAddressOfOperand, bool &NotCastExpr, TypeCastState isTypeCast); ExprResult ParseCastExpression(bool isUnaryExpression, bool isAddressOfOperand = false, TypeCastState isTypeCast = NotTypeCast); /// Returns true if the next token cannot start an expression. bool isNotExpressionStart(); /// Returns true if the next token would start a postfix-expression /// suffix. bool isPostfixExpressionSuffixStart() { tok::TokenKind K = Tok.getKind(); return (K == tok::l_square || K == tok::l_paren || K == tok::period || K == tok::arrow || K == tok::plusplus || K == tok::minusminus); } ExprResult ParsePostfixExpressionSuffix(ExprResult LHS); ExprResult ParseUnaryExprOrTypeTraitExpression(); ExprResult ParseBuiltinPrimaryExpression(); ExprResult ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok, bool &isCastExpr, ParsedType &CastTy, SourceRange &CastRange); typedef SmallVector<Expr*, 20> ExprListTy; typedef SmallVector<SourceLocation, 20> CommaLocsTy; /// ParseExpressionList - Used for C/C++ (argument-)expression-list. bool ParseExpressionList(SmallVectorImpl<Expr *> &Exprs, SmallVectorImpl<SourceLocation> &CommaLocs, std::function<void()> Completer = nullptr); /// ParseSimpleExpressionList - A simple comma-separated list of expressions, /// used for misc language extensions. bool ParseSimpleExpressionList(SmallVectorImpl<Expr*> &Exprs, SmallVectorImpl<SourceLocation> &CommaLocs); /// ParenParseOption - Control what ParseParenExpression will parse. enum ParenParseOption { SimpleExpr, // Only parse '(' expression ')' CompoundStmt, // Also allow '(' compound-statement ')' CompoundLiteral, // Also allow '(' type-name ')' '{' ... '}' CastExpr // Also allow '(' type-name ')' <anything> }; ExprResult ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, bool isTypeCast, ParsedType &CastTy, SourceLocation &RParenLoc); ExprResult ParseCXXAmbiguousParenExpression( ParenParseOption &ExprType, ParsedType &CastTy, BalancedDelimiterTracker &Tracker, ColonProtectionRAIIObject &ColonProt); ExprResult ParseCompoundLiteralExpression(ParsedType Ty, SourceLocation LParenLoc, SourceLocation RParenLoc); ExprResult ParseStringLiteralExpression(bool AllowUserDefinedLiteral = false); ExprResult ParseGenericSelectionExpression(); ExprResult ParseObjCBoolLiteral(); ExprResult ParseFoldExpression(ExprResult LHS, BalancedDelimiterTracker &T); //===--------------------------------------------------------------------===// // C++ Expressions ExprResult tryParseCXXIdExpression(CXXScopeSpec &SS, bool isAddressOfOperand, Token &Replacement); ExprResult ParseCXXIdExpression(bool isAddressOfOperand = false); bool areTokensAdjacent(const Token &A, const Token &B); void CheckForTemplateAndDigraph(Token &Next, ParsedType ObjectTypePtr, bool EnteringContext, IdentifierInfo &II, CXXScopeSpec &SS); bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext, bool *MayBePseudoDestructor = nullptr, bool IsTypename = false, IdentifierInfo **LastII = nullptr); void CheckForLParenAfterColonColon(); //===--------------------------------------------------------------------===// // C++0x 5.1.2: Lambda expressions // [...] () -> type {...} ExprResult ParseLambdaExpression(); ExprResult TryParseLambdaExpression(); Optional<unsigned> ParseLambdaIntroducer(LambdaIntroducer &Intro, bool *SkippedInits = nullptr); bool TryParseLambdaIntroducer(LambdaIntroducer &Intro); ExprResult ParseLambdaExpressionAfterIntroducer( LambdaIntroducer &Intro); //===--------------------------------------------------------------------===// // C++ 5.2p1: C++ Casts ExprResult ParseCXXCasts(); //===--------------------------------------------------------------------===// // C++ 5.2p1: C++ Type Identification ExprResult ParseCXXTypeid(); //===--------------------------------------------------------------------===// // C++ : Microsoft __uuidof Expression ExprResult ParseCXXUuidof(); //===--------------------------------------------------------------------===// // C++ 5.2.4: C++ Pseudo-Destructor Expressions ExprResult ParseCXXPseudoDestructor(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, ParsedType ObjectType); //===--------------------------------------------------------------------===// // C++ 9.3.2: C++ 'this' pointer ExprResult ParseCXXThis(); //===--------------------------------------------------------------------===// // C++ 15: C++ Throw Expression ExprResult ParseThrowExpression(); ExceptionSpecificationType tryParseExceptionSpecification( bool Delayed, SourceRange &SpecificationRange, SmallVectorImpl<ParsedType> &DynamicExceptions, SmallVectorImpl<SourceRange> &DynamicExceptionRanges, ExprResult &NoexceptExpr, CachedTokens *&ExceptionSpecTokens); // EndLoc is filled with the location of the last token of the specification. ExceptionSpecificationType ParseDynamicExceptionSpecification( SourceRange &SpecificationRange, SmallVectorImpl<ParsedType> &Exceptions, SmallVectorImpl<SourceRange> &Ranges); //===--------------------------------------------------------------------===// // C++0x 8: Function declaration trailing-return-type TypeResult ParseTrailingReturnType(SourceRange &Range); //===--------------------------------------------------------------------===// // C++ 2.13.5: C++ Boolean Literals ExprResult ParseCXXBoolLiteral(); //===--------------------------------------------------------------------===// // C++ 5.2.3: Explicit type conversion (functional notation) ExprResult ParseCXXTypeConstructExpression(const DeclSpec &DS); /// ParseCXXSimpleTypeSpecifier - [C++ 7.1.5.2] Simple type specifiers. /// This should only be called when the current token is known to be part of /// simple-type-specifier. void ParseCXXSimpleTypeSpecifier(DeclSpec &DS); bool ParseCXXTypeSpecifierSeq(DeclSpec &DS); //===--------------------------------------------------------------------===// // C++ 5.3.4 and 5.3.5: C++ new and delete bool ParseExpressionListOrTypeId(SmallVectorImpl<Expr*> &Exprs, Declarator &D); void ParseDirectNewDeclarator(Declarator &D); ExprResult ParseCXXNewExpression(bool UseGlobal, SourceLocation Start); ExprResult ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start); //===--------------------------------------------------------------------===// // C++ if/switch/while condition expression. bool ParseCXXCondition(ExprResult &ExprResult, Decl *&DeclResult, SourceLocation Loc, bool ConvertToBoolean); //===--------------------------------------------------------------------===// // C++ types //===--------------------------------------------------------------------===// // C99 6.7.8: Initialization. /// ParseInitializer /// initializer: [C99 6.7.8] /// assignment-expression /// '{' ... ExprResult ParseInitializer() { if (Tok.isNot(tok::l_brace)) return ParseAssignmentExpression(); return ParseBraceInitializer(); } bool MayBeDesignationStart(); ExprResult ParseBraceInitializer(); ExprResult ParseInitializerWithPotentialDesignator(); //===--------------------------------------------------------------------===// // clang Expressions ExprResult ParseBlockLiteralExpression(); // ^{...} //===--------------------------------------------------------------------===// // Objective-C Expressions ExprResult ParseObjCAtExpression(SourceLocation AtLocation); ExprResult ParseObjCStringLiteral(SourceLocation AtLoc); ExprResult ParseObjCCharacterLiteral(SourceLocation AtLoc); ExprResult ParseObjCNumericLiteral(SourceLocation AtLoc); ExprResult ParseObjCBooleanLiteral(SourceLocation AtLoc, bool ArgValue); ExprResult ParseObjCArrayLiteral(SourceLocation AtLoc); ExprResult ParseObjCDictionaryLiteral(SourceLocation AtLoc); ExprResult ParseObjCBoxedExpr(SourceLocation AtLoc); ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc); ExprResult ParseObjCSelectorExpression(SourceLocation AtLoc); ExprResult ParseObjCProtocolExpression(SourceLocation AtLoc); bool isSimpleObjCMessageExpression(); ExprResult ParseObjCMessageExpression(); ExprResult ParseObjCMessageExpressionBody(SourceLocation LBracloc, SourceLocation SuperLoc, ParsedType ReceiverType, Expr *ReceiverExpr); ExprResult ParseAssignmentExprWithObjCMessageExprStart( SourceLocation LBracloc, SourceLocation SuperLoc, ParsedType ReceiverType, Expr *ReceiverExpr); bool ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr); //===--------------------------------------------------------------------===// // C99 6.8: Statements and Blocks. /// A SmallVector of statements, with stack size 32 (as that is the only one /// used.) typedef SmallVector<Stmt*, 32> StmtVector; /// A SmallVector of expressions, with stack size 12 (the maximum used.) typedef SmallVector<Expr*, 12> ExprVector; /// A SmallVector of types. typedef SmallVector<ParsedType, 12> TypeVector; StmtResult ParseStatement(SourceLocation *TrailingElseLoc = nullptr); StmtResult ParseStatementOrDeclaration(StmtVector &Stmts, bool OnlyStatement, SourceLocation *TrailingElseLoc = nullptr); StmtResult ParseStatementOrDeclarationAfterAttributes( StmtVector &Stmts, bool OnlyStatement, SourceLocation *TrailingElseLoc, ParsedAttributesWithRange &Attrs); StmtResult ParseExprStatement(); StmtResult ParseLabeledStatement(ParsedAttributesWithRange &attrs); StmtResult ParseCaseStatement(bool MissingCase = false, ExprResult Expr = ExprResult()); StmtResult ParseDefaultStatement(); StmtResult ParseCompoundStatement(bool isStmtExpr = false); StmtResult ParseCompoundStatement(bool isStmtExpr, unsigned ScopeFlags); void ParseCompoundStatementLeadingPragmas(); StmtResult ParseCompoundStatementBody(bool isStmtExpr = false); bool ParseParenExprOrCondition(ExprResult &ExprResult, Decl *&DeclResult, SourceLocation Loc, bool ConvertToBoolean); StmtResult ParseIfStatement(SourceLocation *TrailingElseLoc); StmtResult ParseSwitchStatement(SourceLocation *TrailingElseLoc); StmtResult ParseWhileStatement(SourceLocation *TrailingElseLoc); StmtResult ParseDoStatement(); StmtResult ParseForStatement(SourceLocation *TrailingElseLoc); StmtResult ParseGotoStatement(); StmtResult ParseContinueStatement(); StmtResult ParseBreakStatement(); StmtResult ParseReturnStatement(); StmtResult ParseAsmStatement(bool &msAsm); StmtResult ParseMicrosoftAsmStatement(SourceLocation AsmLoc); StmtResult ParsePragmaLoopHint(StmtVector &Stmts, bool OnlyStatement, SourceLocation *TrailingElseLoc, ParsedAttributesWithRange &Attrs); /// \brief Describes the behavior that should be taken for an __if_exists /// block. enum IfExistsBehavior { /// \brief Parse the block; this code is always used. IEB_Parse, /// \brief Skip the block entirely; this code is never used. IEB_Skip, /// \brief Parse the block as a dependent block, which may be used in /// some template instantiations but not others. IEB_Dependent }; /// \brief Describes the condition of a Microsoft __if_exists or /// __if_not_exists block. struct IfExistsCondition { /// \brief The location of the initial keyword. SourceLocation KeywordLoc; /// \brief Whether this is an __if_exists block (rather than an /// __if_not_exists block). bool IsIfExists; /// \brief Nested-name-specifier preceding the name. CXXScopeSpec SS; /// \brief The name we're looking for. UnqualifiedId Name; /// \brief The behavior of this __if_exists or __if_not_exists block /// should. IfExistsBehavior Behavior; }; bool ParseMicrosoftIfExistsCondition(IfExistsCondition& Result); void ParseMicrosoftIfExistsStatement(StmtVector &Stmts); void ParseMicrosoftIfExistsExternalDeclaration(); void ParseMicrosoftIfExistsClassDeclaration(DeclSpec::TST TagType, AccessSpecifier& CurAS); bool ParseMicrosoftIfExistsBraceInitializer(ExprVector &InitExprs, bool &InitExprsOk); bool ParseAsmOperandsOpt(SmallVectorImpl<IdentifierInfo *> &Names, SmallVectorImpl<Expr *> &Constraints, SmallVectorImpl<Expr *> &Exprs); //===--------------------------------------------------------------------===// // C++ 6: Statements and Blocks StmtResult ParseCXXTryBlock(); StmtResult ParseCXXTryBlockCommon(SourceLocation TryLoc, bool FnTry = false); StmtResult ParseCXXCatchBlock(bool FnCatch = false); //===--------------------------------------------------------------------===// // MS: SEH Statements and Blocks StmtResult ParseSEHTryBlock(); StmtResult ParseSEHExceptBlock(SourceLocation Loc); StmtResult ParseSEHFinallyBlock(SourceLocation Loc); StmtResult ParseSEHLeaveStatement(); //===--------------------------------------------------------------------===// // Objective-C Statements StmtResult ParseObjCAtStatement(SourceLocation atLoc); StmtResult ParseObjCTryStmt(SourceLocation atLoc); StmtResult ParseObjCThrowStmt(SourceLocation atLoc); StmtResult ParseObjCSynchronizedStmt(SourceLocation atLoc); StmtResult ParseObjCAutoreleasePoolStmt(SourceLocation atLoc); //===--------------------------------------------------------------------===// // C99 6.7: Declarations. /// A context for parsing declaration specifiers. TODO: flesh this /// out, there are other significant restrictions on specifiers than /// would be best implemented in the parser. enum DeclSpecContext { DSC_normal, // normal context DSC_class, // class context, enables 'friend' DSC_type_specifier, // C++ type-specifier-seq or C specifier-qualifier-list DSC_trailing, // C++11 trailing-type-specifier in a trailing return type DSC_alias_declaration, // C++11 type-specifier-seq in an alias-declaration DSC_top_level, // top-level/namespace declaration context DSC_template_type_arg, // template type argument context DSC_objc_method_result, // ObjC method result context, enables 'instancetype' DSC_condition // condition declaration context }; /// Is this a context in which we are parsing just a type-specifier (or /// trailing-type-specifier)? static bool isTypeSpecifier(DeclSpecContext DSC) { switch (DSC) { case DSC_normal: case DSC_class: case DSC_top_level: case DSC_objc_method_result: case DSC_condition: return false; case DSC_template_type_arg: case DSC_type_specifier: case DSC_trailing: case DSC_alias_declaration: return true; } llvm_unreachable("Missing DeclSpecContext case"); } /// Information on a C++0x for-range-initializer found while parsing a /// declaration which turns out to be a for-range-declaration. struct ForRangeInit { SourceLocation ColonLoc; ExprResult RangeExpr; bool ParsedForRangeDecl() { return !ColonLoc.isInvalid(); } }; DeclGroupPtrTy ParseDeclaration(unsigned Context, SourceLocation &DeclEnd, ParsedAttributesWithRange &attrs); DeclGroupPtrTy ParseSimpleDeclaration(unsigned Context, SourceLocation &DeclEnd, ParsedAttributesWithRange &attrs, bool RequireSemi, ForRangeInit *FRI = nullptr); bool MightBeDeclarator(unsigned Context); DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context, SourceLocation *DeclEnd = nullptr, ForRangeInit *FRI = nullptr); Decl *ParseDeclarationAfterDeclarator(Declarator &D, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo()); bool ParseAsmAttributesAfterDeclarator(Declarator &D); Decl *ParseDeclarationAfterDeclaratorAndAttributes( Declarator &D, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), ForRangeInit *FRI = nullptr); Decl *ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope); Decl *ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope); /// \brief When in code-completion, skip parsing of the function/method body /// unless the body contains the code-completion point. /// /// \returns true if the function body was skipped. bool trySkippingFunctionBody(); bool ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, const ParsedTemplateInfo &TemplateInfo, AccessSpecifier AS, DeclSpecContext DSC, ParsedAttributesWithRange &Attrs); DeclSpecContext getDeclSpecContextFromDeclaratorContext(unsigned Context); void ParseDeclarationSpecifiers(DeclSpec &DS, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), AccessSpecifier AS = AS_none, DeclSpecContext DSC = DSC_normal, LateParsedAttrList *LateAttrs = nullptr); bool DiagnoseMissingSemiAfterTagDefinition(DeclSpec &DS, AccessSpecifier AS, DeclSpecContext DSContext, LateParsedAttrList *LateAttrs = nullptr); void ParseSpecifierQualifierList(DeclSpec &DS, AccessSpecifier AS = AS_none, DeclSpecContext DSC = DSC_normal); void ParseObjCTypeQualifierList(ObjCDeclSpec &DS, Declarator::TheContext Context); void ParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS, const ParsedTemplateInfo &TemplateInfo, AccessSpecifier AS, DeclSpecContext DSC); void ParseEnumBody(SourceLocation StartLoc, Decl *TagDecl); void ParseStructUnionBody(SourceLocation StartLoc, unsigned TagType, Decl *TagDecl); void ParseStructDeclaration( ParsingDeclSpec &DS, llvm::function_ref<void(ParsingFieldDeclarator &)> FieldsCallback); bool isDeclarationSpecifier(bool DisambiguatingWithExpression = false); bool isTypeSpecifierQualifier(); bool isTypeQualifier() const; /// isKnownToBeTypeSpecifier - Return true if we know that the specified token /// is definitely a type-specifier. Return false if it isn't part of a type /// specifier or if we're not sure. bool isKnownToBeTypeSpecifier(const Token &Tok) const; /// \brief Return true if we know that we are definitely looking at a /// decl-specifier, and isn't part of an expression such as a function-style /// cast. Return false if it's no a decl-specifier, or we're not sure. bool isKnownToBeDeclarationSpecifier() { if (getLangOpts().CPlusPlus) return isCXXDeclarationSpecifier() == TPResult::True; return isDeclarationSpecifier(true); } /// isDeclarationStatement - Disambiguates between a declaration or an /// expression statement, when parsing function bodies. /// Returns true for declaration, false for expression. bool isDeclarationStatement() { if (getLangOpts().CPlusPlus) return isCXXDeclarationStatement(); return isDeclarationSpecifier(true); } /// isForInitDeclaration - Disambiguates between a declaration or an /// expression in the context of the C 'clause-1' or the C++ // 'for-init-statement' part of a 'for' statement. /// Returns true for declaration, false for expression. bool isForInitDeclaration() { if (getLangOpts().CPlusPlus) return isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true); return isDeclarationSpecifier(true); } /// \brief Determine whether this is a C++1z for-range-identifier. bool isForRangeIdentifier(); /// \brief Determine whether we are currently at the start of an Objective-C /// class message that appears to be missing the open bracket '['. bool isStartOfObjCClassMessageMissingOpenBracket(); /// \brief Starting with a scope specifier, identifier, or /// template-id that refers to the current class, determine whether /// this is a constructor declarator. bool isConstructorDeclarator(bool Unqualified); /// \brief Specifies the context in which type-id/expression /// disambiguation will occur. enum TentativeCXXTypeIdContext { TypeIdInParens, TypeIdUnambiguous, TypeIdAsTemplateArgument }; /// isTypeIdInParens - Assumes that a '(' was parsed and now we want to know /// whether the parens contain an expression or a type-id. /// Returns true for a type-id and false for an expression. bool isTypeIdInParens(bool &isAmbiguous) { if (getLangOpts().CPlusPlus) return isCXXTypeId(TypeIdInParens, isAmbiguous); isAmbiguous = false; return isTypeSpecifierQualifier(); } bool isTypeIdInParens() { bool isAmbiguous; return isTypeIdInParens(isAmbiguous); } /// \brief Checks if the current tokens form type-id or expression. /// It is similar to isTypeIdInParens but does not suppose that type-id /// is in parenthesis. bool isTypeIdUnambiguously() { bool IsAmbiguous; if (getLangOpts().CPlusPlus) return isCXXTypeId(TypeIdUnambiguous, IsAmbiguous); return isTypeSpecifierQualifier(); } /// isCXXDeclarationStatement - C++-specialized function that disambiguates /// between a declaration or an expression statement, when parsing function /// bodies. Returns true for declaration, false for expression. bool isCXXDeclarationStatement(); /// isCXXSimpleDeclaration - C++-specialized function that disambiguates /// between a simple-declaration or an expression-statement. /// If during the disambiguation process a parsing error is encountered, /// the function returns true to let the declaration parsing code handle it. /// Returns false if the statement is disambiguated as expression. bool isCXXSimpleDeclaration(bool AllowForRangeDecl); /// isCXXFunctionDeclarator - Disambiguates between a function declarator or /// a constructor-style initializer, when parsing declaration statements. /// Returns true for function declarator and false for constructor-style /// initializer. Sets 'IsAmbiguous' to true to indicate that this declaration /// might be a constructor-style initializer. /// If during the disambiguation process a parsing error is encountered, /// the function returns true to let the declaration parsing code handle it. bool isCXXFunctionDeclarator(bool *IsAmbiguous = nullptr); /// isCXXConditionDeclaration - Disambiguates between a declaration or an /// expression for a condition of a if/switch/while/for statement. /// If during the disambiguation process a parsing error is encountered, /// the function returns true to let the declaration parsing code handle it. bool isCXXConditionDeclaration(); bool isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous); bool isCXXTypeId(TentativeCXXTypeIdContext Context) { bool isAmbiguous; return isCXXTypeId(Context, isAmbiguous); } /// TPResult - Used as the result value for functions whose purpose is to /// disambiguate C++ constructs by "tentatively parsing" them. enum class TPResult { True, False, Ambiguous, Error }; /// \brief Based only on the given token kind, determine whether we know that /// we're at the start of an expression or a type-specifier-seq (which may /// be an expression, in C++). /// /// This routine does not attempt to resolve any of the trick cases, e.g., /// those involving lookup of identifiers. /// /// \returns \c TPR_true if this token starts an expression, \c TPR_false if /// this token starts a type-specifier-seq, or \c TPR_ambiguous if it cannot /// tell. TPResult isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind); /// isCXXDeclarationSpecifier - Returns TPResult::True if it is a /// declaration specifier, TPResult::False if it is not, /// TPResult::Ambiguous if it could be either a decl-specifier or a /// function-style cast, and TPResult::Error if a parsing error was /// encountered. If it could be a braced C++11 function-style cast, returns /// BracedCastResult. /// Doesn't consume tokens. TPResult isCXXDeclarationSpecifier(TPResult BracedCastResult = TPResult::False, bool *HasMissingTypename = nullptr); /// Given that isCXXDeclarationSpecifier returns \c TPResult::True or /// \c TPResult::Ambiguous, determine whether the decl-specifier would be /// a type-specifier other than a cv-qualifier. bool isCXXDeclarationSpecifierAType(); /// \brief Determine whether an identifier has been tentatively declared as a /// non-type. Such tentative declarations should not be found to name a type /// during a tentative parse, but also should not be annotated as a non-type. bool isTentativelyDeclared(IdentifierInfo *II); // "Tentative parsing" functions, used for disambiguation. If a parsing error // is encountered they will return TPResult::Error. // Returning TPResult::True/False indicates that the ambiguity was // resolved and tentative parsing may stop. TPResult::Ambiguous indicates // that more tentative parsing is necessary for disambiguation. // They all consume tokens, so backtracking should be used after calling them. TPResult TryParseSimpleDeclaration(bool AllowForRangeDecl); TPResult TryParseTypeofSpecifier(); TPResult TryParseProtocolQualifiers(); TPResult TryParsePtrOperatorSeq(); TPResult TryParseOperatorId(); TPResult TryParseInitDeclaratorList(); TPResult TryParseDeclarator(bool mayBeAbstract, bool mayHaveIdentifier=true); TPResult TryParseParameterDeclarationClause(bool *InvalidAsDeclaration = nullptr, bool VersusTemplateArg = false); TPResult TryParseFunctionDeclarator(); TPResult TryParseBracketDeclarator(); TPResult TryConsumeDeclarationSpecifier(); public: TypeResult ParseTypeName(SourceRange *Range = nullptr, Declarator::TheContext Context = Declarator::TypeNameContext, AccessSpecifier AS = AS_none, Decl **OwnedType = nullptr, ParsedAttributes *Attrs = nullptr); private: void ParseBlockId(SourceLocation CaretLoc); // Check for the start of a C++11 attribute-specifier-seq in a context where // an attribute is not allowed. bool CheckProhibitedCXX11Attribute() { assert(Tok.is(tok::l_square)); if (!getLangOpts().CPlusPlus11 || NextToken().isNot(tok::l_square)) return false; return DiagnoseProhibitedCXX11Attribute(); } bool DiagnoseProhibitedCXX11Attribute(); void CheckMisplacedCXX11Attribute(ParsedAttributesWithRange &Attrs, SourceLocation CorrectLocation) { if (!getLangOpts().CPlusPlus11) return; if ((Tok.isNot(tok::l_square) || NextToken().isNot(tok::l_square)) && Tok.isNot(tok::kw_alignas)) return; DiagnoseMisplacedCXX11Attribute(Attrs, CorrectLocation); } void DiagnoseMisplacedCXX11Attribute(ParsedAttributesWithRange &Attrs, SourceLocation CorrectLocation); void handleDeclspecAlignBeforeClassKey(ParsedAttributesWithRange &Attrs, DeclSpec &DS, Sema::TagUseKind TUK); void ProhibitAttributes(ParsedAttributesWithRange &attrs) { if (!attrs.Range.isValid()) return; DiagnoseProhibitedAttributes(attrs); attrs.clear(); } void DiagnoseProhibitedAttributes(ParsedAttributesWithRange &attrs); // Forbid C++11 attributes that appear on certain syntactic // locations which standard permits but we don't supported yet, // for example, attributes appertain to decl specifiers. void ProhibitCXX11Attributes(ParsedAttributesWithRange &attrs); /// \brief Skip C++11 attributes and return the end location of the last one. /// \returns SourceLocation() if there are no attributes. SourceLocation SkipCXX11Attributes(); /// \brief Diagnose and skip C++11 attributes that appear in syntactic /// locations where attributes are not allowed. void DiagnoseAndSkipCXX11Attributes(); /// \brief Parses syntax-generic attribute arguments for attributes which are /// known to the implementation, and adds them to the given ParsedAttributes /// list with the given attribute syntax. Returns the number of arguments /// parsed for the attribute. unsigned ParseAttributeArgsCommon(IdentifierInfo *AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs, SourceLocation *EndLoc, IdentifierInfo *ScopeName, SourceLocation ScopeLoc, AttributeList::Syntax Syntax); // HLSL Change Starts: Parse HLSL Attributes and append them to Declarator Object bool MaybeParseHLSLAttributes(std::vector<hlsl::UnusualAnnotation *> &target); inline bool MaybeParseHLSLAttributes(Declarator &D) { return MaybeParseHLSLAttributes(D.UnusualAnnotations); } void MaybeParseHLSLDeclarationSpecifiers(std::vector<InheritableAttr *> &attrs); // HLSL Change Ends void MaybeParseGNUAttributes(Declarator &D, LateParsedAttrList *LateAttrs = nullptr) { if (Tok.is(tok::kw___attribute)) { ParsedAttributes attrs(AttrFactory); SourceLocation endLoc; ParseGNUAttributes(attrs, &endLoc, LateAttrs, &D); D.takeAttributes(attrs, endLoc); } } void MaybeParseGNUAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = nullptr, LateParsedAttrList *LateAttrs = nullptr) { if (Tok.is(tok::kw___attribute)) ParseGNUAttributes(attrs, endLoc, LateAttrs); } void ParseGNUAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = nullptr, LateParsedAttrList *LateAttrs = nullptr, Declarator *D = nullptr); void ParseGNUAttributeArgs(IdentifierInfo *AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs, SourceLocation *EndLoc, IdentifierInfo *ScopeName, SourceLocation ScopeLoc, AttributeList::Syntax Syntax, Declarator *D); IdentifierLoc *ParseIdentifierLoc(); void MaybeParseCXX11Attributes(Declarator &D) { if ((getLangOpts().CPlusPlus11 || getLangOpts().HLSL) && // HLSL change isCXX11AttributeSpecifier()) { ParsedAttributesWithRange attrs(AttrFactory); SourceLocation endLoc; ParseCXX11Attributes(attrs, &endLoc); D.takeAttributes(attrs, endLoc); } } void MaybeParseCXX11Attributes(ParsedAttributes &attrs, SourceLocation *endLoc = nullptr) { if ((getLangOpts().CPlusPlus11 || getLangOpts().HLSL) && // HLSL change isCXX11AttributeSpecifier()) { ParsedAttributesWithRange attrsWithRange(AttrFactory); ParseCXX11Attributes(attrsWithRange, endLoc); attrs.takeAllFrom(attrsWithRange); } } void MaybeParseCXX11Attributes(ParsedAttributesWithRange &attrs, SourceLocation *endLoc = nullptr, bool OuterMightBeMessageSend = false) { if ((getLangOpts().CPlusPlus11 || getLangOpts().HLSL) && // HLSL change isCXX11AttributeSpecifier(false, OuterMightBeMessageSend)) ParseCXX11Attributes(attrs, endLoc); } void ParseCXX11AttributeSpecifier(ParsedAttributes &attrs, SourceLocation *EndLoc = nullptr); void ParseCXX11Attributes(ParsedAttributesWithRange &attrs, SourceLocation *EndLoc = nullptr); /// \brief Parses a C++-style attribute argument list. Returns true if this /// results in adding an attribute to the ParsedAttributes list. bool ParseCXX11AttributeArgs(IdentifierInfo *AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs, SourceLocation *EndLoc, IdentifierInfo *ScopeName, SourceLocation ScopeLoc); // HLSL Change Starts IdentifierInfo *TryParseHLSLAttributeIdentifier(SourceLocation &Loc); void MaybeParseHLSLAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = 0) { if (getLangOpts().HLSL && Tok.is(tok::l_square)) { ParsedAttributesWithRange attrsWithRange(AttrFactory); ParseHLSLAttributes(attrsWithRange, endLoc); attrs.takeAllFrom(attrsWithRange); } } void MaybeParseHLSLAttributes(ParsedAttributesWithRange &attrs, SourceLocation *endLoc = 0) { if (getLangOpts().HLSL && Tok.is(tok::l_square)) ParseHLSLAttributes(attrs, endLoc); } void ParseHLSLAttributeSpecifier(ParsedAttributes &attrs, SourceLocation *EndLoc = 0); void ParseHLSLAttributes(ParsedAttributesWithRange &attrs, SourceLocation *EndLoc = 0); // HLSL Change Ends IdentifierInfo *TryParseCXX11AttributeIdentifier(SourceLocation &Loc); void MaybeParseMicrosoftAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = nullptr) { if (getLangOpts().MicrosoftExt && Tok.is(tok::l_square)) ParseMicrosoftAttributes(attrs, endLoc); } void ParseMicrosoftAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = nullptr); void MaybeParseMicrosoftDeclSpecs(ParsedAttributes &Attrs, SourceLocation *End = nullptr) { const auto &LO = getLangOpts(); if ((LO.MicrosoftExt || LO.Borland || LO.CUDA) && Tok.is(tok::kw___declspec)) ParseMicrosoftDeclSpecs(Attrs, End); } void ParseMicrosoftDeclSpecs(ParsedAttributes &Attrs, SourceLocation *End = nullptr); bool ParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs); void ParseMicrosoftTypeAttributes(ParsedAttributes &attrs); void DiagnoseAndSkipExtendedMicrosoftTypeAttributes(); SourceLocation SkipExtendedMicrosoftTypeAttributes(); void ParseMicrosoftInheritanceClassAttributes(ParsedAttributes &attrs); void ParseBorlandTypeAttributes(ParsedAttributes &attrs); void ParseOpenCLAttributes(ParsedAttributes &attrs); void ParseOpenCLQualifiers(ParsedAttributes &Attrs); void ParseNullabilityTypeSpecifiers(ParsedAttributes &attrs); VersionTuple ParseVersionTuple(SourceRange &Range); void ParseAvailabilityAttribute(IdentifierInfo &Availability, SourceLocation AvailabilityLoc, ParsedAttributes &attrs, SourceLocation *endLoc, IdentifierInfo *ScopeName, SourceLocation ScopeLoc, AttributeList::Syntax Syntax); void ParseObjCBridgeRelatedAttribute(IdentifierInfo &ObjCBridgeRelated, SourceLocation ObjCBridgeRelatedLoc, ParsedAttributes &attrs, SourceLocation *endLoc, IdentifierInfo *ScopeName, SourceLocation ScopeLoc, AttributeList::Syntax Syntax); void ParseTypeTagForDatatypeAttribute(IdentifierInfo &AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs, SourceLocation *EndLoc, IdentifierInfo *ScopeName, SourceLocation ScopeLoc, AttributeList::Syntax Syntax); void ParseAttributeWithTypeArg(IdentifierInfo &AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs, SourceLocation *EndLoc, IdentifierInfo *ScopeName, SourceLocation ScopeLoc, AttributeList::Syntax Syntax); void ParseTypeofSpecifier(DeclSpec &DS); SourceLocation ParseDecltypeSpecifier(DeclSpec &DS); void AnnotateExistingDecltypeSpecifier(const DeclSpec &DS, SourceLocation StartLoc, SourceLocation EndLoc); void ParseUnderlyingTypeSpecifier(DeclSpec &DS); void ParseAtomicSpecifier(DeclSpec &DS); ExprResult ParseAlignArgument(SourceLocation Start, SourceLocation &EllipsisLoc); void ParseAlignmentSpecifier(ParsedAttributes &Attrs, SourceLocation *endLoc = nullptr); VirtSpecifiers::Specifier isCXX11VirtSpecifier(const Token &Tok) const; VirtSpecifiers::Specifier isCXX11VirtSpecifier() const { return isCXX11VirtSpecifier(Tok); } void ParseOptionalCXX11VirtSpecifierSeq(VirtSpecifiers &VS, bool IsInterface, SourceLocation FriendLoc); bool isCXX11FinalKeyword() const; /// DeclaratorScopeObj - RAII object used in Parser::ParseDirectDeclarator to /// enter a new C++ declarator scope and exit it when the function is /// finished. class DeclaratorScopeObj { Parser &P; CXXScopeSpec &SS; bool EnteredScope; bool CreatedScope; public: DeclaratorScopeObj(Parser &p, CXXScopeSpec &ss) : P(p), SS(ss), EnteredScope(false), CreatedScope(false) {} void EnterDeclaratorScope() { assert(!EnteredScope && "Already entered the scope!"); assert(SS.isSet() && "C++ scope was not set!"); CreatedScope = true; P.EnterScope(0); // Not a decl scope. if (!P.Actions.ActOnCXXEnterDeclaratorScope(P.getCurScope(), SS)) EnteredScope = true; } ~DeclaratorScopeObj() { if (EnteredScope) { assert(SS.isSet() && "C++ scope was cleared ?"); P.Actions.ActOnCXXExitDeclaratorScope(P.getCurScope(), SS); } if (CreatedScope) P.ExitScope(); } }; /// ParseDeclarator - Parse and verify a newly-initialized declarator. void ParseDeclarator(Declarator &D); /// A function that parses a variant of direct-declarator. typedef void (Parser::*DirectDeclParseFunction)(Declarator&); void ParseDeclaratorInternal(Declarator &D, DirectDeclParseFunction DirectDeclParser); enum AttrRequirements { AR_NoAttributesParsed = 0, ///< No attributes are diagnosed. AR_GNUAttributesParsedAndRejected = 1 << 0, ///< Diagnose GNU attributes. AR_GNUAttributesParsed = 1 << 1, AR_CXX11AttributesParsed = 1 << 2, AR_DeclspecAttributesParsed = 1 << 3, AR_AllAttributesParsed = AR_GNUAttributesParsed | AR_CXX11AttributesParsed | AR_DeclspecAttributesParsed, AR_VendorAttributesParsed = AR_GNUAttributesParsed | AR_DeclspecAttributesParsed }; void ParseTypeQualifierListOpt(DeclSpec &DS, unsigned AttrReqs = AR_AllAttributesParsed, bool AtomicAllowed = true, bool IdentifierRequired = false); void ParseDirectDeclarator(Declarator &D); void ParseParenDeclarator(Declarator &D); void ParseFunctionDeclarator(Declarator &D, ParsedAttributes &attrs, BalancedDelimiterTracker &Tracker, bool IsAmbiguous, bool RequiresArg = false); bool ParseRefQualifier(bool &RefQualifierIsLValueRef, SourceLocation &RefQualifierLoc); bool isFunctionDeclaratorIdentifierList(); void ParseFunctionDeclaratorIdentifierList( Declarator &D, SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo); void ParseParameterDeclarationClause( Declarator &D, ParsedAttributes &attrs, SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo, SourceLocation &EllipsisLoc); void ParseBracketDeclarator(Declarator &D); void ParseMisplacedBracketDeclarator(Declarator &D); //===--------------------------------------------------------------------===// // C++ 7: Declarations [dcl.dcl] /// The kind of attribute specifier we have found. enum CXX11AttributeKind { /// This is not an attribute specifier. CAK_NotAttributeSpecifier, /// This should be treated as an attribute-specifier. CAK_AttributeSpecifier, /// The next tokens are '[[', but this is not an attribute-specifier. This /// is ill-formed by C++11 [dcl.attr.grammar]p6. CAK_InvalidAttributeSpecifier }; CXX11AttributeKind isCXX11AttributeSpecifier(bool Disambiguate = false, bool OuterMightBeMessageSend = false); void DiagnoseUnexpectedNamespace(NamedDecl *Context); // HLSL Change Starts Decl *ParseCTBuffer(unsigned Context, SourceLocation &DeclEnd, ParsedAttributesWithRange &attrs, SourceLocation InlineLoc = SourceLocation()); // HLSL Change Ends Decl *ParseNamespace(unsigned Context, SourceLocation &DeclEnd, SourceLocation InlineLoc = SourceLocation()); void ParseInnerNamespace(std::vector<SourceLocation>& IdentLoc, std::vector<IdentifierInfo*>& Ident, std::vector<SourceLocation>& NamespaceLoc, unsigned int index, SourceLocation& InlineLoc, ParsedAttributes& attrs, BalancedDelimiterTracker &Tracker); Decl *ParseLinkage(ParsingDeclSpec &DS, unsigned Context); Decl *ParseUsingDirectiveOrDeclaration(unsigned Context, const ParsedTemplateInfo &TemplateInfo, SourceLocation &DeclEnd, ParsedAttributesWithRange &attrs, Decl **OwnedType = nullptr); Decl *ParseUsingDirective(unsigned Context, SourceLocation UsingLoc, SourceLocation &DeclEnd, ParsedAttributes &attrs); Decl *ParseUsingDeclaration(unsigned Context, const ParsedTemplateInfo &TemplateInfo, SourceLocation UsingLoc, SourceLocation &DeclEnd, AccessSpecifier AS = AS_none, Decl **OwnedType = nullptr); Decl *ParseStaticAssertDeclaration(SourceLocation &DeclEnd); Decl *ParseNamespaceAlias(SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, SourceLocation &DeclEnd); //===--------------------------------------------------------------------===// // C++ 9: classes [class] and C structs/unions. bool isValidAfterTypeSpecifier(bool CouldBeBitfield); void ParseClassSpecifier(tok::TokenKind TagTokKind, SourceLocation TagLoc, DeclSpec &DS, const ParsedTemplateInfo &TemplateInfo, AccessSpecifier AS, bool EnteringContext, DeclSpecContext DSC, ParsedAttributesWithRange &Attributes); void SkipCXXMemberSpecification(SourceLocation StartLoc, SourceLocation AttrFixitLoc, unsigned TagType, Decl *TagDecl); void ParseCXXMemberSpecification(SourceLocation StartLoc, SourceLocation AttrFixitLoc, ParsedAttributesWithRange &Attrs, unsigned TagType, Decl *TagDecl); ExprResult ParseCXXMemberInitializer(Decl *D, bool IsFunction, SourceLocation &EqualLoc); bool ParseCXXMemberDeclaratorBeforeInitializer(Declarator &DeclaratorInfo, VirtSpecifiers &VS, ExprResult &BitfieldSize, LateParsedAttrList &LateAttrs); void MaybeParseAndDiagnoseDeclSpecAfterCXX11VirtSpecifierSeq(Declarator &D, VirtSpecifiers &VS); void ParseCXXClassMemberDeclaration(AccessSpecifier AS, AttributeList *Attr, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), ParsingDeclRAIIObject *DiagsFromTParams = nullptr); void ParseConstructorInitializer(Decl *ConstructorDecl); MemInitResult ParseMemInitializer(Decl *ConstructorDecl); void HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo, Decl *ThisDecl); //===--------------------------------------------------------------------===// // C++ 10: Derived classes [class.derived] TypeResult ParseBaseTypeSpecifier(SourceLocation &BaseLoc, SourceLocation &EndLocation); void ParseBaseClause(Decl *ClassDecl); BaseResult ParseBaseSpecifier(Decl *ClassDecl); AccessSpecifier getAccessSpecifierIfPresent() const; bool ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, IdentifierInfo *Name, SourceLocation NameLoc, bool EnteringContext, ParsedType ObjectType, UnqualifiedId &Id, bool AssumeTemplateId); bool ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, ParsedType ObjectType, UnqualifiedId &Result); //===--------------------------------------------------------------------===// // OpenMP: Directives and clauses. /// \brief Parses declarative OpenMP directives. DeclGroupPtrTy ParseOpenMPDeclarativeDirective(); /// \brief Parses simple list of variables. /// /// \param Kind Kind of the directive. /// \param [out] VarList List of referenced variables. /// \param AllowScopeSpecifier true, if the variables can have fully /// qualified names. /// bool ParseOpenMPSimpleVarList(OpenMPDirectiveKind Kind, SmallVectorImpl<Expr *> &VarList, bool AllowScopeSpecifier); /// \brief Parses declarative or executable directive. /// /// \param StandAloneAllowed true if allowed stand-alone directives, /// false - otherwise /// StmtResult ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed); /// \brief Parses clause of kind \a CKind for directive of a kind \a Kind. /// /// \param DKind Kind of current directive. /// \param CKind Kind of current clause. /// \param FirstClause true, if this is the first clause of a kind \a CKind /// in current directive. /// OMPClause *ParseOpenMPClause(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, bool FirstClause); /// \brief Parses clause with a single expression of a kind \a Kind. /// /// \param Kind Kind of current clause. /// OMPClause *ParseOpenMPSingleExprClause(OpenMPClauseKind Kind); /// \brief Parses simple clause of a kind \a Kind. /// /// \param Kind Kind of current clause. /// OMPClause *ParseOpenMPSimpleClause(OpenMPClauseKind Kind); /// \brief Parses clause with a single expression and an additional argument /// of a kind \a Kind. /// /// \param Kind Kind of current clause. /// OMPClause *ParseOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind); /// \brief Parses clause without any additional arguments. /// /// \param Kind Kind of current clause. /// OMPClause *ParseOpenMPClause(OpenMPClauseKind Kind); /// \brief Parses clause with the list of variables of a kind \a Kind. /// /// \param Kind Kind of current clause. /// OMPClause *ParseOpenMPVarListClause(OpenMPClauseKind Kind); public: bool ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, bool AllowDestructorName, bool AllowConstructorName, ParsedType ObjectType, SourceLocation& TemplateKWLoc, UnqualifiedId &Result); private: //===--------------------------------------------------------------------===// // C++ 14: Templates [temp] // C++ 14.1: Template Parameters [temp.param] Decl *ParseDeclarationStartingWithTemplate(unsigned Context, SourceLocation &DeclEnd, AccessSpecifier AS = AS_none, AttributeList *AccessAttrs = nullptr); Decl *ParseTemplateDeclarationOrSpecialization(unsigned Context, SourceLocation &DeclEnd, AccessSpecifier AS, AttributeList *AccessAttrs); Decl *ParseSingleDeclarationAfterTemplate( unsigned Context, const ParsedTemplateInfo &TemplateInfo, ParsingDeclRAIIObject &DiagsFromParams, SourceLocation &DeclEnd, AccessSpecifier AS=AS_none, AttributeList *AccessAttrs = nullptr); bool ParseTemplateParameters(unsigned Depth, SmallVectorImpl<Decl*> &TemplateParams, SourceLocation &LAngleLoc, SourceLocation &RAngleLoc); bool ParseTemplateParameterList(unsigned Depth, SmallVectorImpl<Decl*> &TemplateParams); bool isStartOfTemplateTypeParameter(); Decl *ParseTemplateParameter(unsigned Depth, unsigned Position); Decl *ParseTypeParameter(unsigned Depth, unsigned Position); Decl *ParseTemplateTemplateParameter(unsigned Depth, unsigned Position); Decl *ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position); void DiagnoseMisplacedEllipsis(SourceLocation EllipsisLoc, SourceLocation CorrectLoc, bool AlreadyHasEllipsis, bool IdentifierHasName); void DiagnoseMisplacedEllipsisInDeclarator(SourceLocation EllipsisLoc, Declarator &D); // C++ 14.3: Template arguments [temp.arg] typedef SmallVector<ParsedTemplateArgument, 16> TemplateArgList; bool ParseGreaterThanInTemplateList(SourceLocation &RAngleLoc, bool ConsumeLastToken, bool ObjCGenericList); bool ParseTemplateIdAfterTemplateName(TemplateTy Template, SourceLocation TemplateNameLoc, const CXXScopeSpec &SS, bool ConsumeLastToken, SourceLocation &LAngleLoc, TemplateArgList &TemplateArgs, SourceLocation &RAngleLoc); bool AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &TemplateName, bool AllowTypeAnnotation = true); void AnnotateTemplateIdTokenAsType(); bool IsTemplateArgumentList(unsigned Skip = 0); bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs); ParsedTemplateArgument ParseTemplateTemplateArgument(); ParsedTemplateArgument ParseTemplateArgument(); Decl *ParseExplicitInstantiation(unsigned Context, SourceLocation ExternLoc, SourceLocation TemplateLoc, SourceLocation &DeclEnd, AccessSpecifier AS = AS_none); //===--------------------------------------------------------------------===// // Modules DeclGroupPtrTy ParseModuleImport(SourceLocation AtLoc); //===--------------------------------------------------------------------===// // C++11/G++: Type Traits [Type-Traits.html in the GCC manual] ExprResult ParseTypeTrait(); //===--------------------------------------------------------------------===// // Embarcadero: Arary and Expression Traits ExprResult ParseArrayTypeTrait(); ExprResult ParseExpressionTrait(); //===--------------------------------------------------------------------===// // Preprocessor code-completion pass-through void CodeCompleteDirective(bool InConditional) override; void CodeCompleteInConditionalExclusion() override; void CodeCompleteMacroName(bool IsDefinition) override; void CodeCompletePreprocessorExpression() override; void CodeCompleteMacroArgument(IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned ArgumentIndex) override; void CodeCompleteNaturalLanguage() override; }; } // end namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Parse/CMakeLists.txt
clang_tablegen(AttrParserStringSwitches.inc -gen-clang-attr-parser-string-switches -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ SOURCE ../Basic/Attr.td TARGET ClangAttrParserStringSwitches)
0
repos/DirectXShaderCompiler/tools/clang/include/clang
repos/DirectXShaderCompiler/tools/clang/include/clang/Parse/ParseHLSL.h
//===--- ParseHLSL.h - Standalone HLSL parsing -----------------*- C++ -*-===// /////////////////////////////////////////////////////////////////////////////// // // // ParseHLSL.h // // Copyright (C) Microsoft Corporation. All rights reserved. // // This file is distributed under the University of Illinois Open Source // // License. See LICENSE.TXT for details. // // // // This file defines the clang::ParseAST method. // // /////////////////////////////////////////////////////////////////////////////// #ifndef LLVM_CLANG_PARSE_PARSEHLSL_H #define LLVM_CLANG_PARSE_PARSEHLSL_H namespace llvm { class raw_ostream; } namespace hlsl { enum class DxilRootSignatureVersion; enum class DxilRootSignatureCompilationFlags; struct DxilVersionedRootSignatureDesc; class RootSignatureHandle; } // namespace hlsl namespace clang { class DiagnosticsEngine; bool ParseHLSLRootSignature(const char *pData, unsigned Len, hlsl::DxilRootSignatureVersion Ver, hlsl::DxilRootSignatureCompilationFlags Flags, hlsl::DxilVersionedRootSignatureDesc **ppDesc, clang::SourceLocation Loc, clang::DiagnosticsEngine &Diags); void ReportHLSLRootSigError(clang::DiagnosticsEngine &Diags, clang::SourceLocation Loc, const char *pData, unsigned Len); void CompileRootSignature(StringRef rootSigStr, DiagnosticsEngine &Diags, SourceLocation SLoc, hlsl::DxilRootSignatureVersion rootSigVer, hlsl::DxilRootSignatureCompilationFlags flags, hlsl::RootSignatureHandle *pRootSigHandle); } // namespace clang #endif
0
repos/DirectXShaderCompiler/tools/clang
repos/DirectXShaderCompiler/tools/clang/runtime/CMakeLists.txt
# TODO: Set the install directory. include(ExternalProject) set(known_subdirs "libcxx" ) foreach (dir ${known_subdirs}) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${dir}) endif() endforeach() function(get_ext_project_build_command out_var target) if (CMAKE_GENERATOR MATCHES "Make") # Use special command for Makefiles to support parallelism. set(${out_var} "$(MAKE)" "${target}" PARENT_SCOPE) else() set(${out_var} ${CMAKE_COMMAND} --build . --target ${target} --config $<CONFIGURATION> PARENT_SCOPE) endif() endfunction() set(COMPILER_RT_SRC_ROOT ${LLVM_MAIN_SRC_DIR}/projects/compiler-rt) if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/) if(CMAKE_GENERATOR MATCHES "Ninja") message(FATAL_ERROR "Ninja generator can't build compiler-rt as ExternalProject." "Unset LLVM_BUILD_EXTERNAL_COMPILER_RT, or don't use Ninja." "See http://www.cmake.org/Bug/view.php?id=14771") endif() # Add compiler-rt as an external project. set(COMPILER_RT_PREFIX ${CMAKE_BINARY_DIR}/projects/compiler-rt) ExternalProject_Add(compiler-rt PREFIX ${COMPILER_RT_PREFIX} SOURCE_DIR ${COMPILER_RT_SRC_ROOT} CMAKE_ARGS -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION} -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR} -DCOMPILER_RT_INSTALL_PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} -DCOMPILER_RT_ENABLE_WERROR=ON INSTALL_COMMAND "" STEP_TARGETS configure build ) # Due to a bug, DEPENDS in ExternalProject_Add doesn't work # in CMake 2.8.9 and 2.8.10. add_dependencies(compiler-rt llvm-config clang) # Add a custom step to always re-configure compiler-rt (in case some of its # sources have changed). ExternalProject_Add_Step(compiler-rt force-reconfigure DEPENDERS configure ALWAYS 1 ) ExternalProject_Add_Step(compiler-rt clobber COMMAND ${CMAKE_COMMAND} -E remove_directory <BINARY_DIR> COMMAND ${CMAKE_COMMAND} -E make_directory <BINARY_DIR> COMMENT "Clobberring compiler-rt build directory..." DEPENDERS configure DEPENDS ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang ) ExternalProject_Get_Property(compiler-rt BINARY_DIR) set(COMPILER_RT_BINARY_DIR ${BINARY_DIR}) # Add top-level targets that build specific compiler-rt runtimes. set(COMPILER_RT_RUNTIMES asan builtins dfsan lsan msan profile tsan ubsan) foreach(runtime ${COMPILER_RT_RUNTIMES}) get_ext_project_build_command(build_runtime_cmd ${runtime}) add_custom_target(${runtime} COMMAND ${build_runtime_cmd} DEPENDS compiler-rt-configure WORKING_DIRECTORY ${COMPILER_RT_BINARY_DIR} VERBATIM) endforeach() # Add binaries that compiler-rt tests depend on. set(COMPILER_RT_TEST_DEPENDENCIES FileCheck count not llvm-nm llvm-symbolizer) # Add top-level targets for various compiler-rt test suites. set(COMPILER_RT_TEST_SUITES check-asan check-asan-dynamic check-dfsan check-lsan check-msan check-sanitizer check-tsan check-ubsan) foreach(test_suite ${COMPILER_RT_TEST_SUITES}) get_ext_project_build_command(run_test_suite ${test_suite}) add_custom_target(${test_suite} COMMAND ${run_test_suite} DEPENDS compiler-rt-build ${COMPILER_RT_TEST_DEPENDENCIES} WORKING_DIRECTORY ${COMPILER_RT_BINARY_DIR} VERBATIM) endforeach() # Add special target to run all compiler-rt test suites. get_ext_project_build_command(run_check_compiler_rt check-all) add_custom_target(check-compiler-rt COMMAND ${run_check_compiler_rt} DEPENDS compiler-rt-build ${COMPILER_RT_TEST_DEPENDENCIES} WORKING_DIRECTORY ${COMPILER_RT_BINARY_DIR} VERBATIM) endif()
0
repos/DirectXShaderCompiler/tools/clang/runtime
repos/DirectXShaderCompiler/tools/clang/runtime/compiler-rt/clang_linux_test_input.c
// This file is used to check if we can produce working executables // for i386 and x86_64 archs on Linux. #include <stdlib.h> int main(){}
0
repos/DirectXShaderCompiler/tools/clang
repos/DirectXShaderCompiler/tools/clang/lib/CMakeLists.txt
# add_subdirectory(Headers) add_subdirectory(Basic) add_subdirectory(Lex) add_subdirectory(Parse) add_subdirectory(AST) add_subdirectory(ASTMatchers) add_subdirectory(Sema) add_subdirectory(CodeGen) add_subdirectory(Analysis) add_subdirectory(Edit) add_subdirectory(Rewrite) if(CLANG_ENABLE_ARCMT) add_subdirectory(ARCMigrate) endif() add_subdirectory(Driver) # add_subdirectory(Serialization) # HLSL Change add_subdirectory(Frontend) add_subdirectory(FrontendTool) add_subdirectory(Tooling) add_subdirectory(Index) if(CLANG_ENABLE_STATIC_ANALYZER) add_subdirectory(StaticAnalyzer) endif() add_subdirectory(Format) # SPIRV change starts if (ENABLE_SPIRV_CODEGEN) add_subdirectory(SPIRV) endif (ENABLE_SPIRV_CODEGEN) # SPIRV change ends
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
//===--- RewriteObjCFoundationAPI.cpp - Foundation API Rewriter -----------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Rewrites legacy method calls to modern syntax. // //===----------------------------------------------------------------------===// #include "clang/Edit/Rewriters.h" #include "clang/AST/ASTContext.h" #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" #include "clang/AST/NSAPI.h" #include "clang/AST/ParentMap.h" #include "clang/Edit/Commit.h" #include "clang/Lex/Lexer.h" using namespace clang; using namespace edit; static bool checkForLiteralCreation(const ObjCMessageExpr *Msg, IdentifierInfo *&ClassId, const LangOptions &LangOpts) { if (!Msg || Msg->isImplicit() || !Msg->getMethodDecl()) return false; const ObjCInterfaceDecl *Receiver = Msg->getReceiverInterface(); if (!Receiver) return false; ClassId = Receiver->getIdentifier(); if (Msg->getReceiverKind() == ObjCMessageExpr::Class) return true; // When in ARC mode we also convert "[[.. alloc] init]" messages to literals, // since the change from +1 to +0 will be handled fine by ARC. if (LangOpts.ObjCAutoRefCount) { if (Msg->getReceiverKind() == ObjCMessageExpr::Instance) { if (const ObjCMessageExpr *Rec = dyn_cast<ObjCMessageExpr>( Msg->getInstanceReceiver()->IgnoreParenImpCasts())) { if (Rec->getMethodFamily() == OMF_alloc) return true; } } } return false; } //===----------------------------------------------------------------------===// // rewriteObjCRedundantCallWithLiteral. //===----------------------------------------------------------------------===// bool edit::rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { IdentifierInfo *II = nullptr; if (!checkForLiteralCreation(Msg, II, NS.getASTContext().getLangOpts())) return false; if (Msg->getNumArgs() != 1) return false; const Expr *Arg = Msg->getArg(0)->IgnoreParenImpCasts(); Selector Sel = Msg->getSelector(); if ((isa<ObjCStringLiteral>(Arg) && NS.getNSClassId(NSAPI::ClassId_NSString) == II && (NS.getNSStringSelector(NSAPI::NSStr_stringWithString) == Sel || NS.getNSStringSelector(NSAPI::NSStr_initWithString) == Sel)) || (isa<ObjCArrayLiteral>(Arg) && NS.getNSClassId(NSAPI::ClassId_NSArray) == II && (NS.getNSArraySelector(NSAPI::NSArr_arrayWithArray) == Sel || NS.getNSArraySelector(NSAPI::NSArr_initWithArray) == Sel)) || (isa<ObjCDictionaryLiteral>(Arg) && NS.getNSClassId(NSAPI::ClassId_NSDictionary) == II && (NS.getNSDictionarySelector( NSAPI::NSDict_dictionaryWithDictionary) == Sel || NS.getNSDictionarySelector(NSAPI::NSDict_initWithDictionary) == Sel))) { commit.replaceWithInner(Msg->getSourceRange(), Msg->getArg(0)->getSourceRange()); return true; } return false; } //===----------------------------------------------------------------------===// // rewriteToObjCSubscriptSyntax. //===----------------------------------------------------------------------===// /// \brief Check for classes that accept 'objectForKey:' (or the other selectors /// that the migrator handles) but return their instances as 'id', resulting /// in the compiler resolving 'objectForKey:' as the method from NSDictionary. /// /// When checking if we can convert to subscripting syntax, check whether /// the receiver is a result of a class method from a hardcoded list of /// such classes. In such a case return the specific class as the interface /// of the receiver. /// /// FIXME: Remove this when these classes start using 'instancetype'. static const ObjCInterfaceDecl * maybeAdjustInterfaceForSubscriptingCheck(const ObjCInterfaceDecl *IFace, const Expr *Receiver, ASTContext &Ctx) { assert(IFace && Receiver); // If the receiver has type 'id'... if (!Ctx.isObjCIdType(Receiver->getType().getUnqualifiedType())) return IFace; const ObjCMessageExpr * InnerMsg = dyn_cast<ObjCMessageExpr>(Receiver->IgnoreParenCasts()); if (!InnerMsg) return IFace; QualType ClassRec; switch (InnerMsg->getReceiverKind()) { case ObjCMessageExpr::Instance: case ObjCMessageExpr::SuperInstance: return IFace; case ObjCMessageExpr::Class: ClassRec = InnerMsg->getClassReceiver(); break; case ObjCMessageExpr::SuperClass: ClassRec = InnerMsg->getSuperType(); break; } if (ClassRec.isNull()) return IFace; // ...and it is the result of a class message... const ObjCObjectType *ObjTy = ClassRec->getAs<ObjCObjectType>(); if (!ObjTy) return IFace; const ObjCInterfaceDecl *OID = ObjTy->getInterface(); // ...and the receiving class is NSMapTable or NSLocale, return that // class as the receiving interface. if (OID->getName() == "NSMapTable" || OID->getName() == "NSLocale") return OID; return IFace; } static bool canRewriteToSubscriptSyntax(const ObjCInterfaceDecl *&IFace, const ObjCMessageExpr *Msg, ASTContext &Ctx, Selector subscriptSel) { const Expr *Rec = Msg->getInstanceReceiver(); if (!Rec) return false; IFace = maybeAdjustInterfaceForSubscriptingCheck(IFace, Rec, Ctx); if (const ObjCMethodDecl *MD = IFace->lookupInstanceMethod(subscriptSel)) { if (!MD->isUnavailable()) return true; } return false; } static bool subscriptOperatorNeedsParens(const Expr *FullExpr); static void maybePutParensOnReceiver(const Expr *Receiver, Commit &commit) { if (subscriptOperatorNeedsParens(Receiver)) { SourceRange RecRange = Receiver->getSourceRange(); commit.insertWrap("(", RecRange, ")"); } } static bool rewriteToSubscriptGetCommon(const ObjCMessageExpr *Msg, Commit &commit) { if (Msg->getNumArgs() != 1) return false; const Expr *Rec = Msg->getInstanceReceiver(); if (!Rec) return false; SourceRange MsgRange = Msg->getSourceRange(); SourceRange RecRange = Rec->getSourceRange(); SourceRange ArgRange = Msg->getArg(0)->getSourceRange(); commit.replaceWithInner(CharSourceRange::getCharRange(MsgRange.getBegin(), ArgRange.getBegin()), CharSourceRange::getTokenRange(RecRange)); commit.replaceWithInner(SourceRange(ArgRange.getBegin(), MsgRange.getEnd()), ArgRange); commit.insertWrap("[", ArgRange, "]"); maybePutParensOnReceiver(Rec, commit); return true; } static bool rewriteToArraySubscriptGet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { if (!canRewriteToSubscriptSyntax(IFace, Msg, NS.getASTContext(), NS.getObjectAtIndexedSubscriptSelector())) return false; return rewriteToSubscriptGetCommon(Msg, commit); } static bool rewriteToDictionarySubscriptGet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { if (!canRewriteToSubscriptSyntax(IFace, Msg, NS.getASTContext(), NS.getObjectForKeyedSubscriptSelector())) return false; return rewriteToSubscriptGetCommon(Msg, commit); } static bool rewriteToArraySubscriptSet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { if (!canRewriteToSubscriptSyntax(IFace, Msg, NS.getASTContext(), NS.getSetObjectAtIndexedSubscriptSelector())) return false; if (Msg->getNumArgs() != 2) return false; const Expr *Rec = Msg->getInstanceReceiver(); if (!Rec) return false; SourceRange MsgRange = Msg->getSourceRange(); SourceRange RecRange = Rec->getSourceRange(); SourceRange Arg0Range = Msg->getArg(0)->getSourceRange(); SourceRange Arg1Range = Msg->getArg(1)->getSourceRange(); commit.replaceWithInner(CharSourceRange::getCharRange(MsgRange.getBegin(), Arg0Range.getBegin()), CharSourceRange::getTokenRange(RecRange)); commit.replaceWithInner(CharSourceRange::getCharRange(Arg0Range.getBegin(), Arg1Range.getBegin()), CharSourceRange::getTokenRange(Arg0Range)); commit.replaceWithInner(SourceRange(Arg1Range.getBegin(), MsgRange.getEnd()), Arg1Range); commit.insertWrap("[", CharSourceRange::getCharRange(Arg0Range.getBegin(), Arg1Range.getBegin()), "] = "); maybePutParensOnReceiver(Rec, commit); return true; } static bool rewriteToDictionarySubscriptSet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { if (!canRewriteToSubscriptSyntax(IFace, Msg, NS.getASTContext(), NS.getSetObjectForKeyedSubscriptSelector())) return false; if (Msg->getNumArgs() != 2) return false; const Expr *Rec = Msg->getInstanceReceiver(); if (!Rec) return false; SourceRange MsgRange = Msg->getSourceRange(); SourceRange RecRange = Rec->getSourceRange(); SourceRange Arg0Range = Msg->getArg(0)->getSourceRange(); SourceRange Arg1Range = Msg->getArg(1)->getSourceRange(); SourceLocation LocBeforeVal = Arg0Range.getBegin(); commit.insertBefore(LocBeforeVal, "] = "); commit.insertFromRange(LocBeforeVal, Arg1Range, /*afterToken=*/false, /*beforePreviousInsertions=*/true); commit.insertBefore(LocBeforeVal, "["); commit.replaceWithInner(CharSourceRange::getCharRange(MsgRange.getBegin(), Arg0Range.getBegin()), CharSourceRange::getTokenRange(RecRange)); commit.replaceWithInner(SourceRange(Arg0Range.getBegin(), MsgRange.getEnd()), Arg0Range); maybePutParensOnReceiver(Rec, commit); return true; } bool edit::rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { if (!Msg || Msg->isImplicit() || Msg->getReceiverKind() != ObjCMessageExpr::Instance) return false; const ObjCMethodDecl *Method = Msg->getMethodDecl(); if (!Method) return false; const ObjCInterfaceDecl *IFace = NS.getASTContext().getObjContainingInterface(Method); if (!IFace) return false; Selector Sel = Msg->getSelector(); if (Sel == NS.getNSArraySelector(NSAPI::NSArr_objectAtIndex)) return rewriteToArraySubscriptGet(IFace, Msg, NS, commit); if (Sel == NS.getNSDictionarySelector(NSAPI::NSDict_objectForKey)) return rewriteToDictionarySubscriptGet(IFace, Msg, NS, commit); if (Msg->getNumArgs() != 2) return false; if (Sel == NS.getNSArraySelector(NSAPI::NSMutableArr_replaceObjectAtIndex)) return rewriteToArraySubscriptSet(IFace, Msg, NS, commit); if (Sel == NS.getNSDictionarySelector(NSAPI::NSMutableDict_setObjectForKey)) return rewriteToDictionarySubscriptSet(IFace, Msg, NS, commit); return false; } //===----------------------------------------------------------------------===// // rewriteToObjCLiteralSyntax. //===----------------------------------------------------------------------===// static bool rewriteToArrayLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit, const ParentMap *PMap); static bool rewriteToDictionaryLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit); static bool rewriteToNumberLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit); static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit); static bool rewriteToStringBoxedExpression(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit); bool edit::rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit, const ParentMap *PMap) { IdentifierInfo *II = nullptr; if (!checkForLiteralCreation(Msg, II, NS.getASTContext().getLangOpts())) return false; if (II == NS.getNSClassId(NSAPI::ClassId_NSArray)) return rewriteToArrayLiteral(Msg, NS, commit, PMap); if (II == NS.getNSClassId(NSAPI::ClassId_NSDictionary)) return rewriteToDictionaryLiteral(Msg, NS, commit); if (II == NS.getNSClassId(NSAPI::ClassId_NSNumber)) return rewriteToNumberLiteral(Msg, NS, commit); if (II == NS.getNSClassId(NSAPI::ClassId_NSString)) return rewriteToStringBoxedExpression(Msg, NS, commit); return false; } /// \brief Returns true if the immediate message arguments of \c Msg should not /// be rewritten because it will interfere with the rewrite of the parent /// message expression. e.g. /// \code /// [NSDictionary dictionaryWithObjects: /// [NSArray arrayWithObjects:@"1", @"2", nil] /// forKeys:[NSArray arrayWithObjects:@"A", @"B", nil]]; /// \endcode /// It will return true for this because we are going to rewrite this directly /// to a dictionary literal without any array literals. static bool shouldNotRewriteImmediateMessageArgs(const ObjCMessageExpr *Msg, const NSAPI &NS); //===----------------------------------------------------------------------===// // rewriteToArrayLiteral. //===----------------------------------------------------------------------===// /// \brief Adds an explicit cast to 'id' if the type is not objc object. static void objectifyExpr(const Expr *E, Commit &commit); static bool rewriteToArrayLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit, const ParentMap *PMap) { if (PMap) { const ObjCMessageExpr *ParentMsg = dyn_cast_or_null<ObjCMessageExpr>(PMap->getParentIgnoreParenCasts(Msg)); if (shouldNotRewriteImmediateMessageArgs(ParentMsg, NS)) return false; } Selector Sel = Msg->getSelector(); SourceRange MsgRange = Msg->getSourceRange(); if (Sel == NS.getNSArraySelector(NSAPI::NSArr_array)) { if (Msg->getNumArgs() != 0) return false; commit.replace(MsgRange, "@[]"); return true; } if (Sel == NS.getNSArraySelector(NSAPI::NSArr_arrayWithObject)) { if (Msg->getNumArgs() != 1) return false; objectifyExpr(Msg->getArg(0), commit); SourceRange ArgRange = Msg->getArg(0)->getSourceRange(); commit.replaceWithInner(MsgRange, ArgRange); commit.insertWrap("@[", ArgRange, "]"); return true; } if (Sel == NS.getNSArraySelector(NSAPI::NSArr_arrayWithObjects) || Sel == NS.getNSArraySelector(NSAPI::NSArr_initWithObjects)) { if (Msg->getNumArgs() == 0) return false; const Expr *SentinelExpr = Msg->getArg(Msg->getNumArgs() - 1); if (!NS.getASTContext().isSentinelNullExpr(SentinelExpr)) return false; for (unsigned i = 0, e = Msg->getNumArgs() - 1; i != e; ++i) objectifyExpr(Msg->getArg(i), commit); if (Msg->getNumArgs() == 1) { commit.replace(MsgRange, "@[]"); return true; } SourceRange ArgRange(Msg->getArg(0)->getLocStart(), Msg->getArg(Msg->getNumArgs()-2)->getLocEnd()); commit.replaceWithInner(MsgRange, ArgRange); commit.insertWrap("@[", ArgRange, "]"); return true; } return false; } //===----------------------------------------------------------------------===// // rewriteToDictionaryLiteral. //===----------------------------------------------------------------------===// /// \brief If \c Msg is an NSArray creation message or literal, this gets the /// objects that were used to create it. /// \returns true if it is an NSArray and we got objects, or false otherwise. static bool getNSArrayObjects(const Expr *E, const NSAPI &NS, SmallVectorImpl<const Expr *> &Objs) { if (!E) return false; E = E->IgnoreParenCasts(); if (!E) return false; if (const ObjCMessageExpr *Msg = dyn_cast<ObjCMessageExpr>(E)) { IdentifierInfo *Cls = nullptr; if (!checkForLiteralCreation(Msg, Cls, NS.getASTContext().getLangOpts())) return false; if (Cls != NS.getNSClassId(NSAPI::ClassId_NSArray)) return false; Selector Sel = Msg->getSelector(); if (Sel == NS.getNSArraySelector(NSAPI::NSArr_array)) return true; // empty array. if (Sel == NS.getNSArraySelector(NSAPI::NSArr_arrayWithObject)) { if (Msg->getNumArgs() != 1) return false; Objs.push_back(Msg->getArg(0)); return true; } if (Sel == NS.getNSArraySelector(NSAPI::NSArr_arrayWithObjects) || Sel == NS.getNSArraySelector(NSAPI::NSArr_initWithObjects)) { if (Msg->getNumArgs() == 0) return false; const Expr *SentinelExpr = Msg->getArg(Msg->getNumArgs() - 1); if (!NS.getASTContext().isSentinelNullExpr(SentinelExpr)) return false; for (unsigned i = 0, e = Msg->getNumArgs() - 1; i != e; ++i) Objs.push_back(Msg->getArg(i)); return true; } } else if (const ObjCArrayLiteral *ArrLit = dyn_cast<ObjCArrayLiteral>(E)) { for (unsigned i = 0, e = ArrLit->getNumElements(); i != e; ++i) Objs.push_back(ArrLit->getElement(i)); return true; } return false; } static bool rewriteToDictionaryLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { Selector Sel = Msg->getSelector(); SourceRange MsgRange = Msg->getSourceRange(); if (Sel == NS.getNSDictionarySelector(NSAPI::NSDict_dictionary)) { if (Msg->getNumArgs() != 0) return false; commit.replace(MsgRange, "@{}"); return true; } if (Sel == NS.getNSDictionarySelector( NSAPI::NSDict_dictionaryWithObjectForKey)) { if (Msg->getNumArgs() != 2) return false; objectifyExpr(Msg->getArg(0), commit); objectifyExpr(Msg->getArg(1), commit); SourceRange ValRange = Msg->getArg(0)->getSourceRange(); SourceRange KeyRange = Msg->getArg(1)->getSourceRange(); // Insert key before the value. commit.insertBefore(ValRange.getBegin(), ": "); commit.insertFromRange(ValRange.getBegin(), CharSourceRange::getTokenRange(KeyRange), /*afterToken=*/false, /*beforePreviousInsertions=*/true); commit.insertBefore(ValRange.getBegin(), "@{"); commit.insertAfterToken(ValRange.getEnd(), "}"); commit.replaceWithInner(MsgRange, ValRange); return true; } if (Sel == NS.getNSDictionarySelector( NSAPI::NSDict_dictionaryWithObjectsAndKeys) || Sel == NS.getNSDictionarySelector(NSAPI::NSDict_initWithObjectsAndKeys)) { if (Msg->getNumArgs() % 2 != 1) return false; unsigned SentinelIdx = Msg->getNumArgs() - 1; const Expr *SentinelExpr = Msg->getArg(SentinelIdx); if (!NS.getASTContext().isSentinelNullExpr(SentinelExpr)) return false; if (Msg->getNumArgs() == 1) { commit.replace(MsgRange, "@{}"); return true; } for (unsigned i = 0; i < SentinelIdx; i += 2) { objectifyExpr(Msg->getArg(i), commit); objectifyExpr(Msg->getArg(i+1), commit); SourceRange ValRange = Msg->getArg(i)->getSourceRange(); SourceRange KeyRange = Msg->getArg(i+1)->getSourceRange(); // Insert value after key. commit.insertAfterToken(KeyRange.getEnd(), ": "); commit.insertFromRange(KeyRange.getEnd(), ValRange, /*afterToken=*/true); commit.remove(CharSourceRange::getCharRange(ValRange.getBegin(), KeyRange.getBegin())); } // Range of arguments up until and including the last key. // The sentinel and first value are cut off, the value will move after the // key. SourceRange ArgRange(Msg->getArg(1)->getLocStart(), Msg->getArg(SentinelIdx-1)->getLocEnd()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); return true; } if (Sel == NS.getNSDictionarySelector( NSAPI::NSDict_dictionaryWithObjectsForKeys) || Sel == NS.getNSDictionarySelector(NSAPI::NSDict_initWithObjectsForKeys)) { if (Msg->getNumArgs() != 2) return false; SmallVector<const Expr *, 8> Vals; if (!getNSArrayObjects(Msg->getArg(0), NS, Vals)) return false; SmallVector<const Expr *, 8> Keys; if (!getNSArrayObjects(Msg->getArg(1), NS, Keys)) return false; if (Vals.size() != Keys.size()) return false; if (Vals.empty()) { commit.replace(MsgRange, "@{}"); return true; } for (unsigned i = 0, n = Vals.size(); i < n; ++i) { objectifyExpr(Vals[i], commit); objectifyExpr(Keys[i], commit); SourceRange ValRange = Vals[i]->getSourceRange(); SourceRange KeyRange = Keys[i]->getSourceRange(); // Insert value after key. commit.insertAfterToken(KeyRange.getEnd(), ": "); commit.insertFromRange(KeyRange.getEnd(), ValRange, /*afterToken=*/true); } // Range of arguments up until and including the last key. // The first value is cut off, the value will move after the key. SourceRange ArgRange(Keys.front()->getLocStart(), Keys.back()->getLocEnd()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); return true; } return false; } static bool shouldNotRewriteImmediateMessageArgs(const ObjCMessageExpr *Msg, const NSAPI &NS) { if (!Msg) return false; IdentifierInfo *II = nullptr; if (!checkForLiteralCreation(Msg, II, NS.getASTContext().getLangOpts())) return false; if (II != NS.getNSClassId(NSAPI::ClassId_NSDictionary)) return false; Selector Sel = Msg->getSelector(); if (Sel == NS.getNSDictionarySelector( NSAPI::NSDict_dictionaryWithObjectsForKeys) || Sel == NS.getNSDictionarySelector(NSAPI::NSDict_initWithObjectsForKeys)) { if (Msg->getNumArgs() != 2) return false; SmallVector<const Expr *, 8> Vals; if (!getNSArrayObjects(Msg->getArg(0), NS, Vals)) return false; SmallVector<const Expr *, 8> Keys; if (!getNSArrayObjects(Msg->getArg(1), NS, Keys)) return false; if (Vals.size() != Keys.size()) return false; return true; } return false; } //===----------------------------------------------------------------------===// // rewriteToNumberLiteral. //===----------------------------------------------------------------------===// static bool rewriteToCharLiteral(const ObjCMessageExpr *Msg, const CharacterLiteral *Arg, const NSAPI &NS, Commit &commit) { if (Arg->getKind() != CharacterLiteral::Ascii) return false; if (NS.isNSNumberLiteralSelector(NSAPI::NSNumberWithChar, Msg->getSelector())) { SourceRange ArgRange = Arg->getSourceRange(); commit.replaceWithInner(Msg->getSourceRange(), ArgRange); commit.insert(ArgRange.getBegin(), "@"); return true; } return rewriteToNumericBoxedExpression(Msg, NS, commit); } static bool rewriteToBoolLiteral(const ObjCMessageExpr *Msg, const Expr *Arg, const NSAPI &NS, Commit &commit) { if (NS.isNSNumberLiteralSelector(NSAPI::NSNumberWithBool, Msg->getSelector())) { SourceRange ArgRange = Arg->getSourceRange(); commit.replaceWithInner(Msg->getSourceRange(), ArgRange); commit.insert(ArgRange.getBegin(), "@"); return true; } return rewriteToNumericBoxedExpression(Msg, NS, commit); } namespace { struct LiteralInfo { bool Hex, Octal; StringRef U, F, L, LL; CharSourceRange WithoutSuffRange; }; } static bool getLiteralInfo(SourceRange literalRange, bool isFloat, bool isIntZero, ASTContext &Ctx, LiteralInfo &Info) { if (literalRange.getBegin().isMacroID() || literalRange.getEnd().isMacroID()) return false; StringRef text = Lexer::getSourceText( CharSourceRange::getTokenRange(literalRange), Ctx.getSourceManager(), Ctx.getLangOpts()); if (text.empty()) return false; Optional<bool> UpperU, UpperL; bool UpperF = false; struct Suff { static bool has(StringRef suff, StringRef &text) { if (text.endswith(suff)) { text = text.substr(0, text.size()-suff.size()); return true; } return false; } }; while (1) { if (Suff::has("u", text)) { UpperU = false; } else if (Suff::has("U", text)) { UpperU = true; } else if (Suff::has("ll", text)) { UpperL = false; } else if (Suff::has("LL", text)) { UpperL = true; } else if (Suff::has("l", text)) { UpperL = false; } else if (Suff::has("L", text)) { UpperL = true; } else if (isFloat && Suff::has("f", text)) { UpperF = false; } else if (isFloat && Suff::has("F", text)) { UpperF = true; } else break; } if (!UpperU.hasValue() && !UpperL.hasValue()) UpperU = UpperL = true; else if (UpperU.hasValue() && !UpperL.hasValue()) UpperL = UpperU; else if (UpperL.hasValue() && !UpperU.hasValue()) UpperU = UpperL; Info.U = *UpperU ? "U" : "u"; Info.L = *UpperL ? "L" : "l"; Info.LL = *UpperL ? "LL" : "ll"; Info.F = UpperF ? "F" : "f"; Info.Hex = Info.Octal = false; if (text.startswith("0x")) Info.Hex = true; else if (!isFloat && !isIntZero && text.startswith("0")) Info.Octal = true; SourceLocation B = literalRange.getBegin(); Info.WithoutSuffRange = CharSourceRange::getCharRange(B, B.getLocWithOffset(text.size())); return true; } static bool rewriteToNumberLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { if (Msg->getNumArgs() != 1) return false; const Expr *Arg = Msg->getArg(0)->IgnoreParenImpCasts(); if (const CharacterLiteral *CharE = dyn_cast<CharacterLiteral>(Arg)) return rewriteToCharLiteral(Msg, CharE, NS, commit); if (const ObjCBoolLiteralExpr *BE = dyn_cast<ObjCBoolLiteralExpr>(Arg)) return rewriteToBoolLiteral(Msg, BE, NS, commit); if (const CXXBoolLiteralExpr *BE = dyn_cast<CXXBoolLiteralExpr>(Arg)) return rewriteToBoolLiteral(Msg, BE, NS, commit); const Expr *literalE = Arg; if (const UnaryOperator *UOE = dyn_cast<UnaryOperator>(literalE)) { if (UOE->getOpcode() == UO_Plus || UOE->getOpcode() == UO_Minus) literalE = UOE->getSubExpr(); } // Only integer and floating literals, otherwise try to rewrite to boxed // expression. if (!isa<IntegerLiteral>(literalE) && !isa<FloatingLiteral>(literalE)) return rewriteToNumericBoxedExpression(Msg, NS, commit); ASTContext &Ctx = NS.getASTContext(); Selector Sel = Msg->getSelector(); Optional<NSAPI::NSNumberLiteralMethodKind> MKOpt = NS.getNSNumberLiteralMethodKind(Sel); if (!MKOpt) return false; NSAPI::NSNumberLiteralMethodKind MK = *MKOpt; bool CallIsUnsigned = false, CallIsLong = false, CallIsLongLong = false; bool CallIsFloating = false, CallIsDouble = false; switch (MK) { // We cannot have these calls with int/float literals. case NSAPI::NSNumberWithChar: case NSAPI::NSNumberWithUnsignedChar: case NSAPI::NSNumberWithShort: case NSAPI::NSNumberWithUnsignedShort: case NSAPI::NSNumberWithBool: return rewriteToNumericBoxedExpression(Msg, NS, commit); case NSAPI::NSNumberWithUnsignedInt: case NSAPI::NSNumberWithUnsignedInteger: CallIsUnsigned = true; case NSAPI::NSNumberWithInt: case NSAPI::NSNumberWithInteger: break; case NSAPI::NSNumberWithUnsignedLong: CallIsUnsigned = true; case NSAPI::NSNumberWithLong: CallIsLong = true; break; case NSAPI::NSNumberWithUnsignedLongLong: CallIsUnsigned = true; case NSAPI::NSNumberWithLongLong: CallIsLongLong = true; break; case NSAPI::NSNumberWithDouble: CallIsDouble = true; case NSAPI::NSNumberWithFloat: CallIsFloating = true; break; } SourceRange ArgRange = Arg->getSourceRange(); QualType ArgTy = Arg->getType(); QualType CallTy = Msg->getArg(0)->getType(); // Check for the easy case, the literal maps directly to the call. if (Ctx.hasSameType(ArgTy, CallTy)) { commit.replaceWithInner(Msg->getSourceRange(), ArgRange); commit.insert(ArgRange.getBegin(), "@"); return true; } // We will need to modify the literal suffix to get the same type as the call. // Try with boxed expression if it came from a macro. if (ArgRange.getBegin().isMacroID()) return rewriteToNumericBoxedExpression(Msg, NS, commit); bool LitIsFloat = ArgTy->isFloatingType(); // For a float passed to integer call, don't try rewriting to objc literal. // It is difficult and a very uncommon case anyway. // But try with boxed expression. if (LitIsFloat && !CallIsFloating) return rewriteToNumericBoxedExpression(Msg, NS, commit); // Try to modify the literal make it the same type as the method call. // -Modify the suffix, and/or // -Change integer to float LiteralInfo LitInfo; bool isIntZero = false; if (const IntegerLiteral *IntE = dyn_cast<IntegerLiteral>(literalE)) isIntZero = !IntE->getValue().getBoolValue(); if (!getLiteralInfo(ArgRange, LitIsFloat, isIntZero, Ctx, LitInfo)) return rewriteToNumericBoxedExpression(Msg, NS, commit); // Not easy to do int -> float with hex/octal and uncommon anyway. if (!LitIsFloat && CallIsFloating && (LitInfo.Hex || LitInfo.Octal)) return rewriteToNumericBoxedExpression(Msg, NS, commit); SourceLocation LitB = LitInfo.WithoutSuffRange.getBegin(); SourceLocation LitE = LitInfo.WithoutSuffRange.getEnd(); commit.replaceWithInner(CharSourceRange::getTokenRange(Msg->getSourceRange()), LitInfo.WithoutSuffRange); commit.insert(LitB, "@"); if (!LitIsFloat && CallIsFloating) commit.insert(LitE, ".0"); if (CallIsFloating) { if (!CallIsDouble) commit.insert(LitE, LitInfo.F); } else { if (CallIsUnsigned) commit.insert(LitE, LitInfo.U); if (CallIsLong) commit.insert(LitE, LitInfo.L); else if (CallIsLongLong) commit.insert(LitE, LitInfo.LL); } return true; } // FIXME: Make determination of operator precedence more general and // make it broadly available. static bool subscriptOperatorNeedsParens(const Expr *FullExpr) { const Expr* Expr = FullExpr->IgnoreImpCasts(); if (isa<ArraySubscriptExpr>(Expr) || isa<CallExpr>(Expr) || isa<DeclRefExpr>(Expr) || isa<CXXNamedCastExpr>(Expr) || isa<CXXConstructExpr>(Expr) || isa<CXXThisExpr>(Expr) || isa<CXXTypeidExpr>(Expr) || isa<CXXUnresolvedConstructExpr>(Expr) || isa<ObjCMessageExpr>(Expr) || isa<ObjCPropertyRefExpr>(Expr) || isa<ObjCProtocolExpr>(Expr) || isa<MemberExpr>(Expr) || isa<ObjCIvarRefExpr>(Expr) || isa<ParenExpr>(FullExpr) || isa<ParenListExpr>(Expr) || isa<SizeOfPackExpr>(Expr)) return false; return true; } static bool castOperatorNeedsParens(const Expr *FullExpr) { const Expr* Expr = FullExpr->IgnoreImpCasts(); if (isa<ArraySubscriptExpr>(Expr) || isa<CallExpr>(Expr) || isa<DeclRefExpr>(Expr) || isa<CastExpr>(Expr) || isa<CXXNewExpr>(Expr) || isa<CXXConstructExpr>(Expr) || isa<CXXDeleteExpr>(Expr) || isa<CXXNoexceptExpr>(Expr) || isa<CXXPseudoDestructorExpr>(Expr) || isa<CXXScalarValueInitExpr>(Expr) || isa<CXXThisExpr>(Expr) || isa<CXXTypeidExpr>(Expr) || isa<CXXUnresolvedConstructExpr>(Expr) || isa<ObjCMessageExpr>(Expr) || isa<ObjCPropertyRefExpr>(Expr) || isa<ObjCProtocolExpr>(Expr) || isa<MemberExpr>(Expr) || isa<ObjCIvarRefExpr>(Expr) || isa<ParenExpr>(FullExpr) || isa<ParenListExpr>(Expr) || isa<SizeOfPackExpr>(Expr) || isa<UnaryOperator>(Expr)) return false; return true; } static void objectifyExpr(const Expr *E, Commit &commit) { if (!E) return; QualType T = E->getType(); if (T->isObjCObjectPointerType()) { if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) { if (ICE->getCastKind() != CK_CPointerToObjCPointerCast) return; } else { return; } } else if (!T->isPointerType()) { return; } SourceRange Range = E->getSourceRange(); if (castOperatorNeedsParens(E)) commit.insertWrap("(", Range, ")"); commit.insertBefore(Range.getBegin(), "(id)"); } //===----------------------------------------------------------------------===// // rewriteToNumericBoxedExpression. //===----------------------------------------------------------------------===// static bool isEnumConstant(const Expr *E) { if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) if (const ValueDecl *VD = DRE->getDecl()) return isa<EnumConstantDecl>(VD); return false; } static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { if (Msg->getNumArgs() != 1) return false; const Expr *Arg = Msg->getArg(0); if (Arg->isTypeDependent()) return false; ASTContext &Ctx = NS.getASTContext(); Selector Sel = Msg->getSelector(); Optional<NSAPI::NSNumberLiteralMethodKind> MKOpt = NS.getNSNumberLiteralMethodKind(Sel); if (!MKOpt) return false; NSAPI::NSNumberLiteralMethodKind MK = *MKOpt; const Expr *OrigArg = Arg->IgnoreImpCasts(); QualType FinalTy = Arg->getType(); QualType OrigTy = OrigArg->getType(); uint64_t FinalTySize = Ctx.getTypeSize(FinalTy); uint64_t OrigTySize = Ctx.getTypeSize(OrigTy); bool isTruncated = FinalTySize < OrigTySize; bool needsCast = false; if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) { switch (ICE->getCastKind()) { case CK_LValueToRValue: case CK_NoOp: case CK_UserDefinedConversion: break; case CK_IntegralCast: { if (MK == NSAPI::NSNumberWithBool && OrigTy->isBooleanType()) break; // Be more liberal with Integer/UnsignedInteger which are very commonly // used. if ((MK == NSAPI::NSNumberWithInteger || MK == NSAPI::NSNumberWithUnsignedInteger) && !isTruncated) { if (OrigTy->getAs<EnumType>() || isEnumConstant(OrigArg)) break; if ((MK==NSAPI::NSNumberWithInteger) == OrigTy->isSignedIntegerType() && OrigTySize >= Ctx.getTypeSize(Ctx.IntTy)) break; } needsCast = true; break; } case CK_PointerToBoolean: case CK_IntegralToBoolean: case CK_IntegralToFloating: case CK_FloatingToIntegral: case CK_FloatingToBoolean: case CK_FloatingCast: case CK_FloatingComplexToReal: case CK_FloatingComplexToBoolean: case CK_IntegralComplexToReal: case CK_IntegralComplexToBoolean: case CK_AtomicToNonAtomic: case CK_AddressSpaceConversion: needsCast = true; break; case CK_Dependent: case CK_BitCast: case CK_LValueBitCast: case CK_BaseToDerived: case CK_DerivedToBase: case CK_UncheckedDerivedToBase: case CK_Dynamic: case CK_ToUnion: case CK_ArrayToPointerDecay: case CK_FunctionToPointerDecay: case CK_NullToPointer: case CK_NullToMemberPointer: case CK_BaseToDerivedMemberPointer: case CK_DerivedToBaseMemberPointer: case CK_MemberPointerToBoolean: case CK_ReinterpretMemberPointer: case CK_ConstructorConversion: case CK_IntegralToPointer: case CK_PointerToIntegral: case CK_ToVoid: case CK_VectorSplat: case CK_CPointerToObjCPointerCast: case CK_BlockPointerToObjCPointerCast: case CK_AnyPointerToBlockPointerCast: case CK_ObjCObjectLValueCast: case CK_FloatingRealToComplex: case CK_FloatingComplexCast: case CK_FloatingComplexToIntegralComplex: case CK_IntegralRealToComplex: case CK_IntegralComplexCast: case CK_IntegralComplexToFloatingComplex: case CK_ARCProduceObject: case CK_ARCConsumeObject: case CK_ARCReclaimReturnedObject: case CK_ARCExtendBlockObject: case CK_NonAtomicToAtomic: case CK_CopyAndAutoreleaseBlockObject: case CK_BuiltinFnToFnPtr: case CK_ZeroToOCLEvent: return false; } } if (needsCast) { DiagnosticsEngine &Diags = Ctx.getDiagnostics(); // FIXME: Use a custom category name to distinguish migration diagnostics. unsigned diagID = Diags.getCustomDiagID(DiagnosticsEngine::Warning, "converting to boxing syntax requires casting %0 to %1"); Diags.Report(Msg->getExprLoc(), diagID) << OrigTy << FinalTy << Msg->getSourceRange(); return false; } SourceRange ArgRange = OrigArg->getSourceRange(); commit.replaceWithInner(Msg->getSourceRange(), ArgRange); if (isa<ParenExpr>(OrigArg) || isa<IntegerLiteral>(OrigArg)) commit.insertBefore(ArgRange.getBegin(), "@"); else commit.insertWrap("@(", ArgRange, ")"); return true; } //===----------------------------------------------------------------------===// // rewriteToStringBoxedExpression. //===----------------------------------------------------------------------===// static bool doRewriteToUTF8StringBoxedExpressionHelper( const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { const Expr *Arg = Msg->getArg(0); if (Arg->isTypeDependent()) return false; ASTContext &Ctx = NS.getASTContext(); const Expr *OrigArg = Arg->IgnoreImpCasts(); QualType OrigTy = OrigArg->getType(); if (OrigTy->isArrayType()) OrigTy = Ctx.getArrayDecayedType(OrigTy); if (const StringLiteral * StrE = dyn_cast<StringLiteral>(OrigArg->IgnoreParens())) { commit.replaceWithInner(Msg->getSourceRange(), StrE->getSourceRange()); commit.insert(StrE->getLocStart(), "@"); return true; } if (const PointerType *PT = OrigTy->getAs<PointerType>()) { QualType PointeeType = PT->getPointeeType(); if (Ctx.hasSameUnqualifiedType(PointeeType, Ctx.CharTy)) { SourceRange ArgRange = OrigArg->getSourceRange(); commit.replaceWithInner(Msg->getSourceRange(), ArgRange); if (isa<ParenExpr>(OrigArg) || isa<IntegerLiteral>(OrigArg)) commit.insertBefore(ArgRange.getBegin(), "@"); else commit.insertWrap("@(", ArgRange, ")"); return true; } } return false; } static bool rewriteToStringBoxedExpression(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit) { Selector Sel = Msg->getSelector(); if (Sel == NS.getNSStringSelector(NSAPI::NSStr_stringWithUTF8String) || Sel == NS.getNSStringSelector(NSAPI::NSStr_stringWithCString) || Sel == NS.getNSStringSelector(NSAPI::NSStr_initWithUTF8String)) { if (Msg->getNumArgs() != 1) return false; return doRewriteToUTF8StringBoxedExpressionHelper(Msg, NS, commit); } if (Sel == NS.getNSStringSelector(NSAPI::NSStr_stringWithCStringEncoding)) { if (Msg->getNumArgs() != 2) return false; const Expr *encodingArg = Msg->getArg(1); if (NS.isNSUTF8StringEncodingConstant(encodingArg) || NS.isNSASCIIStringEncodingConstant(encodingArg)) return doRewriteToUTF8StringBoxedExpressionHelper(Msg, NS, commit); } return false; }
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Edit/Commit.cpp
//===----- Commit.cpp - A unit of edits -----------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include "clang/Edit/Commit.h" #include "clang/Basic/SourceManager.h" #include "clang/Edit/EditedSource.h" #include "clang/Lex/Lexer.h" #include "clang/Lex/PPConditionalDirectiveRecord.h" using namespace clang; using namespace edit; SourceLocation Commit::Edit::getFileLocation(SourceManager &SM) const { SourceLocation Loc = SM.getLocForStartOfFile(Offset.getFID()); Loc = Loc.getLocWithOffset(Offset.getOffset()); assert(Loc.isFileID()); return Loc; } CharSourceRange Commit::Edit::getFileRange(SourceManager &SM) const { SourceLocation Loc = getFileLocation(SM); return CharSourceRange::getCharRange(Loc, Loc.getLocWithOffset(Length)); } CharSourceRange Commit::Edit::getInsertFromRange(SourceManager &SM) const { SourceLocation Loc = SM.getLocForStartOfFile(InsertFromRangeOffs.getFID()); Loc = Loc.getLocWithOffset(InsertFromRangeOffs.getOffset()); assert(Loc.isFileID()); return CharSourceRange::getCharRange(Loc, Loc.getLocWithOffset(Length)); } Commit::Commit(EditedSource &Editor) : SourceMgr(Editor.getSourceManager()), LangOpts(Editor.getLangOpts()), PPRec(Editor.getPPCondDirectiveRecord()), Editor(&Editor), IsCommitable(true) { } bool Commit::insert(SourceLocation loc, StringRef text, bool afterToken, bool beforePreviousInsertions) { if (text.empty()) return true; FileOffset Offs; if ((!afterToken && !canInsert(loc, Offs)) || ( afterToken && !canInsertAfterToken(loc, Offs, loc))) { IsCommitable = false; return false; } addInsert(loc, Offs, text, beforePreviousInsertions); return true; } bool Commit::insertFromRange(SourceLocation loc, CharSourceRange range, bool afterToken, bool beforePreviousInsertions) { FileOffset RangeOffs; unsigned RangeLen; if (!canRemoveRange(range, RangeOffs, RangeLen)) { IsCommitable = false; return false; } FileOffset Offs; if ((!afterToken && !canInsert(loc, Offs)) || ( afterToken && !canInsertAfterToken(loc, Offs, loc))) { IsCommitable = false; return false; } if (PPRec && PPRec->areInDifferentConditionalDirectiveRegion(loc, range.getBegin())) { IsCommitable = false; return false; } addInsertFromRange(loc, Offs, RangeOffs, RangeLen, beforePreviousInsertions); return true; } bool Commit::remove(CharSourceRange range) { FileOffset Offs; unsigned Len; if (!canRemoveRange(range, Offs, Len)) { IsCommitable = false; return false; } addRemove(range.getBegin(), Offs, Len); return true; } bool Commit::insertWrap(StringRef before, CharSourceRange range, StringRef after) { bool commitableBefore = insert(range.getBegin(), before, /*afterToken=*/false, /*beforePreviousInsertions=*/true); bool commitableAfter; if (range.isTokenRange()) commitableAfter = insertAfterToken(range.getEnd(), after); else commitableAfter = insert(range.getEnd(), after); return commitableBefore && commitableAfter; } bool Commit::replace(CharSourceRange range, StringRef text) { if (text.empty()) return remove(range); FileOffset Offs; unsigned Len; if (!canInsert(range.getBegin(), Offs) || !canRemoveRange(range, Offs, Len)) { IsCommitable = false; return false; } addRemove(range.getBegin(), Offs, Len); addInsert(range.getBegin(), Offs, text, false); return true; } bool Commit::replaceWithInner(CharSourceRange range, CharSourceRange replacementRange) { FileOffset OuterBegin; unsigned OuterLen; if (!canRemoveRange(range, OuterBegin, OuterLen)) { IsCommitable = false; return false; } FileOffset InnerBegin; unsigned InnerLen; if (!canRemoveRange(replacementRange, InnerBegin, InnerLen)) { IsCommitable = false; return false; } FileOffset OuterEnd = OuterBegin.getWithOffset(OuterLen); FileOffset InnerEnd = InnerBegin.getWithOffset(InnerLen); if (OuterBegin.getFID() != InnerBegin.getFID() || InnerBegin < OuterBegin || InnerBegin > OuterEnd || InnerEnd > OuterEnd) { IsCommitable = false; return false; } addRemove(range.getBegin(), OuterBegin, InnerBegin.getOffset() - OuterBegin.getOffset()); addRemove(replacementRange.getEnd(), InnerEnd, OuterEnd.getOffset() - InnerEnd.getOffset()); return true; } bool Commit::replaceText(SourceLocation loc, StringRef text, StringRef replacementText) { if (text.empty() || replacementText.empty()) return true; FileOffset Offs; unsigned Len; if (!canReplaceText(loc, replacementText, Offs, Len)) { IsCommitable = false; return false; } addRemove(loc, Offs, Len); addInsert(loc, Offs, text, false); return true; } void Commit::addInsert(SourceLocation OrigLoc, FileOffset Offs, StringRef text, bool beforePreviousInsertions) { if (text.empty()) return; Edit data; data.Kind = Act_Insert; data.OrigLoc = OrigLoc; data.Offset = Offs; data.Text = copyString(text); data.BeforePrev = beforePreviousInsertions; CachedEdits.push_back(data); } void Commit::addInsertFromRange(SourceLocation OrigLoc, FileOffset Offs, FileOffset RangeOffs, unsigned RangeLen, bool beforePreviousInsertions) { if (RangeLen == 0) return; Edit data; data.Kind = Act_InsertFromRange; data.OrigLoc = OrigLoc; data.Offset = Offs; data.InsertFromRangeOffs = RangeOffs; data.Length = RangeLen; data.BeforePrev = beforePreviousInsertions; CachedEdits.push_back(data); } void Commit::addRemove(SourceLocation OrigLoc, FileOffset Offs, unsigned Len) { if (Len == 0) return; Edit data; data.Kind = Act_Remove; data.OrigLoc = OrigLoc; data.Offset = Offs; data.Length = Len; CachedEdits.push_back(data); } bool Commit::canInsert(SourceLocation loc, FileOffset &offs) { if (loc.isInvalid()) return false; if (loc.isMacroID()) isAtStartOfMacroExpansion(loc, &loc); const SourceManager &SM = SourceMgr; while (SM.isMacroArgExpansion(loc)) loc = SM.getImmediateSpellingLoc(loc); if (loc.isMacroID()) if (!isAtStartOfMacroExpansion(loc, &loc)) return false; if (SM.isInSystemHeader(loc)) return false; std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(loc); if (locInfo.first.isInvalid()) return false; offs = FileOffset(locInfo.first, locInfo.second); return canInsertInOffset(loc, offs); } bool Commit::canInsertAfterToken(SourceLocation loc, FileOffset &offs, SourceLocation &AfterLoc) { if (loc.isInvalid()) return false; SourceLocation spellLoc = SourceMgr.getSpellingLoc(loc); unsigned tokLen = Lexer::MeasureTokenLength(spellLoc, SourceMgr, LangOpts); AfterLoc = loc.getLocWithOffset(tokLen); if (loc.isMacroID()) isAtEndOfMacroExpansion(loc, &loc); const SourceManager &SM = SourceMgr; while (SM.isMacroArgExpansion(loc)) loc = SM.getImmediateSpellingLoc(loc); if (loc.isMacroID()) if (!isAtEndOfMacroExpansion(loc, &loc)) return false; if (SM.isInSystemHeader(loc)) return false; loc = Lexer::getLocForEndOfToken(loc, 0, SourceMgr, LangOpts); if (loc.isInvalid()) return false; std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(loc); if (locInfo.first.isInvalid()) return false; offs = FileOffset(locInfo.first, locInfo.second); return canInsertInOffset(loc, offs); } bool Commit::canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs) { for (unsigned i = 0, e = CachedEdits.size(); i != e; ++i) { Edit &act = CachedEdits[i]; if (act.Kind == Act_Remove) { if (act.Offset.getFID() == Offs.getFID() && Offs > act.Offset && Offs < act.Offset.getWithOffset(act.Length)) return false; // position has been removed. } } if (!Editor) return true; return Editor->canInsertInOffset(OrigLoc, Offs); } bool Commit::canRemoveRange(CharSourceRange range, FileOffset &Offs, unsigned &Len) { const SourceManager &SM = SourceMgr; range = Lexer::makeFileCharRange(range, SM, LangOpts); if (range.isInvalid()) return false; if (range.getBegin().isMacroID() || range.getEnd().isMacroID()) return false; if (SM.isInSystemHeader(range.getBegin()) || SM.isInSystemHeader(range.getEnd())) return false; if (PPRec && PPRec->rangeIntersectsConditionalDirective(range.getAsRange())) return false; std::pair<FileID, unsigned> beginInfo = SM.getDecomposedLoc(range.getBegin()); std::pair<FileID, unsigned> endInfo = SM.getDecomposedLoc(range.getEnd()); if (beginInfo.first != endInfo.first || beginInfo.second > endInfo.second) return false; Offs = FileOffset(beginInfo.first, beginInfo.second); Len = endInfo.second - beginInfo.second; return true; } bool Commit::canReplaceText(SourceLocation loc, StringRef text, FileOffset &Offs, unsigned &Len) { assert(!text.empty()); if (!canInsert(loc, Offs)) return false; // Try to load the file buffer. bool invalidTemp = false; StringRef file = SourceMgr.getBufferData(Offs.getFID(), &invalidTemp); if (invalidTemp) return false; Len = text.size(); return file.substr(Offs.getOffset()).startswith(text); } bool Commit::isAtStartOfMacroExpansion(SourceLocation loc, SourceLocation *MacroBegin) const { return Lexer::isAtStartOfMacroExpansion(loc, SourceMgr, LangOpts, MacroBegin); } bool Commit::isAtEndOfMacroExpansion(SourceLocation loc, SourceLocation *MacroEnd) const { return Lexer::isAtEndOfMacroExpansion(loc, SourceMgr, LangOpts, MacroEnd); }
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Edit/EditedSource.cpp
//===----- EditedSource.cpp - Collection of source edits ------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include "clang/Edit/EditedSource.h" #include "clang/Basic/CharInfo.h" #include "clang/Basic/SourceManager.h" #include "clang/Edit/Commit.h" #include "clang/Edit/EditsReceiver.h" #include "clang/Lex/Lexer.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" using namespace clang; using namespace edit; void EditsReceiver::remove(CharSourceRange range) { replace(range, StringRef()); } StringRef EditedSource::copyString(const Twine &twine) { SmallString<128> Data; return copyString(twine.toStringRef(Data)); } bool EditedSource::canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs) { FileEditsTy::iterator FA = getActionForOffset(Offs); if (FA != FileEdits.end()) { if (FA->first != Offs) return false; // position has been removed. } if (SourceMgr.isMacroArgExpansion(OrigLoc)) { SourceLocation DefArgLoc = SourceMgr.getImmediateExpansionRange(OrigLoc).first; SourceLocation ExpLoc = SourceMgr.getImmediateExpansionRange(DefArgLoc).first; llvm::DenseMap<unsigned, SourceLocation>::iterator I = ExpansionToArgMap.find(ExpLoc.getRawEncoding()); if (I != ExpansionToArgMap.end() && I->second != DefArgLoc) return false; // Trying to write in a macro argument input that has // already been written for another argument of the same macro. } return true; } bool EditedSource::commitInsert(SourceLocation OrigLoc, FileOffset Offs, StringRef text, bool beforePreviousInsertions) { if (!canInsertInOffset(OrigLoc, Offs)) return false; if (text.empty()) return true; if (SourceMgr.isMacroArgExpansion(OrigLoc)) { SourceLocation DefArgLoc = SourceMgr.getImmediateExpansionRange(OrigLoc).first; SourceLocation ExpLoc = SourceMgr.getImmediateExpansionRange(DefArgLoc).first; ExpansionToArgMap[ExpLoc.getRawEncoding()] = DefArgLoc; } FileEdit &FA = FileEdits[Offs]; if (FA.Text.empty()) { FA.Text = copyString(text); return true; } if (beforePreviousInsertions) FA.Text = copyString(Twine(text) + FA.Text); else FA.Text = copyString(Twine(FA.Text) + text); return true; } bool EditedSource::commitInsertFromRange(SourceLocation OrigLoc, FileOffset Offs, FileOffset InsertFromRangeOffs, unsigned Len, bool beforePreviousInsertions) { if (Len == 0) return true; SmallString<128> StrVec; FileOffset BeginOffs = InsertFromRangeOffs; FileOffset EndOffs = BeginOffs.getWithOffset(Len); FileEditsTy::iterator I = FileEdits.upper_bound(BeginOffs); if (I != FileEdits.begin()) --I; for (; I != FileEdits.end(); ++I) { FileEdit &FA = I->second; FileOffset B = I->first; FileOffset E = B.getWithOffset(FA.RemoveLen); if (BeginOffs == B) break; if (BeginOffs < E) { if (BeginOffs > B) { BeginOffs = E; ++I; } break; } } for (; I != FileEdits.end() && EndOffs > I->first; ++I) { FileEdit &FA = I->second; FileOffset B = I->first; FileOffset E = B.getWithOffset(FA.RemoveLen); if (BeginOffs < B) { bool Invalid = false; StringRef text = getSourceText(BeginOffs, B, Invalid); if (Invalid) return false; StrVec += text; } StrVec += FA.Text; BeginOffs = E; } if (BeginOffs < EndOffs) { bool Invalid = false; StringRef text = getSourceText(BeginOffs, EndOffs, Invalid); if (Invalid) return false; StrVec += text; } return commitInsert(OrigLoc, Offs, StrVec, beforePreviousInsertions); } void EditedSource::commitRemove(SourceLocation OrigLoc, FileOffset BeginOffs, unsigned Len) { if (Len == 0) return; FileOffset EndOffs = BeginOffs.getWithOffset(Len); FileEditsTy::iterator I = FileEdits.upper_bound(BeginOffs); if (I != FileEdits.begin()) --I; for (; I != FileEdits.end(); ++I) { FileEdit &FA = I->second; FileOffset B = I->first; FileOffset E = B.getWithOffset(FA.RemoveLen); if (BeginOffs < E) break; } FileOffset TopBegin, TopEnd; FileEdit *TopFA = nullptr; if (I == FileEdits.end()) { FileEditsTy::iterator NewI = FileEdits.insert(I, std::make_pair(BeginOffs, FileEdit())); NewI->second.RemoveLen = Len; return; } FileEdit &FA = I->second; FileOffset B = I->first; FileOffset E = B.getWithOffset(FA.RemoveLen); if (BeginOffs < B) { FileEditsTy::iterator NewI = FileEdits.insert(I, std::make_pair(BeginOffs, FileEdit())); TopBegin = BeginOffs; TopEnd = EndOffs; TopFA = &NewI->second; TopFA->RemoveLen = Len; } else { TopBegin = B; TopEnd = E; TopFA = &I->second; if (TopEnd >= EndOffs) return; unsigned diff = EndOffs.getOffset() - TopEnd.getOffset(); TopEnd = EndOffs; TopFA->RemoveLen += diff; if (B == BeginOffs) TopFA->Text = StringRef(); ++I; } while (I != FileEdits.end()) { FileEdit &FA = I->second; FileOffset B = I->first; FileOffset E = B.getWithOffset(FA.RemoveLen); if (B >= TopEnd) break; if (E <= TopEnd) { FileEdits.erase(I++); continue; } if (B < TopEnd) { unsigned diff = E.getOffset() - TopEnd.getOffset(); TopEnd = E; TopFA->RemoveLen += diff; FileEdits.erase(I); } break; } } bool EditedSource::commit(const Commit &commit) { if (!commit.isCommitable()) return false; for (edit::Commit::edit_iterator I = commit.edit_begin(), E = commit.edit_end(); I != E; ++I) { const edit::Commit::Edit &edit = *I; switch (edit.Kind) { case edit::Commit::Act_Insert: commitInsert(edit.OrigLoc, edit.Offset, edit.Text, edit.BeforePrev); break; case edit::Commit::Act_InsertFromRange: commitInsertFromRange(edit.OrigLoc, edit.Offset, edit.InsertFromRangeOffs, edit.Length, edit.BeforePrev); break; case edit::Commit::Act_Remove: commitRemove(edit.OrigLoc, edit.Offset, edit.Length); break; } } return true; } // \brief Returns true if it is ok to make the two given characters adjacent. static bool canBeJoined(char left, char right, const LangOptions &LangOpts) { // FIXME: Should use TokenConcatenation to make sure we don't allow stuff like // making two '<' adjacent. return !(Lexer::isIdentifierBodyChar(left, LangOpts) && Lexer::isIdentifierBodyChar(right, LangOpts)); } /// \brief Returns true if it is ok to eliminate the trailing whitespace between /// the given characters. static bool canRemoveWhitespace(char left, char beforeWSpace, char right, const LangOptions &LangOpts) { if (!canBeJoined(left, right, LangOpts)) return false; if (isWhitespace(left) || isWhitespace(right)) return true; if (canBeJoined(beforeWSpace, right, LangOpts)) return false; // the whitespace was intentional, keep it. return true; } /// \brief Check the range that we are going to remove and: /// -Remove any trailing whitespace if possible. /// -Insert a space if removing the range is going to mess up the source tokens. static void adjustRemoval(const SourceManager &SM, const LangOptions &LangOpts, SourceLocation Loc, FileOffset offs, unsigned &len, StringRef &text) { assert(len && text.empty()); SourceLocation BeginTokLoc = Lexer::GetBeginningOfToken(Loc, SM, LangOpts); if (BeginTokLoc != Loc) return; // the range is not at the beginning of a token, keep the range. bool Invalid = false; StringRef buffer = SM.getBufferData(offs.getFID(), &Invalid); if (Invalid) return; unsigned begin = offs.getOffset(); unsigned end = begin + len; // Do not try to extend the removal if we're at the end of the buffer already. if (end == buffer.size()) return; assert(begin < buffer.size() && end < buffer.size() && "Invalid range!"); // FIXME: Remove newline. if (begin == 0) { if (buffer[end] == ' ') ++len; return; } if (buffer[end] == ' ') { assert((end + 1 != buffer.size() || buffer.data()[end + 1] == 0) && "buffer not zero-terminated!"); if (canRemoveWhitespace(/*left=*/buffer[begin-1], /*beforeWSpace=*/buffer[end-1], /*right=*/buffer.data()[end + 1], // zero-terminated LangOpts)) ++len; return; } if (!canBeJoined(buffer[begin-1], buffer[end], LangOpts)) text = " "; } static void applyRewrite(EditsReceiver &receiver, StringRef text, FileOffset offs, unsigned len, const SourceManager &SM, const LangOptions &LangOpts) { assert(!offs.getFID().isInvalid()); SourceLocation Loc = SM.getLocForStartOfFile(offs.getFID()); Loc = Loc.getLocWithOffset(offs.getOffset()); assert(Loc.isFileID()); if (text.empty()) adjustRemoval(SM, LangOpts, Loc, offs, len, text); CharSourceRange range = CharSourceRange::getCharRange(Loc, Loc.getLocWithOffset(len)); if (text.empty()) { assert(len); receiver.remove(range); return; } if (len) receiver.replace(range, text); else receiver.insert(Loc, text); } void EditedSource::applyRewrites(EditsReceiver &receiver) { SmallString<128> StrVec; FileOffset CurOffs, CurEnd; unsigned CurLen; if (FileEdits.empty()) return; FileEditsTy::iterator I = FileEdits.begin(); CurOffs = I->first; StrVec = I->second.Text; CurLen = I->second.RemoveLen; CurEnd = CurOffs.getWithOffset(CurLen); ++I; for (FileEditsTy::iterator E = FileEdits.end(); I != E; ++I) { FileOffset offs = I->first; FileEdit act = I->second; assert(offs >= CurEnd); if (offs == CurEnd) { StrVec += act.Text; CurLen += act.RemoveLen; CurEnd.getWithOffset(act.RemoveLen); continue; } applyRewrite(receiver, StrVec, CurOffs, CurLen, SourceMgr, LangOpts); CurOffs = offs; StrVec = act.Text; CurLen = act.RemoveLen; CurEnd = CurOffs.getWithOffset(CurLen); } applyRewrite(receiver, StrVec, CurOffs, CurLen, SourceMgr, LangOpts); } void EditedSource::clearRewrites() { FileEdits.clear(); StrAlloc.Reset(); } StringRef EditedSource::getSourceText(FileOffset BeginOffs, FileOffset EndOffs, bool &Invalid) { assert(BeginOffs.getFID() == EndOffs.getFID()); assert(BeginOffs <= EndOffs); SourceLocation BLoc = SourceMgr.getLocForStartOfFile(BeginOffs.getFID()); BLoc = BLoc.getLocWithOffset(BeginOffs.getOffset()); assert(BLoc.isFileID()); SourceLocation ELoc = BLoc.getLocWithOffset(EndOffs.getOffset() - BeginOffs.getOffset()); return Lexer::getSourceText(CharSourceRange::getCharRange(BLoc, ELoc), SourceMgr, LangOpts, &Invalid); } EditedSource::FileEditsTy::iterator EditedSource::getActionForOffset(FileOffset Offs) { FileEditsTy::iterator I = FileEdits.upper_bound(Offs); if (I == FileEdits.begin()) return FileEdits.end(); --I; FileEdit &FA = I->second; FileOffset B = I->first; FileOffset E = B.getWithOffset(FA.RemoveLen); if (Offs >= B && Offs < E) return I; return FileEdits.end(); }
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Edit/CMakeLists.txt
set(LLVM_LINK_COMPONENTS Support ) set (HLSL_IGNORE_SOURCES RewriteObjCFoundationAPI.cpp ) add_clang_library(clangEdit Commit.cpp EditedSource.cpp LINK_LIBS clangAST clangBasic clangLex )
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/x86intrin.h
/*===---- x86intrin.h - X86 intrinsics -------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __X86INTRIN_H #define __X86INTRIN_H #include <ia32intrin.h> #include <immintrin.h> #ifdef __3dNOW__ #include <mm3dnow.h> #endif #ifdef __BMI__ #include <bmiintrin.h> #endif #ifdef __BMI2__ #include <bmi2intrin.h> #endif #ifdef __LZCNT__ #include <lzcntintrin.h> #endif #ifdef __POPCNT__ #include <popcntintrin.h> #endif #ifdef __RDSEED__ #include <rdseedintrin.h> #endif #ifdef __PRFCHW__ #include <prfchwintrin.h> #endif #ifdef __SSE4A__ #include <ammintrin.h> #endif #ifdef __FMA4__ #include <fma4intrin.h> #endif #ifdef __XOP__ #include <xopintrin.h> #endif #ifdef __TBM__ #include <tbmintrin.h> #endif #ifdef __F16C__ #include <f16cintrin.h> #endif /* FIXME: LWP */ #endif /* __X86INTRIN_H */
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/fxsrintrin.h
/*===---- fxsrintrin.h - FXSR intrinsic ------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __IMMINTRIN_H #error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead." #endif #ifndef __FXSRINTRIN_H #define __FXSRINTRIN_H #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) static __inline__ void __DEFAULT_FN_ATTRS _fxsave(void *__p) { return __builtin_ia32_fxsave(__p); } static __inline__ void __DEFAULT_FN_ATTRS _fxsave64(void *__p) { return __builtin_ia32_fxsave64(__p); } static __inline__ void __DEFAULT_FN_ATTRS _fxrstor(void *__p) { return __builtin_ia32_fxrstor(__p); } static __inline__ void __DEFAULT_FN_ATTRS _fxrstor64(void *__p) { return __builtin_ia32_fxrstor64(__p); } #undef __DEFAULT_FN_ATTRS #endif
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/xopintrin.h
/*===---- xopintrin.h - XOP intrinsics -------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __X86INTRIN_H #error "Never use <xopintrin.h> directly; include <x86intrin.h> instead." #endif #ifndef __XOPINTRIN_H #define __XOPINTRIN_H #ifndef __XOP__ # error "XOP instruction set is not enabled" #else #include <fma4intrin.h> /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacssww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_macc_epi16(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacsww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maccsd_epi16(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maccd_epi16(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maccs_epi32(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacssdd((__v4si)__A, (__v4si)__B, (__v4si)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_macc_epi32(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacsdd((__v4si)__A, (__v4si)__B, (__v4si)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maccslo_epi32(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacssdql((__v4si)__A, (__v4si)__B, (__v2di)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_macclo_epi32(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacsdql((__v4si)__A, (__v4si)__B, (__v2di)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maccshi_epi32(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacssdqh((__v4si)__A, (__v4si)__B, (__v2di)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_macchi_epi32(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmacsdqh((__v4si)__A, (__v4si)__B, (__v2di)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maddsd_epi16(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmadcsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maddd_epi16(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpmadcswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddw_epi8(__m128i __A) { return (__m128i)__builtin_ia32_vphaddbw((__v16qi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddd_epi8(__m128i __A) { return (__m128i)__builtin_ia32_vphaddbd((__v16qi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddq_epi8(__m128i __A) { return (__m128i)__builtin_ia32_vphaddbq((__v16qi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddd_epi16(__m128i __A) { return (__m128i)__builtin_ia32_vphaddwd((__v8hi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddq_epi16(__m128i __A) { return (__m128i)__builtin_ia32_vphaddwq((__v8hi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddq_epi32(__m128i __A) { return (__m128i)__builtin_ia32_vphadddq((__v4si)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddw_epu8(__m128i __A) { return (__m128i)__builtin_ia32_vphaddubw((__v16qi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddd_epu8(__m128i __A) { return (__m128i)__builtin_ia32_vphaddubd((__v16qi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddq_epu8(__m128i __A) { return (__m128i)__builtin_ia32_vphaddubq((__v16qi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddd_epu16(__m128i __A) { return (__m128i)__builtin_ia32_vphadduwd((__v8hi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddq_epu16(__m128i __A) { return (__m128i)__builtin_ia32_vphadduwq((__v8hi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_haddq_epu32(__m128i __A) { return (__m128i)__builtin_ia32_vphaddudq((__v4si)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hsubw_epi8(__m128i __A) { return (__m128i)__builtin_ia32_vphsubbw((__v16qi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hsubd_epi16(__m128i __A) { return (__m128i)__builtin_ia32_vphsubwd((__v8hi)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hsubq_epi32(__m128i __A) { return (__m128i)__builtin_ia32_vphsubdq((__v4si)__A); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmov_si128(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpcmov(__A, __B, __C); } static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_cmov_si256(__m256i __A, __m256i __B, __m256i __C) { return (__m256i)__builtin_ia32_vpcmov_256(__A, __B, __C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_perm_epi8(__m128i __A, __m128i __B, __m128i __C) { return (__m128i)__builtin_ia32_vpperm((__v16qi)__A, (__v16qi)__B, (__v16qi)__C); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_rot_epi8(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_rot_epi16(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_rot_epi32(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_rot_epi64(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B); } #define _mm_roti_epi8(A, N) __extension__ ({ \ __m128i __A = (A); \ (__m128i)__builtin_ia32_vprotbi((__v16qi)__A, (N)); }) #define _mm_roti_epi16(A, N) __extension__ ({ \ __m128i __A = (A); \ (__m128i)__builtin_ia32_vprotwi((__v8hi)__A, (N)); }) #define _mm_roti_epi32(A, N) __extension__ ({ \ __m128i __A = (A); \ (__m128i)__builtin_ia32_vprotdi((__v4si)__A, (N)); }) #define _mm_roti_epi64(A, N) __extension__ ({ \ __m128i __A = (A); \ (__m128i)__builtin_ia32_vprotqi((__v2di)__A, (N)); }) static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_shl_epi8(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshlb((__v16qi)__A, (__v16qi)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_shl_epi16(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshlw((__v8hi)__A, (__v8hi)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_shl_epi32(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshld((__v4si)__A, (__v4si)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_shl_epi64(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshlq((__v2di)__A, (__v2di)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sha_epi8(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshab((__v16qi)__A, (__v16qi)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sha_epi16(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshaw((__v8hi)__A, (__v8hi)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sha_epi32(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshad((__v4si)__A, (__v4si)__B); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sha_epi64(__m128i __A, __m128i __B) { return (__m128i)__builtin_ia32_vpshaq((__v2di)__A, (__v2di)__B); } #define _mm_com_epu8(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomub((__v16qi)__A, (__v16qi)__B, (N)); }) #define _mm_com_epu16(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomuw((__v8hi)__A, (__v8hi)__B, (N)); }) #define _mm_com_epu32(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomud((__v4si)__A, (__v4si)__B, (N)); }) #define _mm_com_epu64(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomuq((__v2di)__A, (__v2di)__B, (N)); }) #define _mm_com_epi8(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomb((__v16qi)__A, (__v16qi)__B, (N)); }) #define _mm_com_epi16(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomw((__v8hi)__A, (__v8hi)__B, (N)); }) #define _mm_com_epi32(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomd((__v4si)__A, (__v4si)__B, (N)); }) #define _mm_com_epi64(A, B, N) __extension__ ({ \ __m128i __A = (A); \ __m128i __B = (B); \ (__m128i)__builtin_ia32_vpcomq((__v2di)__A, (__v2di)__B, (N)); }) #define _MM_PCOMCTRL_LT 0 #define _MM_PCOMCTRL_LE 1 #define _MM_PCOMCTRL_GT 2 #define _MM_PCOMCTRL_GE 3 #define _MM_PCOMCTRL_EQ 4 #define _MM_PCOMCTRL_NEQ 5 #define _MM_PCOMCTRL_FALSE 6 #define _MM_PCOMCTRL_TRUE 7 static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epu8(__m128i __A, __m128i __B) { return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_TRUE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epu16(__m128i __A, __m128i __B) { return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_TRUE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epu32(__m128i __A, __m128i __B) { return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_TRUE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epu64(__m128i __A, __m128i __B) { return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_TRUE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epi8(__m128i __A, __m128i __B) { return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_TRUE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epi16(__m128i __A, __m128i __B) { return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_TRUE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epi32(__m128i __A, __m128i __B) { return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_TRUE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comlt_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comle_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comgt_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GT); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comge_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comeq_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_EQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comneq_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_NEQ); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comfalse_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_FALSE); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_comtrue_epi64(__m128i __A, __m128i __B) { return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_TRUE); } #define _mm_permute2_pd(X, Y, C, I) __extension__ ({ \ __m128d __X = (X); \ __m128d __Y = (Y); \ __m128i __C = (C); \ (__m128d)__builtin_ia32_vpermil2pd((__v2df)__X, (__v2df)__Y, \ (__v2di)__C, (I)); }) #define _mm256_permute2_pd(X, Y, C, I) __extension__ ({ \ __m256d __X = (X); \ __m256d __Y = (Y); \ __m256i __C = (C); \ (__m256d)__builtin_ia32_vpermil2pd256((__v4df)__X, (__v4df)__Y, \ (__v4di)__C, (I)); }) #define _mm_permute2_ps(X, Y, C, I) __extension__ ({ \ __m128 __X = (X); \ __m128 __Y = (Y); \ __m128i __C = (C); \ (__m128)__builtin_ia32_vpermil2ps((__v4sf)__X, (__v4sf)__Y, \ (__v4si)__C, (I)); }) #define _mm256_permute2_ps(X, Y, C, I) __extension__ ({ \ __m256 __X = (X); \ __m256 __Y = (Y); \ __m256i __C = (C); \ (__m256)__builtin_ia32_vpermil2ps256((__v8sf)__X, (__v8sf)__Y, \ (__v8si)__C, (I)); }) static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_frcz_ss(__m128 __A) { return (__m128)__builtin_ia32_vfrczss((__v4sf)__A); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_frcz_sd(__m128d __A) { return (__m128d)__builtin_ia32_vfrczsd((__v2df)__A); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_frcz_ps(__m128 __A) { return (__m128)__builtin_ia32_vfrczps((__v4sf)__A); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_frcz_pd(__m128d __A) { return (__m128d)__builtin_ia32_vfrczpd((__v2df)__A); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_frcz_ps(__m256 __A) { return (__m256)__builtin_ia32_vfrczps256((__v8sf)__A); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_frcz_pd(__m256d __A) { return (__m256d)__builtin_ia32_vfrczpd256((__v4df)__A); } #undef __DEFAULT_FN_ATTRS #endif /* __XOP__ */ #endif /* __XOPINTRIN_H */
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/tbmintrin.h
/*===---- tbmintrin.h - TBM intrinsics -------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __TBM__ #error "TBM instruction set is not enabled" #endif #ifndef __X86INTRIN_H #error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead." #endif #ifndef __TBMINTRIN_H #define __TBMINTRIN_H /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) #define __bextri_u32(a, b) (__builtin_ia32_bextri_u32((a), (b))) static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcfill_u32(unsigned int a) { return a & (a + 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __blci_u32(unsigned int a) { return a | ~(a + 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcic_u32(unsigned int a) { return ~a & (a + 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcmsk_u32(unsigned int a) { return a ^ (a + 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __blcs_u32(unsigned int a) { return a | (a + 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __blsfill_u32(unsigned int a) { return a | (a - 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __blsic_u32(unsigned int a) { return ~a | (a - 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __t1mskc_u32(unsigned int a) { return ~a | (a + 1); } static __inline__ unsigned int __DEFAULT_FN_ATTRS __tzmsk_u32(unsigned int a) { return ~a & (a - 1); } #ifdef __x86_64__ #define __bextri_u64(a, b) (__builtin_ia32_bextri_u64((a), (int)(b))) static __inline__ unsigned long long __DEFAULT_FN_ATTRS __blcfill_u64(unsigned long long a) { return a & (a + 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __blci_u64(unsigned long long a) { return a | ~(a + 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __blcic_u64(unsigned long long a) { return ~a & (a + 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __blcmsk_u64(unsigned long long a) { return a ^ (a + 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __blcs_u64(unsigned long long a) { return a | (a + 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __blsfill_u64(unsigned long long a) { return a | (a - 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __blsic_u64(unsigned long long a) { return ~a | (a - 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __t1mskc_u64(unsigned long long a) { return ~a | (a + 1); } static __inline__ unsigned long long __DEFAULT_FN_ATTRS __tzmsk_u64(unsigned long long a) { return ~a & (a - 1); } #endif #undef __DEFAULT_FN_ATTRS #endif /* __TBMINTRIN_H */
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/fma4intrin.h
/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __X86INTRIN_H #error "Never use <fma4intrin.h> directly; include <x86intrin.h> instead." #endif #ifndef __FMA4INTRIN_H #define __FMA4INTRIN_H #ifndef __FMA4__ # error "FMA4 instruction set is not enabled" #else #include <pmmintrin.h> /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_macc_ps(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_macc_pd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_macc_ss(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_macc_sd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_msub_ps(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_msub_pd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_msub_ss(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_msub_sd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_maddsub_ps(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_maddsub_pd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_msubadd_ps(__m128 __A, __m128 __B, __m128 __C) { return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_msubadd_pd(__m128d __A, __m128d __B, __m128d __C) { return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C) { return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C) { return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C) { return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C) { return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C) { return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C) { return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C) { return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C) { return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_maddsub_ps(__m256 __A, __m256 __B, __m256 __C) { return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_maddsub_pd(__m256d __A, __m256d __B, __m256d __C) { return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C); } static __inline__ __m256 __DEFAULT_FN_ATTRS _mm256_msubadd_ps(__m256 __A, __m256 __B, __m256 __C) { return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C); } static __inline__ __m256d __DEFAULT_FN_ATTRS _mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C) { return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C); } #undef __DEFAULT_FN_ATTRS #endif /* __FMA4__ */ #endif /* __FMA4INTRIN_H */
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/tmmintrin.h
/*===---- tmmintrin.h - SSSE3 intrinsics -----------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __TMMINTRIN_H #define __TMMINTRIN_H #ifndef __SSSE3__ #error "SSSE3 instruction set not enabled" #else #include <pmmintrin.h> /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_abs_pi8(__m64 __a) { return (__m64)__builtin_ia32_pabsb((__v8qi)__a); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_abs_epi8(__m128i __a) { return (__m128i)__builtin_ia32_pabsb128((__v16qi)__a); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_abs_pi16(__m64 __a) { return (__m64)__builtin_ia32_pabsw((__v4hi)__a); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_abs_epi16(__m128i __a) { return (__m128i)__builtin_ia32_pabsw128((__v8hi)__a); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_abs_pi32(__m64 __a) { return (__m64)__builtin_ia32_pabsd((__v2si)__a); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_abs_epi32(__m128i __a) { return (__m128i)__builtin_ia32_pabsd128((__v4si)__a); } #define _mm_alignr_epi8(a, b, n) __extension__ ({ \ __m128i __a = (a); \ __m128i __b = (b); \ (__m128i)__builtin_ia32_palignr128((__v16qi)__a, (__v16qi)__b, (n)); }) #define _mm_alignr_pi8(a, b, n) __extension__ ({ \ __m64 __a = (a); \ __m64 __b = (b); \ (__m64)__builtin_ia32_palignr((__v8qi)__a, (__v8qi)__b, (n)); }) static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hadd_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_phaddw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hadd_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_phaddd128((__v4si)__a, (__v4si)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_hadd_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_phaddw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_hadd_pi32(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_phaddd((__v2si)__a, (__v2si)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hadds_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_phaddsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_hadds_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_phaddsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hsub_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_phsubw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hsub_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_phsubd128((__v4si)__a, (__v4si)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_hsub_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_phsubw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_hsub_pi32(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_phsubd((__v2si)__a, (__v2si)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_hsubs_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_phsubsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_hsubs_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_phsubsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_maddubs_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_maddubs_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmaddubsw((__v8qi)__a, (__v8qi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_mulhrs_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_mulhrs_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmulhrsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_shuffle_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pshufb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_shuffle_pi8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pshufb((__v8qi)__a, (__v8qi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sign_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psignb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sign_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psignw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_sign_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psignd128((__v4si)__a, (__v4si)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_sign_pi8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_psignb((__v8qi)__a, (__v8qi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_sign_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_psignw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __DEFAULT_FN_ATTRS _mm_sign_pi32(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_psignd((__v2si)__a, (__v2si)__b); } #undef __DEFAULT_FN_ATTRS #endif /* __SSSE3__ */ #endif /* __TMMINTRIN_H */
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/ia32intrin.h
/* ===-------- ia32intrin.h ---------------------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __X86INTRIN_H #error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead." #endif #ifndef __IA32INTRIN_H #define __IA32INTRIN_H #ifdef __x86_64__ static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __readeflags(void) { unsigned long long __res = 0; __asm__ __volatile__ ("pushf\n\t" "popq %0\n" :"=r"(__res) : : ); return __res; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __writeeflags(unsigned long long __f) { __asm__ __volatile__ ("pushq %0\n\t" "popf\n" : :"r"(__f) :"flags" ); } #else /* !__x86_64__ */ static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) __readeflags(void) { unsigned int __res = 0; __asm__ __volatile__ ("pushf\n\t" "popl %0\n" :"=r"(__res) : : ); return __res; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __writeeflags(unsigned int __f) { __asm__ __volatile__ ("pushl %0\n\t" "popf\n" : :"r"(__f) :"flags" ); } #endif /* !__x86_64__ */ static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __rdpmc(int __A) { return __builtin_ia32_rdpmc(__A); } /* __rdtsc */ static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __rdtsc(void) { return __builtin_ia32_rdtsc(); } /* __rdtscp */ static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __rdtscp(unsigned int *__A) { return __builtin_ia32_rdtscp(__A); } #define _rdtsc() __rdtsc() #endif /* __IA32INTRIN_H */
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/vadefs.h
/* ===-------- vadefs.h ---------------------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef _MSC_VER #include_next <vadefs.h> #else #ifndef __clang_vadefs_h #define __clang_vadefs_h #include_next <vadefs.h> /* Override macros from vadefs.h with definitions that work with Clang. */ #ifdef _crt_va_start #undef _crt_va_start #define _crt_va_start(ap, param) __builtin_va_start(ap, param) #endif #ifdef _crt_va_end #undef _crt_va_end #define _crt_va_end(ap) __builtin_va_end(ap) #endif #ifdef _crt_va_arg #undef _crt_va_arg #define _crt_va_arg(ap, type) __builtin_va_arg(ap, type) #endif /* VS 2015 switched to double underscore names, which is an improvement, but now * we have to intercept those names too. */ #ifdef __crt_va_start #undef __crt_va_start #define __crt_va_start(ap, param) __builtin_va_start(ap, param) #endif #ifdef __crt_va_end #undef __crt_va_end #define __crt_va_end(ap) __builtin_va_end(ap) #endif #ifdef __crt_va_arg #undef __crt_va_arg #define __crt_va_arg(ap, type) __builtin_va_arg(ap, type) #endif #endif #endif
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/arm_acle.h
/*===---- arm_acle.h - ARM Non-Neon intrinsics -----------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __ARM_ACLE_H #define __ARM_ACLE_H #ifndef __ARM_ACLE #error "ACLE intrinsics support not enabled." #endif #include <stdint.h> #if defined(__cplusplus) extern "C" { #endif /* 8 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */ /* 8.3 Memory barriers */ #if !defined(_MSC_VER) #define __dmb(i) __builtin_arm_dmb(i) #define __dsb(i) __builtin_arm_dsb(i) #define __isb(i) __builtin_arm_isb(i) #endif /* 8.4 Hints */ #if !defined(_MSC_VER) static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfi(void) { __builtin_arm_wfi(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfe(void) { __builtin_arm_wfe(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sev(void) { __builtin_arm_sev(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sevl(void) { __builtin_arm_sevl(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(void) { __builtin_arm_yield(); } #endif #if __ARM_32BIT_STATE #define __dbg(t) __builtin_arm_dbg(t) #endif /* 8.5 Swap */ static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __swp(uint32_t x, volatile uint32_t *p) { uint32_t v; do v = __builtin_arm_ldrex(p); while (__builtin_arm_strex(x, p)); return v; } /* 8.6 Memory prefetch intrinsics */ /* 8.6.1 Data prefetch */ #define __pld(addr) __pldx(0, 0, 0, addr) #if __ARM_32BIT_STATE #define __pldx(access_kind, cache_level, retention_policy, addr) \ __builtin_arm_prefetch(addr, access_kind, 1) #else #define __pldx(access_kind, cache_level, retention_policy, addr) \ __builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1) #endif /* 8.6.2 Instruction prefetch */ #define __pli(addr) __plix(0, 0, addr) #if __ARM_32BIT_STATE #define __plix(cache_level, retention_policy, addr) \ __builtin_arm_prefetch(addr, 0, 0) #else #define __plix(cache_level, retention_policy, addr) \ __builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0) #endif /* 8.7 NOP */ static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) { __builtin_arm_nop(); } /* 9 DATA-PROCESSING INTRINSICS */ /* 9.2 Miscellaneous data-processing intrinsics */ /* ROR */ static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __ror(uint32_t x, uint32_t y) { y %= 32; if (y == 0) return x; return (x >> y) | (x << (32 - y)); } static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__)) __rorll(uint64_t x, uint32_t y) { y %= 64; if (y == 0) return x; return (x >> y) | (x << (64 - y)); } static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__)) __rorl(unsigned long x, uint32_t y) { #if __SIZEOF_LONG__ == 4 return __ror(x, y); #else return __rorll(x, y); #endif } /* CLZ */ static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __clz(uint32_t t) { return __builtin_clz(t); } static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__)) __clzl(unsigned long t) { return __builtin_clzl(t); } static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__)) __clzll(uint64_t t) { return __builtin_clzll(t); } /* REV */ static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __rev(uint32_t t) { return __builtin_bswap32(t); } static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__)) __revl(unsigned long t) { #if __SIZEOF_LONG__ == 4 return __builtin_bswap32(t); #else return __builtin_bswap64(t); #endif } static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__)) __revll(uint64_t t) { return __builtin_bswap64(t); } /* REV16 */ static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __rev16(uint32_t t) { return __ror(__rev(t), 16); } static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__)) __rev16l(unsigned long t) { return __rorl(__revl(t), sizeof(long) / 2); } static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__)) __rev16ll(uint64_t t) { return __rorll(__revll(t), 32); } /* REVSH */ static __inline__ int16_t __attribute__((__always_inline__, __nodebug__)) __revsh(int16_t t) { return __builtin_bswap16(t); } /* RBIT */ static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __rbit(uint32_t t) { return __builtin_arm_rbit(t); } static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__)) __rbitll(uint64_t t) { #if __ARM_32BIT_STATE return (((uint64_t) __builtin_arm_rbit(t)) << 32) | __builtin_arm_rbit(t >> 32); #else return __builtin_arm_rbit64(t); #endif } static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__)) __rbitl(unsigned long t) { #if __SIZEOF_LONG__ == 4 return __rbit(t); #else return __rbitll(t); #endif } /* * 9.4 Saturating intrinsics * * FIXME: Change guard to their corrosponding __ARM_FEATURE flag when Q flag * intrinsics are implemented and the flag is enabled. */ /* 9.4.1 Width-specified saturation intrinsics */ #if __ARM_32BIT_STATE #define __ssat(x, y) __builtin_arm_ssat(x, y) #define __usat(x, y) __builtin_arm_usat(x, y) #endif /* 9.4.2 Saturating addition and subtraction intrinsics */ #if __ARM_32BIT_STATE static __inline__ int32_t __attribute__((__always_inline__, __nodebug__)) __qadd(int32_t t, int32_t v) { return __builtin_arm_qadd(t, v); } static __inline__ int32_t __attribute__((__always_inline__, __nodebug__)) __qsub(int32_t t, int32_t v) { return __builtin_arm_qsub(t, v); } static __inline__ int32_t __attribute__((__always_inline__, __nodebug__)) __qdbl(int32_t t) { return __builtin_arm_qadd(t, t); } #endif /* 9.7 CRC32 intrinsics */ #if __ARM_FEATURE_CRC32 static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32b(uint32_t a, uint8_t b) { return __builtin_arm_crc32b(a, b); } static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32h(uint32_t a, uint16_t b) { return __builtin_arm_crc32h(a, b); } static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32w(uint32_t a, uint32_t b) { return __builtin_arm_crc32w(a, b); } static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32d(uint32_t a, uint64_t b) { return __builtin_arm_crc32d(a, b); } static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32cb(uint32_t a, uint8_t b) { return __builtin_arm_crc32cb(a, b); } static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32ch(uint32_t a, uint16_t b) { return __builtin_arm_crc32ch(a, b); } static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32cw(uint32_t a, uint32_t b) { return __builtin_arm_crc32cw(a, b); } static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__)) __crc32cd(uint32_t a, uint64_t b) { return __builtin_arm_crc32cd(a, b); } #endif /* 10.1 Special register intrinsics */ #define __arm_rsr(sysreg) __builtin_arm_rsr(sysreg) #define __arm_rsr64(sysreg) __builtin_arm_rsr64(sysreg) #define __arm_rsrp(sysreg) __builtin_arm_rsrp(sysreg) #define __arm_wsr(sysreg, v) __builtin_arm_wsr(sysreg, v) #define __arm_wsr64(sysreg, v) __builtin_arm_wsr64(sysreg, v) #define __arm_wsrp(sysreg, v) __builtin_arm_wsrp(sysreg, v) #if defined(__cplusplus) } #endif #endif /* __ARM_ACLE_H */
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/avx512bwintrin.h
/*===------------- avx512bwintrin.h - AVX512BW intrinsics ------------------=== * * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __IMMINTRIN_H #error "Never use <avx512bwintrin.h> directly; include <immintrin.h> instead." #endif #ifndef __AVX512BWINTRIN_H #define __AVX512BWINTRIN_H typedef unsigned int __mmask32; typedef unsigned long long __mmask64; typedef char __v64qi __attribute__ ((__vector_size__ (64))); typedef short __v32hi __attribute__ ((__vector_size__ (64))); /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) static __inline __v64qi __DEFAULT_FN_ATTRS _mm512_setzero_qi (void) { return (__v64qi){ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; } static __inline __v32hi __DEFAULT_FN_ATTRS _mm512_setzero_hi (void) { return (__v32hi){ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; } /* Integer compare */ static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpeq_epi8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpeq_epu8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 0, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 0, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpeq_epi16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpeq_epu16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 0, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 0, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpge_epi8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 5, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 5, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpge_epu8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 5, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 5, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpge_epi16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 5, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 5, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpge_epu16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 5, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 5, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpgt_epi8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_pcmpgtb512_mask((__v64qi)__a, (__v64qi)__b, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_pcmpgtb512_mask((__v64qi)__a, (__v64qi)__b, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpgt_epu8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 6, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 6, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpgt_epi16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_pcmpgtw512_mask((__v32hi)__a, (__v32hi)__b, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_pcmpgtw512_mask((__v32hi)__a, (__v32hi)__b, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpgt_epu16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 6, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 6, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmple_epi8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 2, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 2, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmple_epu8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 2, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 2, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmple_epi16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 2, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 2, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmple_epu16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 2, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 2, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmplt_epi8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 1, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 1, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmplt_epu8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 1, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 1, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmplt_epi16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 1, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 1, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmplt_epu16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 1, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 1, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpneq_epi8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 4, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 4, __u); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_cmpneq_epu8_mask(__m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 4, (__mmask64)-1); } static __inline__ __mmask64 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) { return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 4, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpneq_epi16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 4, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 4, __u); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_cmpneq_epu16_mask(__m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 4, (__mmask32)-1); } static __inline__ __mmask32 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) { return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 4, __u); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_add_epi8 (__m512i __A, __m512i __B) { return (__m512i) ((__v64qi) __A + (__v64qi) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_add_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_add_epi8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_sub_epi8 (__m512i __A, __m512i __B) { return (__m512i) ((__v64qi) __A - (__v64qi) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_sub_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_sub_epi8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_add_epi16 (__m512i __A, __m512i __B) { return (__m512i) ((__v32hi) __A + (__v32hi) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_add_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_add_epi16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_sub_epi16 (__m512i __A, __m512i __B) { return (__m512i) ((__v32hi) __A - (__v32hi) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_sub_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_sub_epi16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mullo_epi16 (__m512i __A, __m512i __B) { return (__m512i) ((__v32hi) __A * (__v32hi) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_mullo_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmullw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_mullo_epi16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmullw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_blend_epi8 (__mmask64 __U, __m512i __A, __m512i __W) { return (__m512i) __builtin_ia32_blendmb_512_mask ((__v64qi) __A, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_blend_epi16 (__mmask32 __U, __m512i __A, __m512i __W) { return (__m512i) __builtin_ia32_blendmw_512_mask ((__v32hi) __A, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_abs_epi8 (__m512i __A) { return (__m512i) __builtin_ia32_pabsb512_mask ((__v64qi) __A, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_abs_epi8 (__m512i __W, __mmask64 __U, __m512i __A) { return (__m512i) __builtin_ia32_pabsb512_mask ((__v64qi) __A, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_abs_epi8 (__mmask64 __U, __m512i __A) { return (__m512i) __builtin_ia32_pabsb512_mask ((__v64qi) __A, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_abs_epi16 (__m512i __A) { return (__m512i) __builtin_ia32_pabsw512_mask ((__v32hi) __A, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_abs_epi16 (__m512i __W, __mmask32 __U, __m512i __A) { return (__m512i) __builtin_ia32_pabsw512_mask ((__v32hi) __A, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_abs_epi16 (__mmask32 __U, __m512i __A) { return (__m512i) __builtin_ia32_pabsw512_mask ((__v32hi) __A, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_packs_epi32 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packssdw512_mask ((__v16si) __A, (__v16si) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_packs_epi32 (__mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packssdw512_mask ((__v16si) __A, (__v16si) __B, (__v32hi) _mm512_setzero_hi(), __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_packs_epi32 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packssdw512_mask ((__v16si) __A, (__v16si) __B, (__v32hi) __W, __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_packs_epi16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packsswb512_mask ((__v32hi) __A, (__v32hi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_packs_epi16 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packsswb512_mask ((__v32hi) __A, (__v32hi) __B, (__v64qi) __W, (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_packs_epi16 (__mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packsswb512_mask ((__v32hi) __A, (__v32hi) __B, (__v64qi) _mm512_setzero_qi(), __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_packus_epi32 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packusdw512_mask ((__v16si) __A, (__v16si) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_packus_epi32 (__mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packusdw512_mask ((__v16si) __A, (__v16si) __B, (__v32hi) _mm512_setzero_hi(), __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_packus_epi32 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packusdw512_mask ((__v16si) __A, (__v16si) __B, (__v32hi) __W, __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_packus_epi16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packuswb512_mask ((__v32hi) __A, (__v32hi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_packus_epi16 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packuswb512_mask ((__v32hi) __A, (__v32hi) __B, (__v64qi) __W, (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_packus_epi16 (__mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_packuswb512_mask ((__v32hi) __A, (__v32hi) __B, (__v64qi) _mm512_setzero_qi(), (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_adds_epi8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_adds_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_adds_epi8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_adds_epi16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_adds_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_adds_epi16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_adds_epu8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddusb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_adds_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddusb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_adds_epu8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddusb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_adds_epu16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddusw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_adds_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddusw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_adds_epu16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddusw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_avg_epu8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_avg_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_avg_epu8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi(), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_avg_epu16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_avg_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_avg_epu16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi(), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_max_epi8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_max_epi8 (__mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi(), (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_max_epi8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_max_epi16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_max_epi16 (__mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi(), (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_max_epi16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_max_epu8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxub512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_max_epu8 (__mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxub512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi(), (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_max_epu8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxub512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_max_epu16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxuw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_max_epu16 (__mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxuw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi(), (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_max_epu16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxuw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_min_epi8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_min_epi8 (__mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi(), (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_min_epi8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_min_epi16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_min_epi16 (__mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi(), (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_min_epi16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_min_epu8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminub512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_min_epu8 (__mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminub512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi(), (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_min_epu8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminub512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_min_epu16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminuw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_min_epu16 (__mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminuw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi(), (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_min_epu16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminuw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __M); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_shuffle_epi8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pshufb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_shuffle_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pshufb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_shuffle_epi8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pshufb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_subs_epi8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_subs_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_subs_epi8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubsb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_subs_epi16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_subs_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_subs_epi16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubsw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_subs_epu8 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubusb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_subs_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubusb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) __W, (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_subs_epu8 (__mmask64 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubusb512_mask ((__v64qi) __A, (__v64qi) __B, (__v64qi) _mm512_setzero_qi (), (__mmask64) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_subs_epu16 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubusw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_subs_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubusw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) __W, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_subs_epu16 (__mmask32 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubusw512_mask ((__v32hi) __A, (__v32hi) __B, (__v32hi) _mm512_setzero_hi (), (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask2_permutex2var_epi16 (__m512i __A, __m512i __I, __mmask32 __U, __m512i __B) { return (__m512i) __builtin_ia32_vpermi2varhi512_mask ((__v32hi) __A, (__v32hi) __I /* idx */ , (__v32hi) __B, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_permutex2var_epi16 (__m512i __A, __m512i __I, __m512i __B) { return (__m512i) __builtin_ia32_vpermt2varhi512_mask ((__v32hi) __I /* idx */, (__v32hi) __A, (__v32hi) __B, (__mmask32) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_permutex2var_epi16 (__m512i __A, __mmask32 __U, __m512i __I, __m512i __B) { return (__m512i) __builtin_ia32_vpermt2varhi512_mask ((__v32hi) __I /* idx */, (__v32hi) __A, (__v32hi) __B, (__mmask32) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_permutex2var_epi16 (__mmask32 __U, __m512i __A, __m512i __I, __m512i __B) { return (__m512i) __builtin_ia32_vpermt2varhi512_maskz ((__v32hi) __I /* idx */ , (__v32hi) __A, (__v32hi) __B, (__mmask32) __U); } #define _mm512_cmp_epi8_mask(a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \ (__v64qi)(__m512i)(b), \ (p), (__mmask64)-1); }) #define _mm512_mask_cmp_epi8_mask(m, a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \ (__v64qi)(__m512i)(b), \ (p), (__mmask64)(m)); }) #define _mm512_cmp_epu8_mask(a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \ (__v64qi)(__m512i)(b), \ (p), (__mmask64)-1); }) #define _mm512_mask_cmp_epu8_mask(m, a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \ (__v64qi)(__m512i)(b), \ (p), (__mmask64)(m)); }) #define _mm512_cmp_epi16_mask(a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \ (__v32hi)(__m512i)(b), \ (p), (__mmask32)-1); }) #define _mm512_mask_cmp_epi16_mask(m, a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \ (__v32hi)(__m512i)(b), \ (p), (__mmask32)(m)); }) #define _mm512_cmp_epu16_mask(a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \ (__v32hi)(__m512i)(b), \ (p), (__mmask32)-1); }) #define _mm512_mask_cmp_epu16_mask(m, a, b, p) __extension__ ({ \ (__mmask16)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \ (__v32hi)(__m512i)(b), \ (p), (__mmask32)(m)); }) #undef __DEFAULT_FN_ATTRS #endif
0
repos/DirectXShaderCompiler/tools/clang/lib
repos/DirectXShaderCompiler/tools/clang/lib/Headers/avx512fintrin.h
/*===---- avx512fintrin.h - AVX2 intrinsics --------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __IMMINTRIN_H #error "Never use <avx512fintrin.h> directly; include <immintrin.h> instead." #endif #ifndef __AVX512FINTRIN_H #define __AVX512FINTRIN_H typedef double __v8df __attribute__((__vector_size__(64))); typedef float __v16sf __attribute__((__vector_size__(64))); typedef long long __v8di __attribute__((__vector_size__(64))); typedef int __v16si __attribute__((__vector_size__(64))); typedef float __m512 __attribute__((__vector_size__(64))); typedef double __m512d __attribute__((__vector_size__(64))); typedef long long __m512i __attribute__((__vector_size__(64))); typedef unsigned char __mmask8; typedef unsigned short __mmask16; /* Rounding mode macros. */ #define _MM_FROUND_TO_NEAREST_INT 0x00 #define _MM_FROUND_TO_NEG_INF 0x01 #define _MM_FROUND_TO_POS_INF 0x02 #define _MM_FROUND_TO_ZERO 0x03 #define _MM_FROUND_CUR_DIRECTION 0x04 /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) /* Create vectors with repeated elements */ static __inline __m512i __DEFAULT_FN_ATTRS _mm512_setzero_si512(void) { return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 }; } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_set1_epi32(__mmask16 __M, int __A) { return (__m512i) __builtin_ia32_pbroadcastd512_gpr_mask (__A, (__v16si) _mm512_setzero_si512 (), __M); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_set1_epi64(__mmask8 __M, long long __A) { #ifdef __x86_64__ return (__m512i) __builtin_ia32_pbroadcastq512_gpr_mask (__A, (__v8di) _mm512_setzero_si512 (), __M); #else return (__m512i) __builtin_ia32_pbroadcastq512_mem_mask (__A, (__v8di) _mm512_setzero_si512 (), __M); #endif } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_setzero_ps(void) { return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_setzero_pd(void) { return (__m512d){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_set1_ps(float __w) { return (__m512){ __w, __w, __w, __w, __w, __w, __w, __w, __w, __w, __w, __w, __w, __w, __w, __w }; } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_set1_pd(double __w) { return (__m512d){ __w, __w, __w, __w, __w, __w, __w, __w }; } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_set1_epi32(int __s) { return (__m512i)(__v16si){ __s, __s, __s, __s, __s, __s, __s, __s, __s, __s, __s, __s, __s, __s, __s, __s }; } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_set1_epi64(long long __d) { return (__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d }; } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_broadcastss_ps(__m128 __X) { float __f = __X[0]; return (__v16sf){ __f, __f, __f, __f, __f, __f, __f, __f, __f, __f, __f, __f, __f, __f, __f, __f }; } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_broadcastsd_pd(__m128d __X) { double __d = __X[0]; return (__v8df){ __d, __d, __d, __d, __d, __d, __d, __d }; } /* Cast between vector types */ static __inline __m512d __DEFAULT_FN_ATTRS _mm512_castpd256_pd512(__m256d __a) { return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, -1, -1, -1, -1); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_castps256_ps512(__m256 __a) { return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1); } static __inline __m128d __DEFAULT_FN_ATTRS _mm512_castpd512_pd128(__m512d __a) { return __builtin_shufflevector(__a, __a, 0, 1); } static __inline __m128 __DEFAULT_FN_ATTRS _mm512_castps512_ps128(__m512 __a) { return __builtin_shufflevector(__a, __a, 0, 1, 2, 3); } /* Bitwise operators */ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_and_epi32(__m512i __a, __m512i __b) { return __a & __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_and_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a, (__v16si) __b, (__v16si) __src, (__mmask16) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_and_epi32(__mmask16 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a, (__v16si) __b, (__v16si) _mm512_setzero_si512 (), (__mmask16) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_and_epi64(__m512i __a, __m512i __b) { return __a & __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_and_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a, (__v8di) __b, (__v8di) __src, (__mmask8) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_and_epi64(__mmask8 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a, (__v8di) __b, (__v8di) _mm512_setzero_si512 (), (__mmask8) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_andnot_epi32 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pandnd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_andnot_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pandnd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) __W, (__mmask16) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_andnot_epi32 (__mmask16 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pandnd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_andnot_epi64 (__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pandnq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_andnot_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pandnq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) __W, __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_andnot_epi64 (__mmask8 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pandnq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_pd (), __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_or_epi32(__m512i __a, __m512i __b) { return __a | __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_or_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pord512_mask((__v16si) __a, (__v16si) __b, (__v16si) __src, (__mmask16) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_or_epi32(__mmask16 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pord512_mask((__v16si) __a, (__v16si) __b, (__v16si) _mm512_setzero_si512 (), (__mmask16) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_or_epi64(__m512i __a, __m512i __b) { return __a | __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_or_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_porq512_mask ((__v8di) __a, (__v8di) __b, (__v8di) __src, (__mmask8) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_or_epi64(__mmask8 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_porq512_mask ((__v8di) __a, (__v8di) __b, (__v8di) _mm512_setzero_si512 (), (__mmask8) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_xor_epi32(__m512i __a, __m512i __b) { return __a ^ __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_xor_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pxord512_mask((__v16si) __a, (__v16si) __b, (__v16si) __src, (__mmask16) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_xor_epi32(__mmask16 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pxord512_mask((__v16si) __a, (__v16si) __b, (__v16si) _mm512_setzero_si512 (), (__mmask16) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_xor_epi64(__m512i __a, __m512i __b) { return __a ^ __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_xor_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pxorq512_mask ((__v8di) __a, (__v8di) __b, (__v8di) __src, (__mmask8) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_xor_epi64(__mmask8 __k, __m512i __a, __m512i __b) { return (__m512i) __builtin_ia32_pxorq512_mask ((__v8di) __a, (__v8di) __b, (__v8di) _mm512_setzero_si512 (), (__mmask8) __k); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_and_si512(__m512i __a, __m512i __b) { return __a & __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_or_si512(__m512i __a, __m512i __b) { return __a | __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_xor_si512(__m512i __a, __m512i __b) { return __a ^ __b; } /* Arithmetic */ static __inline __m512d __DEFAULT_FN_ATTRS _mm512_add_pd(__m512d __a, __m512d __b) { return __a + __b; } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_add_ps(__m512 __a, __m512 __b) { return __a + __b; } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_mul_pd(__m512d __a, __m512d __b) { return __a * __b; } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_mul_ps(__m512 __a, __m512 __b) { return __a * __b; } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_sub_pd(__m512d __a, __m512d __b) { return __a - __b; } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_sub_ps(__m512 __a, __m512 __b) { return __a - __b; } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_add_epi64 (__m512i __A, __m512i __B) { return (__m512i) ((__v8di) __A + (__v8di) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_add_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) __W, (__mmask8) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_add_epi64 (__mmask8 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_si512 (), (__mmask8) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_sub_epi64 (__m512i __A, __m512i __B) { return (__m512i) ((__v8di) __A - (__v8di) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_sub_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) __W, (__mmask8) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_sub_epi64 (__mmask8 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_si512 (), (__mmask8) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_add_epi32 (__m512i __A, __m512i __B) { return (__m512i) ((__v16si) __A + (__v16si) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_add_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) __W, (__mmask16) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_add_epi32 (__mmask16 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_paddd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_sub_epi32 (__m512i __A, __m512i __B) { return (__m512i) ((__v16si) __A - (__v16si) __B); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_sub_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) __W, (__mmask16) __U); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_sub_epi32 (__mmask16 __U, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_psubd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) __U); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_max_pd(__m512d __A, __m512d __B) { return (__m512d) __builtin_ia32_maxpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) _mm512_setzero_pd (), (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_max_ps(__m512 __A, __m512 __B) { return (__m512) __builtin_ia32_maxps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) _mm512_setzero_ps (), (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_max_epi32(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_max_epu32(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxud512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_max_epi64(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxsq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_max_epu64(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmaxuq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_min_pd(__m512d __A, __m512d __B) { return (__m512d) __builtin_ia32_minpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) _mm512_setzero_pd (), (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_min_ps(__m512 __A, __m512 __B) { return (__m512) __builtin_ia32_minps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) _mm512_setzero_ps (), (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_min_epi32(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsd512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_min_epu32(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminud512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_min_epi64(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminsq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_min_epu64(__m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pminuq512_mask ((__v8di) __A, (__v8di) __B, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mul_epi32(__m512i __X, __m512i __Y) { return (__m512i) __builtin_ia32_pmuldq512_mask ((__v16si) __X, (__v16si) __Y, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mask_mul_epi32 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y) { return (__m512i) __builtin_ia32_pmuldq512_mask ((__v16si) __X, (__v16si) __Y, (__v8di) __W, __M); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_mul_epi32 (__mmask8 __M, __m512i __X, __m512i __Y) { return (__m512i) __builtin_ia32_pmuldq512_mask ((__v16si) __X, (__v16si) __Y, (__v8di) _mm512_setzero_si512 (), __M); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mul_epu32(__m512i __X, __m512i __Y) { return (__m512i) __builtin_ia32_pmuludq512_mask ((__v16si) __X, (__v16si) __Y, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mask_mul_epu32 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y) { return (__m512i) __builtin_ia32_pmuludq512_mask ((__v16si) __X, (__v16si) __Y, (__v8di) __W, __M); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_mul_epu32 (__mmask8 __M, __m512i __X, __m512i __Y) { return (__m512i) __builtin_ia32_pmuludq512_mask ((__v16si) __X, (__v16si) __Y, (__v8di) _mm512_setzero_si512 (), __M); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mullo_epi32 (__m512i __A, __m512i __B) { return (__m512i) ((__v16si) __A * (__v16si) __B); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_mullo_epi32 (__mmask16 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmulld512_mask ((__v16si) __A, (__v16si) __B, (__v16si) _mm512_setzero_si512 (), __M); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mask_mullo_epi32 (__m512i __W, __mmask16 __M, __m512i __A, __m512i __B) { return (__m512i) __builtin_ia32_pmulld512_mask ((__v16si) __A, (__v16si) __B, (__v16si) __W, __M); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_sqrt_pd(__m512d a) { return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)a, (__v8df) _mm512_setzero_pd (), (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_sqrt_ps(__m512 a) { return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)a, (__v16sf) _mm512_setzero_ps (), (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_rsqrt14_pd(__m512d __A) { return (__m512d) __builtin_ia32_rsqrt14pd512_mask ((__v8df) __A, (__v8df) _mm512_setzero_pd (), (__mmask8) -1);} static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_rsqrt14_ps(__m512 __A) { return (__m512) __builtin_ia32_rsqrt14ps512_mask ((__v16sf) __A, (__v16sf) _mm512_setzero_ps (), (__mmask16) -1); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_rsqrt14_ss(__m128 __A, __m128 __B) { return (__m128) __builtin_ia32_rsqrt14ss_mask ((__v4sf) __A, (__v4sf) __B, (__v4sf) _mm_setzero_ps (), (__mmask8) -1); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_rsqrt14_sd(__m128d __A, __m128d __B) { return (__m128d) __builtin_ia32_rsqrt14sd_mask ((__v2df) __A, (__v2df) __B, (__v2df) _mm_setzero_pd (), (__mmask8) -1); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_rcp14_pd(__m512d __A) { return (__m512d) __builtin_ia32_rcp14pd512_mask ((__v8df) __A, (__v8df) _mm512_setzero_pd (), (__mmask8) -1); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_rcp14_ps(__m512 __A) { return (__m512) __builtin_ia32_rcp14ps512_mask ((__v16sf) __A, (__v16sf) _mm512_setzero_ps (), (__mmask16) -1); } static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_rcp14_ss(__m128 __A, __m128 __B) { return (__m128) __builtin_ia32_rcp14ss_mask ((__v4sf) __A, (__v4sf) __B, (__v4sf) _mm_setzero_ps (), (__mmask8) -1); } static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_rcp14_sd(__m128d __A, __m128d __B) { return (__m128d) __builtin_ia32_rcp14sd_mask ((__v2df) __A, (__v2df) __B, (__v2df) _mm_setzero_pd (), (__mmask8) -1); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_floor_ps(__m512 __A) { return (__m512) __builtin_ia32_rndscaleps_mask ((__v16sf) __A, _MM_FROUND_FLOOR, (__v16sf) __A, -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_floor_pd(__m512d __A) { return (__m512d) __builtin_ia32_rndscalepd_mask ((__v8df) __A, _MM_FROUND_FLOOR, (__v8df) __A, -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_ceil_ps(__m512 __A) { return (__m512) __builtin_ia32_rndscaleps_mask ((__v16sf) __A, _MM_FROUND_CEIL, (__v16sf) __A, -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_ceil_pd(__m512d __A) { return (__m512d) __builtin_ia32_rndscalepd_mask ((__v8df) __A, _MM_FROUND_CEIL, (__v8df) __A, -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_abs_epi64(__m512i __A) { return (__m512i) __builtin_ia32_pabsq512_mask ((__v8di) __A, (__v8di) _mm512_setzero_si512 (), (__mmask8) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_abs_epi32(__m512i __A) { return (__m512i) __builtin_ia32_pabsd512_mask ((__v16si) __A, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1); } #define _mm512_roundscale_ps(A, B) __extension__ ({ \ (__m512)__builtin_ia32_rndscaleps_mask((__v16sf)(A), (B), (__v16sf)(A), \ -1, _MM_FROUND_CUR_DIRECTION); }) #define _mm512_roundscale_pd(A, B) __extension__ ({ \ (__m512d)__builtin_ia32_rndscalepd_mask((__v8df)(A), (B), (__v8df)(A), \ -1, _MM_FROUND_CUR_DIRECTION); }) #define _mm512_fmadd_round_pd(A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) -1, (R)); }) #define _mm512_mask_fmadd_round_pd(A, U, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_mask3_fmadd_round_pd(A, B, C, U, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask3 ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_maskz_fmadd_round_pd(U, A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_fmsub_round_pd(A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) -1, (R)); }) #define _mm512_mask_fmsub_round_pd(A, U, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_maskz_fmsub_round_pd(U, A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_fnmadd_round_pd(A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) -1, (R)); }) #define _mm512_mask3_fnmadd_round_pd(A, B, C, U, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask3 (-(__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_maskz_fnmadd_round_pd(U, A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_fnmsub_round_pd(A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) -1, (R)); }) #define _mm512_maskz_fnmsub_round_pd(U, A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) (U), (R)); }) static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_fmadd_pd(__m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_fmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask3_fmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { return (__m512d) __builtin_ia32_vfmaddpd512_mask3 ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_maskz_fmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_fmsub_pd(__m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_fmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_maskz_fmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask3_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { return (__m512d) __builtin_ia32_vfmaddpd512_mask3 (-(__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_maskz_fnmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_maskz_fnmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_fmadd_round_ps(A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) -1, (R)); }) #define _mm512_mask_fmadd_round_ps(A, U, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_mask3_fmadd_round_ps(A, B, C, U, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask3 ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_maskz_fmadd_round_ps(U, A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_fmsub_round_ps(A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) -1, (R)); }) #define _mm512_mask_fmsub_round_ps(A, U, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_maskz_fmsub_round_ps(U, A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_fnmadd_round_ps(A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) -1, (R)); }) #define _mm512_mask3_fnmadd_round_ps(A, B, C, U, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask3 (-(__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_maskz_fnmadd_round_ps(U, A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_fnmsub_round_ps(A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) -1, (R)); }) #define _mm512_maskz_fnmsub_round_ps(U, A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) (U), (R)); }) static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_fmadd_ps(__m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_fmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask3_fmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { return (__m512) __builtin_ia32_vfmaddps512_mask3 ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_fmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_fmsub_ps(__m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_fmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_fmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask3_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { return (__m512) __builtin_ia32_vfmaddps512_mask3 (-(__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_fnmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_fnmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_fmaddsub_round_pd(A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) -1, (R)); }) #define _mm512_mask_fmaddsub_round_pd(A, U, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_mask3_fmaddsub_round_pd(A, B, C, U, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddsubpd512_mask3 ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_maskz_fmaddsub_round_pd(U, A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_fmsubadd_round_pd(A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) -1, (R)); }) #define _mm512_mask_fmsubadd_round_pd(A, U, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_maskz_fmsubadd_round_pd(U, A, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) (A), \ (__v8df) (B), -(__v8df) (C), \ (__mmask8) (U), (R)); }) static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_fmaddsub_pd(__m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_fmaddsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask3_fmaddsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { return (__m512d) __builtin_ia32_vfmaddsubpd512_mask3 ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_maskz_fmaddsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_fmsubadd_pd(__m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_fmsubadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_maskz_fmsubadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) __A, (__v8df) __B, -(__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_fmaddsub_round_ps(A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) -1, (R)); }) #define _mm512_mask_fmaddsub_round_ps(A, U, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_mask3_fmaddsub_round_ps(A, B, C, U, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddsubps512_mask3 ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_maskz_fmaddsub_round_ps(U, A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_fmsubadd_round_ps(A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) -1, (R)); }) #define _mm512_mask_fmsubadd_round_ps(A, U, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_maskz_fmsubadd_round_ps(U, A, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) (A), \ (__v16sf) (B), -(__v16sf) (C), \ (__mmask16) (U), (R)); }) static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_fmaddsub_ps(__m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_fmaddsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask3_fmaddsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { return (__m512) __builtin_ia32_vfmaddsubps512_mask3 ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_fmaddsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_fmsubadd_ps(__m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_fmsubadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_maskz_fmsubadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) __A, (__v16sf) __B, -(__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask3_fmsub_round_pd(A, B, C, U, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmsubpd512_mask3 ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask3_fmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { return (__m512d) __builtin_ia32_vfmsubpd512_mask3 ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask3_fmsub_round_ps(A, B, C, U, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmsubps512_mask3 ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask3_fmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { return (__m512) __builtin_ia32_vfmsubps512_mask3 ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask3_fmsubadd_round_pd(A, B, C, U, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfmsubaddpd512_mask3 ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask3_fmsubadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { return (__m512d) __builtin_ia32_vfmsubaddpd512_mask3 ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask3_fmsubadd_round_ps(A, B, C, U, R) __extension__ ({ \ (__m512) __builtin_ia32_vfmsubaddps512_mask3 ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask3_fmsubadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { return (__m512) __builtin_ia32_vfmsubaddps512_mask3 ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask_fnmadd_round_pd(A, U, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfnmaddpd512_mask ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_fnmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfnmaddpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask_fnmadd_round_ps(A, U, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfnmaddps512_mask ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_fnmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfnmaddps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask_fnmsub_round_pd(A, U, B, C, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfnmsubpd512_mask ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) #define _mm512_mask3_fnmsub_round_pd(A, B, C, U, R) __extension__ ({ \ (__m512d) __builtin_ia32_vfnmsubpd512_mask3 ((__v8df) (A), \ (__v8df) (B), (__v8df) (C), \ (__mmask8) (U), (R)); }) static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_fnmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { return (__m512d) __builtin_ia32_vfnmsubpd512_mask ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask3_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { return (__m512d) __builtin_ia32_vfnmsubpd512_mask3 ((__v8df) __A, (__v8df) __B, (__v8df) __C, (__mmask8) __U, _MM_FROUND_CUR_DIRECTION); } #define _mm512_mask_fnmsub_round_ps(A, U, B, C, R) __extension__ ({ \ (__m512) __builtin_ia32_vfnmsubps512_mask ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) #define _mm512_mask3_fnmsub_round_ps(A, B, C, U, R) __extension__ ({ \ (__m512) __builtin_ia32_vfnmsubps512_mask3 ((__v16sf) (A), \ (__v16sf) (B), (__v16sf) (C), \ (__mmask16) (U), (R)); }) static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_fnmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { return (__m512) __builtin_ia32_vfnmsubps512_mask ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask3_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { return (__m512) __builtin_ia32_vfnmsubps512_mask3 ((__v16sf) __A, (__v16sf) __B, (__v16sf) __C, (__mmask16) __U, _MM_FROUND_CUR_DIRECTION); } /* Vector permutations */ static __inline __m512i __DEFAULT_FN_ATTRS _mm512_permutex2var_epi32(__m512i __A, __m512i __I, __m512i __B) { return (__m512i) __builtin_ia32_vpermt2vard512_mask ((__v16si) __I /* idx */ , (__v16si) __A, (__v16si) __B, (__mmask16) -1); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_permutex2var_epi64(__m512i __A, __m512i __I, __m512i __B) { return (__m512i) __builtin_ia32_vpermt2varq512_mask ((__v8di) __I /* idx */ , (__v8di) __A, (__v8di) __B, (__mmask8) -1); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_permutex2var_pd(__m512d __A, __m512i __I, __m512d __B) { return (__m512d) __builtin_ia32_vpermt2varpd512_mask ((__v8di) __I /* idx */ , (__v8df) __A, (__v8df) __B, (__mmask8) -1); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_permutex2var_ps(__m512 __A, __m512i __I, __m512 __B) { return (__m512) __builtin_ia32_vpermt2varps512_mask ((__v16si) __I /* idx */ , (__v16sf) __A, (__v16sf) __B, (__mmask16) -1); } #define _mm512_alignr_epi64(A, B, I) __extension__ ({ \ (__m512i)__builtin_ia32_alignq512_mask((__v8di)(__m512i)(A), \ (__v8di)(__m512i)(B), \ (I), (__v8di)_mm512_setzero_si512(), \ (__mmask8)-1); }) #define _mm512_alignr_epi32(A, B, I) __extension__ ({ \ (__m512i)__builtin_ia32_alignd512_mask((__v16si)(__m512i)(A), \ (__v16si)(__m512i)(B), \ (I), (__v16si)_mm512_setzero_si512(), \ (__mmask16)-1); }) /* Vector Extract */ #define _mm512_extractf64x4_pd(A, I) __extension__ ({ \ __m512d __A = (A); \ (__m256d) \ __builtin_ia32_extractf64x4_mask((__v8df)__A, \ (I), \ (__v4df)_mm256_setzero_si256(), \ (__mmask8) -1); }) #define _mm512_extractf32x4_ps(A, I) __extension__ ({ \ __m512 __A = (A); \ (__m128) \ __builtin_ia32_extractf32x4_mask((__v16sf)__A, \ (I), \ (__v4sf)_mm_setzero_ps(), \ (__mmask8) -1); }) /* Vector Blend */ static __inline __m512d __DEFAULT_FN_ATTRS _mm512_mask_blend_pd(__mmask8 __U, __m512d __A, __m512d __W) { return (__m512d) __builtin_ia32_blendmpd_512_mask ((__v8df) __A, (__v8df) __W, (__mmask8) __U); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_mask_blend_ps(__mmask16 __U, __m512 __A, __m512 __W) { return (__m512) __builtin_ia32_blendmps_512_mask ((__v16sf) __A, (__v16sf) __W, (__mmask16) __U); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mask_blend_epi64(__mmask8 __U, __m512i __A, __m512i __W) { return (__m512i) __builtin_ia32_blendmq_512_mask ((__v8di) __A, (__v8di) __W, (__mmask8) __U); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_mask_blend_epi32(__mmask16 __U, __m512i __A, __m512i __W) { return (__m512i) __builtin_ia32_blendmd_512_mask ((__v16si) __A, (__v16si) __W, (__mmask16) __U); } /* Compare */ #define _mm512_cmp_round_ps_mask(A, B, P, R) __extension__ ({ \ (__mmask16)__builtin_ia32_cmpps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (P), (__mmask16)-1, (R)); }) #define _mm512_mask_cmp_round_ps_mask(U, A, B, P, R) __extension__ ({ \ (__mmask16)__builtin_ia32_cmpps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (P), (__mmask16)(U), (R)); }) #define _mm512_cmp_ps_mask(A, B, P) \ _mm512_cmp_round_ps_mask((A), (B), (P), _MM_FROUND_CUR_DIRECTION) #define _mm512_mask_cmp_ps_mask(U, A, B, P) \ _mm512_mask_cmp_round_ps_mask((U), (A), (B), (P), _MM_FROUND_CUR_DIRECTION) #define _mm512_cmp_round_pd_mask(A, B, P, R) __extension__ ({ \ (__mmask8)__builtin_ia32_cmppd512_mask((__v8df)(__m512d)(A), \ (__v8df)(__m512d)(B), \ (P), (__mmask8)-1, (R)); }) #define _mm512_mask_cmp_round_pd_mask(U, A, B, P, R) __extension__ ({ \ (__mmask8)__builtin_ia32_cmppd512_mask((__v8df)(__m512d)(A), \ (__v8df)(__m512d)(B), \ (P), (__mmask8)(U), (R)); }) #define _mm512_cmp_pd_mask(A, B, P) \ _mm512_cmp_round_pd_mask((A), (B), (P), _MM_FROUND_CUR_DIRECTION) #define _mm512_mask_cmp_pd_mask(U, A, B, P) \ _mm512_mask_cmp_round_pd_mask((U), (A), (B), (P), _MM_FROUND_CUR_DIRECTION) /* Conversion */ static __inline __m512i __DEFAULT_FN_ATTRS _mm512_cvttps_epu32(__m512 __A) { return (__m512i) __builtin_ia32_cvttps2udq512_mask ((__v16sf) __A, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } #define _mm512_cvt_roundepi32_ps(A, R) __extension__ ({ \ (__m512)__builtin_ia32_cvtdq2ps512_mask((__v16si)(A), \ (__v16sf)_mm512_setzero_ps(), \ (__mmask16)-1, (R)); }) #define _mm512_cvt_roundepu32_ps(A, R) __extension__ ({ \ (__m512)__builtin_ia32_cvtudq2ps512_mask((__v16si)(A), \ (__v16sf)_mm512_setzero_ps(), \ (__mmask16)-1, (R)); }) static __inline __m512d __DEFAULT_FN_ATTRS _mm512_cvtepi32_pd(__m256i __A) { return (__m512d) __builtin_ia32_cvtdq2pd512_mask ((__v8si) __A, (__v8df) _mm512_setzero_pd (), (__mmask8) -1); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_cvtepu32_pd(__m256i __A) { return (__m512d) __builtin_ia32_cvtudq2pd512_mask ((__v8si) __A, (__v8df) _mm512_setzero_pd (), (__mmask8) -1); } #define _mm512_cvt_roundpd_ps(A, R) __extension__ ({ \ (__m256)__builtin_ia32_cvtpd2ps512_mask((__v8df)(A), \ (__v8sf)_mm256_setzero_ps(), \ (__mmask8)-1, (R)); }) #define _mm512_cvtps_ph(A, I) __extension__ ({ \ (__m256i)__builtin_ia32_vcvtps2ph512_mask((__v16sf)(A), (I), \ (__v16hi)_mm256_setzero_si256(), \ -1); }) static __inline __m512 __DEFAULT_FN_ATTRS _mm512_cvtph_ps(__m256i __A) { return (__m512) __builtin_ia32_vcvtph2ps512_mask ((__v16hi) __A, (__v16sf) _mm512_setzero_ps (), (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_cvttps_epi32(__m512 a) { return (__m512i) __builtin_ia32_cvttps2dq512_mask((__v16sf) a, (__v16si) _mm512_setzero_si512 (), (__mmask16) -1, _MM_FROUND_CUR_DIRECTION); } static __inline __m256i __DEFAULT_FN_ATTRS _mm512_cvttpd_epi32(__m512d a) { return (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df) a, (__v8si)_mm256_setzero_si256(), (__mmask8) -1, _MM_FROUND_CUR_DIRECTION); } #define _mm512_cvtt_roundpd_epi32(A, R) __extension__ ({ \ (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df)(A), \ (__v8si)_mm256_setzero_si256(), \ (__mmask8)-1, (R)); }) #define _mm512_cvtt_roundps_epi32(A, R) __extension__ ({ \ (__m512i)__builtin_ia32_cvttps2dq512_mask((__v16sf)(A), \ (__v16si)_mm512_setzero_si512(), \ (__mmask16)-1, (R)); }) #define _mm512_cvt_roundps_epi32(A, R) __extension__ ({ \ (__m512i)__builtin_ia32_cvtps2dq512_mask((__v16sf)(A), \ (__v16si)_mm512_setzero_si512(), \ (__mmask16)-1, (R)); }) #define _mm512_cvt_roundpd_epi32(A, R) __extension__ ({ \ (__m256i)__builtin_ia32_cvtpd2dq512_mask((__v8df)(A), \ (__v8si)_mm256_setzero_si256(), \ (__mmask8)-1, (R)); }) #define _mm512_cvt_roundps_epu32(A, R) __extension__ ({ \ (__m512i)__builtin_ia32_cvtps2udq512_mask((__v16sf)(A), \ (__v16si)_mm512_setzero_si512(), \ (__mmask16)-1, (R)); }) #define _mm512_cvt_roundpd_epu32(A, R) __extension__ ({ \ (__m256i)__builtin_ia32_cvtpd2udq512_mask((__v8df)(A), \ (__v8si)_mm256_setzero_si256(), \ (__mmask8) -1, (R)); }) /* Unpack and Interleave */ static __inline __m512d __DEFAULT_FN_ATTRS _mm512_unpackhi_pd(__m512d __a, __m512d __b) { return __builtin_shufflevector(__a, __b, 1, 9, 1+2, 9+2, 1+4, 9+4, 1+6, 9+6); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_unpacklo_pd(__m512d __a, __m512d __b) { return __builtin_shufflevector(__a, __b, 0, 8, 0+2, 8+2, 0+4, 8+4, 0+6, 8+6); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_unpackhi_ps(__m512 __a, __m512 __b) { return __builtin_shufflevector(__a, __b, 2, 18, 3, 19, 2+4, 18+4, 3+4, 19+4, 2+8, 18+8, 3+8, 19+8, 2+12, 18+12, 3+12, 19+12); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_unpacklo_ps(__m512 __a, __m512 __b) { return __builtin_shufflevector(__a, __b, 0, 16, 1, 17, 0+4, 16+4, 1+4, 17+4, 0+8, 16+8, 1+8, 17+8, 0+12, 16+12, 1+12, 17+12); } /* Bit Test */ static __inline __mmask16 __DEFAULT_FN_ATTRS _mm512_test_epi32_mask(__m512i __A, __m512i __B) { return (__mmask16) __builtin_ia32_ptestmd512 ((__v16si) __A, (__v16si) __B, (__mmask16) -1); } static __inline __mmask8 __DEFAULT_FN_ATTRS _mm512_test_epi64_mask(__m512i __A, __m512i __B) { return (__mmask8) __builtin_ia32_ptestmq512 ((__v8di) __A, (__v8di) __B, (__mmask8) -1); } /* SIMD load ops */ static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_loadu_epi32(__mmask16 __U, void const *__P) { return (__m512i) __builtin_ia32_loaddqusi512_mask ((const __v16si *)__P, (__v16si) _mm512_setzero_si512 (), (__mmask16) __U); } static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_loadu_epi64(__mmask8 __U, void const *__P) { return (__m512i) __builtin_ia32_loaddqudi512_mask ((const __v8di *)__P, (__v8di) _mm512_setzero_si512 (), (__mmask8) __U); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_maskz_loadu_ps(__mmask16 __U, void const *__P) { return (__m512) __builtin_ia32_loadups512_mask ((const __v16sf *)__P, (__v16sf) _mm512_setzero_ps (), (__mmask16) __U); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_maskz_loadu_pd(__mmask8 __U, void const *__P) { return (__m512d) __builtin_ia32_loadupd512_mask ((const __v8df *)__P, (__v8df) _mm512_setzero_pd (), (__mmask8) __U); } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_maskz_load_ps(__mmask16 __U, void const *__P) { return (__m512) __builtin_ia32_loadaps512_mask ((const __v16sf *)__P, (__v16sf) _mm512_setzero_ps (), (__mmask16) __U); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_maskz_load_pd(__mmask8 __U, void const *__P) { return (__m512d) __builtin_ia32_loadapd512_mask ((const __v8df *)__P, (__v8df) _mm512_setzero_pd (), (__mmask8) __U); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_loadu_pd(double const *__p) { struct __loadu_pd { __m512d __v; } __attribute__((__packed__, __may_alias__)); return ((struct __loadu_pd*)__p)->__v; } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_loadu_ps(float const *__p) { struct __loadu_ps { __m512 __v; } __attribute__((__packed__, __may_alias__)); return ((struct __loadu_ps*)__p)->__v; } static __inline __m512 __DEFAULT_FN_ATTRS _mm512_load_ps(double const *__p) { return (__m512) __builtin_ia32_loadaps512_mask ((const __v16sf *)__p, (__v16sf) _mm512_setzero_ps (), (__mmask16) -1); } static __inline __m512d __DEFAULT_FN_ATTRS _mm512_load_pd(float const *__p) { return (__m512d) __builtin_ia32_loadapd512_mask ((const __v8df *)__p, (__v8df) _mm512_setzero_pd (), (__mmask8) -1); } /* SIMD store ops */ static __inline void __DEFAULT_FN_ATTRS _mm512_mask_storeu_epi64(void *__P, __mmask8 __U, __m512i __A) { __builtin_ia32_storedqudi512_mask ((__v8di *)__P, (__v8di) __A, (__mmask8) __U); } static __inline void __DEFAULT_FN_ATTRS _mm512_mask_storeu_epi32(void *__P, __mmask16 __U, __m512i __A) { __builtin_ia32_storedqusi512_mask ((__v16si *)__P, (__v16si) __A, (__mmask16) __U); } static __inline void __DEFAULT_FN_ATTRS _mm512_mask_storeu_pd(void *__P, __mmask8 __U, __m512d __A) { __builtin_ia32_storeupd512_mask ((__v8df *)__P, (__v8df) __A, (__mmask8) __U); } static __inline void __DEFAULT_FN_ATTRS _mm512_storeu_pd(void *__P, __m512d __A) { __builtin_ia32_storeupd512_mask((__v8df *)__P, (__v8df)__A, (__mmask8)-1); } static __inline void __DEFAULT_FN_ATTRS _mm512_mask_storeu_ps(void *__P, __mmask16 __U, __m512 __A) { __builtin_ia32_storeups512_mask ((__v16sf *)__P, (__v16sf) __A, (__mmask16) __U); } static __inline void __DEFAULT_FN_ATTRS _mm512_storeu_ps(void *__P, __m512 __A) { __builtin_ia32_storeups512_mask((__v16sf *)__P, (__v16sf)__A, (__mmask16)-1); } static __inline void __DEFAULT_FN_ATTRS _mm512_mask_store_pd(void *__P, __mmask8 __U, __m512d __A) { __builtin_ia32_storeapd512_mask ((__v8df *)__P, (__v8df) __A, (__mmask8) __U); } static __inline void __DEFAULT_FN_ATTRS _mm512_store_pd(void *__P, __m512d __A) { *(__m512d*)__P = __A; } static __inline void __DEFAULT_FN_ATTRS _mm512_mask_store_ps(void *__P, __mmask16 __U, __m512 __A) { __builtin_ia32_storeaps512_mask ((__v16sf *)__P, (__v16sf) __A, (__mmask16) __U); } static __inline void __DEFAULT_FN_ATTRS _mm512_store_ps(void *__P, __m512 __A) { *(__m512*)__P = __A; } /* Mask ops */ static __inline __mmask16 __DEFAULT_FN_ATTRS _mm512_knot(__mmask16 __M) { return __builtin_ia32_knothi(__M); } /* Integer compare */ static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpeq_epi32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_pcmpeqd512_mask((__v16si)__a, (__v16si)__b, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_pcmpeqd512_mask((__v16si)__a, (__v16si)__b, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpeq_epu32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 0, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 0, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_pcmpeqq512_mask((__v8di)__a, (__v8di)__b, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpeq_epi64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_pcmpeqq512_mask((__v8di)__a, (__v8di)__b, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpeq_epu64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 0, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpeq_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 0, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpge_epi32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 5, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 5, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpge_epu32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 5, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 5, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpge_epi64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 5, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 5, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpge_epu64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 5, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpge_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 5, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpgt_epi32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_pcmpgtd512_mask((__v16si)__a, (__v16si)__b, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_pcmpgtd512_mask((__v16si)__a, (__v16si)__b, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpgt_epu32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 6, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 6, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_pcmpgtq512_mask((__v8di)__a, (__v8di)__b, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpgt_epi64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_pcmpgtq512_mask((__v8di)__a, (__v8di)__b, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpgt_epu64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 6, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpgt_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 6, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmple_epi32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 2, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 2, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmple_epu32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 2, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 2, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmple_epi64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 2, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 2, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmple_epu64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 2, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmple_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 2, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmplt_epi32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 1, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 1, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmplt_epu32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 1, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 1, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmplt_epi64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 1, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 1, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmplt_epu64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 1, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmplt_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 1, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpneq_epi32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 4, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 4, __u); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_cmpneq_epu32_mask(__m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 4, (__mmask16)-1); } static __inline__ __mmask16 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) { return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 4, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpneq_epi64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 4, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 4, __u); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_cmpneq_epu64_mask(__m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 4, (__mmask8)-1); } static __inline__ __mmask8 __DEFAULT_FN_ATTRS _mm512_mask_cmpneq_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) { return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 4, __u); } #define _mm512_cmp_epi32_mask(a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, (p), \ (__mmask16)-1); }) #define _mm512_cmp_epu32_mask(a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, (p), \ (__mmask16)-1); }) #define _mm512_cmp_epi64_mask(a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, (p), \ (__mmask8)-1); }) #define _mm512_cmp_epu64_mask(a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, (p), \ (__mmask8)-1); }) #define _mm512_mask_cmp_epi32_mask(m, a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, (p), \ (__mmask16)(m)); }) #define _mm512_mask_cmp_epu32_mask(m, a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, (p), \ (__mmask16)(m)); }) #define _mm512_mask_cmp_epi64_mask(m, a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, (p), \ (__mmask8)(m)); }) #define _mm512_mask_cmp_epu64_mask(m, a, b, p) __extension__ ({ \ __m512i __a = (a); \ __m512i __b = (b); \ (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, (p), \ (__mmask8)(m)); }) #undef __DEFAULT_FN_ATTRS #endif // __AVX512FINTRIN_H