MLIR  16.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 "mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc"
#include "mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc"
+ Include dependency graph for LLVMTypes.cpp:

Go to the source code of this file.

Macros

#define GET_TYPEDEF_CLASSES
 
#define GET_TYPEDEF_LIST
 

Functions

static ParseResult parseFunctionTypes (AsmParser &p, FailureOr< SmallVector< Type >> &params, FailureOr< bool > &isVarArg)
 
static void printFunctionTypes (AsmPrinter &p, ArrayRef< Type > params, bool isVarArg)
 
static ParseResult parsePointer (AsmParser &p, FailureOr< Type > &elementType, FailureOr< unsigned > &addressSpace)
 
static void printPointer (AsmPrinter &p, Type elementType, unsigned addressSpace)
 
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 Optional< unsigned > 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 Optional< unsigned > getStructDataLayoutEntry (DataLayoutEntryListRef params, LLVMStructType type, StructDLEntryPos pos)
 
static unsigned calculateStructAlignment (const DataLayout &dataLayout, DataLayoutEntryListRef params, LLVMStructType type, StructDLEntryPos pos)
 
static unsigned 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 unsigned kBitsInByte = 8
 
constexpr static const unsigned kDefaultPointerSizeBits = 64
 
constexpr static const unsigned kDefaultPointerAlignment = 8
 

Macro Definition Documentation

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 127 of file LLVMTypes.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ calculateStructAlignment()

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

◆ extractStructSpecValue()

static unsigned extractStructSpecValue ( Attribute  attr,
StructDLEntryPos  pos 
)
static

◆ 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 Optional<unsigned> 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 283 of file LLVMTypes.cpp.

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

◆ getStructDataLayoutEntry()

static Optional<unsigned> getStructDataLayoutEntry ( DataLayoutEntryListRef  params,
LLVMStructType  type,
StructDLEntryPos  pos 
)
static

Definition at line 534 of file LLVMTypes.cpp.

Referenced by calculateStructAlignment().

◆ isCompatibleImpl()

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

Definition at line 781 of file LLVMTypes.cpp.

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

◆ parseFunctionTypes()

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

◆ parsePointer()

static ParseResult parsePointer ( AsmParser p,
FailureOr< Type > &  elementType,
FailureOr< unsigned > &  addressSpace 
)
static

◆ printFunctionTypes()

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

Definition at line 67 of file LLVMTypes.cpp.

References mlir::LLVM::printPrettyLLVMType().

◆ printPointer()

static void printPointer ( AsmPrinter p,
Type  elementType,
unsigned  addressSpace 
)
static

Definition at line 103 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 672 of file LLVMTypes.cpp.

References mlir::emitError(), and mlir::success().

Variable Documentation

◆ kBitsInByte

constexpr static const unsigned kBitsInByte = 8
staticconstexpr

◆ kDefaultPointerAlignment

constexpr static const unsigned kDefaultPointerAlignment = 8
staticconstexpr

Definition at line 267 of file LLVMTypes.cpp.

Referenced by getPointerDataLayoutEntry().

◆ kDefaultPointerSizeBits

constexpr static const unsigned kDefaultPointerSizeBits = 64
staticconstexpr

Definition at line 266 of file LLVMTypes.cpp.

Referenced by getPointerDataLayoutEntry().