MLIR  20.0.0git
Functions
LLVMTypeSyntax.cpp File Reference
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/TypeSwitch.h"

Go to the source code of this file.

Functions

static void dispatchPrint (AsmPrinter &printer, Type type)
 If the given type is compatible with the LLVM dialect, prints it using internal functions to avoid getting a verbose !llvm prefix. More...
 
static StringRef getTypeKeyword (Type type)
 Returns the keyword to use for the given type. More...
 
static ParseResult dispatchParse (AsmParser &parser, Type &type)
 Helper to use in parse lists. More...
 
static Type parseVectorType (AsmParser &parser)
 Parses an LLVM dialect vector type. More...
 
static LLVMStructType trySetStructBody (LLVMStructType type, ArrayRef< Type > subtypes, bool isPacked, AsmParser &parser, SMLoc subtypesLoc)
 Attempts to set the body of an identified structure type. More...
 
static Type dispatchParse (AsmParser &parser, bool allowAny=true)
 Parses a type appearing inside another LLVM dialect-compatible type. More...
 

Function Documentation

◆ dispatchParse() [1/2]

static Type dispatchParse ( AsmParser parser,
bool  allowAny = true 
)
static

Parses a type appearing inside another LLVM dialect-compatible type.

This will try to parse any type in full form (including types with the !llvm prefix), and on failure fall back to parsing the short-hand version of the LLVM dialect types without the !llvm prefix.

Definition at line 284 of file LLVMTypeSyntax.cpp.

◆ dispatchParse() [2/2]

static ParseResult dispatchParse ( AsmParser parser,
Type type 
)
static

Helper to use in parse lists.

Definition at line 326 of file LLVMTypeSyntax.cpp.

◆ dispatchPrint()

static void dispatchPrint ( AsmPrinter printer,
Type  type 
)
static

If the given type is compatible with the LLVM dialect, prints it using internal functions to avoid getting a verbose !llvm prefix.

Otherwise prints it as usual.

Definition at line 26 of file LLVMTypeSyntax.cpp.

References mlir::LLVM::isCompatibleType(), mlir::AsmPrinter::printType(), and mlir::LLVM::detail::printType().

◆ getTypeKeyword()

static StringRef getTypeKeyword ( Type  type)
static

Returns the keyword to use for the given type.

Definition at line 34 of file LLVMTypeSyntax.cpp.

◆ parseVectorType()

static Type parseVectorType ( AsmParser parser)
static

Parses an LLVM dialect vector type.

llvm-type ::= vec< ? x? integer x llvm-type > Supports both fixed and scalable vectors.

Definition at line 121 of file LLVMTypeSyntax.cpp.

◆ trySetStructBody()

static LLVMStructType trySetStructBody ( LLVMStructType  type,
ArrayRef< Type subtypes,
bool  isPacked,
AsmParser parser,
SMLoc  subtypesLoc 
)
static

Attempts to set the body of an identified structure type.

Reports a parsing error at subtypesLoc in case of failure.

Definition at line 158 of file LLVMTypeSyntax.cpp.