MLIR  20.0.0git
Macros | Functions | Variables
LLVMTypes.cpp File Reference
#include "TypeDetail.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/TypeSupport.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/TypeSize.h"
#include <optional>
#include "mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc"
#include "mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc"

Go to the source code of this file.

Macros

#define GET_TYPEDEF_CLASSES
 
#define GET_TYPEDEF_LIST
 

Functions

static ParseResult parseFunctionTypes (AsmParser &p, SmallVector< Type > &params, bool &isVarArg)
 
static void printFunctionTypes (AsmPrinter &p, ArrayRef< Type > params, bool isVarArg)
 
static ParseResult parseExtTypeParams (AsmParser &p, SmallVectorImpl< Type > &typeParams, SmallVectorImpl< unsigned int > &intParams)
 Parses the parameter list for a target extension type. More...
 
static void printExtTypeParams (AsmPrinter &p, ArrayRef< Type > typeParams, ArrayRef< unsigned int > intParams)
 
static LLVM_ATTRIBUTE_UNUSED OptionalParseResult generatedTypeParser (AsmParser &parser, StringRef *mnemonic, Type &value)
 These are unused for now. More...
 
static LLVM_ATTRIBUTE_UNUSED LogicalResult generatedTypePrinter (Type def, AsmPrinter &printer)
 
static std::optional< uint64_t > getPointerDataLayoutEntry (DataLayoutEntryListRef params, LLVMPointerType type, PtrDLEntryPos pos)
 Returns the part of the data layout entry that corresponds to pos for the given type by interpreting the list of entries params. More...
 
static std::optional< uint64_t > getStructDataLayoutEntry (DataLayoutEntryListRef params, LLVMStructType type, StructDLEntryPos pos)
 
static uint64_t calculateStructAlignment (const DataLayout &dataLayout, DataLayoutEntryListRef params, LLVMStructType type, StructDLEntryPos pos)
 
static uint64_t extractStructSpecValue (Attribute attr, StructDLEntryPos pos)
 
template<typename VecTy >
static LogicalResult verifyVectorConstructionInvariants (function_ref< InFlightDiagnostic()> emitError, Type elementType, unsigned numElements)
 Verifies that the type about to be constructed is well-formed. More...
 
static bool isCompatibleImpl (Type type, DenseSet< Type > &compatibleTypes)
 

Variables

constexpr static const uint64_t kBitsInByte = 8
 
constexpr static const uint64_t kDefaultPointerSizeBits = 64
 
constexpr static const uint64_t kDefaultPointerAlignment = 8
 
static constexpr llvm::StringRef kSpirvPrefix = "spirv."
 
static constexpr llvm::StringRef kArmSVCount = "aarch64.svcount"
 

Macro Definition Documentation

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 144 of file LLVMTypes.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ calculateStructAlignment()

static uint64_t calculateStructAlignment ( const DataLayout dataLayout,
DataLayoutEntryListRef  params,
LLVMStructType  type,
StructDLEntryPos  pos 
)
static

◆ extractStructSpecValue()

static uint64_t extractStructSpecValue ( Attribute  attr,
StructDLEntryPos  pos 
)
static

Definition at line 595 of file LLVMTypes.cpp.

◆ generatedTypeParser()

static LLVM_ATTRIBUTE_UNUSED OptionalParseResult generatedTypeParser ( AsmParser parser,
StringRef *  mnemonic,
Type value 
)
static

These are unused for now.

TODO: Move over to these once more types have been migrated to TypeDef.

Referenced by parsePDLType().

◆ generatedTypePrinter()

static LLVM_ATTRIBUTE_UNUSED LogicalResult generatedTypePrinter ( Type  def,
AsmPrinter printer 
)
static

◆ getPointerDataLayoutEntry()

static std::optional<uint64_t> getPointerDataLayoutEntry ( DataLayoutEntryListRef  params,
LLVMPointerType  type,
PtrDLEntryPos  pos 
)
static

Returns the part of the data layout entry that corresponds to pos for the given type by interpreting the list of entries params.

For the pointer type in the default address space, returns the default value if the entries do not provide a custom one, for other address spaces returns std::nullopt.

Definition at line 276 of file LLVMTypes.cpp.

References mlir::LLVM::extractPointerSpecValue(), mlir::LLVM::Index, kBitsInByte, kDefaultPointerAlignment, kDefaultPointerSizeBits, and mlir::LLVM::Size.

◆ getStructDataLayoutEntry()

static std::optional<uint64_t> getStructDataLayoutEntry ( DataLayoutEntryListRef  params,
LLVMStructType  type,
StructDLEntryPos  pos 
)
static

Definition at line 539 of file LLVMTypes.cpp.

Referenced by calculateStructAlignment().

◆ isCompatibleImpl()

static bool isCompatibleImpl ( Type  type,
DenseSet< Type > &  compatibleTypes 
)
static

Definition at line 803 of file LLVMTypes.cpp.

Referenced by mlir::LLVM::isCompatibleType().

◆ parseExtTypeParams()

static ParseResult parseExtTypeParams ( AsmParser p,
SmallVectorImpl< Type > &  typeParams,
SmallVectorImpl< unsigned int > &  intParams 
)
static

Parses the parameter list for a target extension type.

The parameter list contains an optional list of type parameters, followed by an optional list of integer parameters. Type and integer parameters cannot be interleaved in the list. extTypeParams ::= typeList? | intList? | (typeList "," intList) typeList ::= type ("," type)* intList ::= integer ("," integer)*

Definition at line 90 of file LLVMTypes.cpp.

References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), mlir::AsmParser::parseCommaSeparatedList(), mlir::AsmParser::parseOptionalInteger(), mlir::LLVM::parsePrettyLLVMType(), and mlir::parseType().

◆ parseFunctionTypes()

static ParseResult parseFunctionTypes ( AsmParser p,
SmallVector< Type > &  params,
bool &  isVarArg 
)
static

◆ printExtTypeParams()

static void printExtTypeParams ( AsmPrinter p,
ArrayRef< Type typeParams,
ArrayRef< unsigned int >  intParams 
)
static

Definition at line 122 of file LLVMTypes.cpp.

◆ printFunctionTypes()

static void printFunctionTypes ( AsmPrinter p,
ArrayRef< Type params,
bool  isVarArg 
)
static

Definition at line 66 of file LLVMTypes.cpp.

References mlir::LLVM::printPrettyLLVMType().

◆ verifyVectorConstructionInvariants()

template<typename VecTy >
static LogicalResult verifyVectorConstructionInvariants ( function_ref< InFlightDiagnostic()>  emitError,
Type  elementType,
unsigned  numElements 
)
static

Verifies that the type about to be constructed is well-formed.

Definition at line 663 of file LLVMTypes.cpp.

References mlir::emitError().

Variable Documentation

◆ kArmSVCount

constexpr llvm::StringRef kArmSVCount = "aarch64.svcount"
staticconstexpr

Definition at line 737 of file LLVMTypes.cpp.

◆ kBitsInByte

constexpr static const uint64_t kBitsInByte = 8
staticconstexpr

Definition at line 30 of file LLVMTypes.cpp.

Referenced by calculateStructAlignment(), and getPointerDataLayoutEntry().

◆ kDefaultPointerAlignment

constexpr static const uint64_t kDefaultPointerAlignment = 8
staticconstexpr

Definition at line 260 of file LLVMTypes.cpp.

Referenced by getPointerDataLayoutEntry().

◆ kDefaultPointerSizeBits

constexpr static const uint64_t kDefaultPointerSizeBits = 64
staticconstexpr

Definition at line 259 of file LLVMTypes.cpp.

Referenced by getPointerDataLayoutEntry().

◆ kSpirvPrefix

constexpr llvm::StringRef kSpirvPrefix = "spirv."
staticconstexpr

Definition at line 736 of file LLVMTypes.cpp.