14 #ifndef MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ 15 #define MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ 23 #include "llvm/IR/DerivedTypes.h" 24 #include "llvm/IR/LLVMContext.h" 25 #include "llvm/IR/Module.h" 26 #include "llvm/IR/Type.h" 28 #include "mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc" 40 struct LLVMTypeStorage;
41 struct LLVMDialectImpl;
45 detail::LLVMTypeStorage> {
48 LLVM_TYPE = FIRST_LLVM_TYPE,
53 static bool kindof(
unsigned kind) {
return kind == LLVM_TYPE; }
59 bool isFloatTy() {
return getUnderlyingType()->isFloatTy(); }
60 bool isDoubleTy() {
return getUnderlyingType()->isDoubleTy(); }
61 bool isIntegerTy() {
return getUnderlyingType()->isIntegerTy(); }
63 return getUnderlyingType()->isIntegerTy(bitwidth);
68 unsigned getArrayNumElements();
76 LLVMType getFunctionParamType(
unsigned argIdx);
77 unsigned getFunctionNumParams();
82 LLVMType getPointerTo(
unsigned addrSpace = 0);
87 LLVMType getStructElementType(
unsigned i);
88 unsigned getStructNumElements();
101 return getIntNTy(dialect, 1);
104 return getIntNTy(dialect, 8);
110 return getIntNTy(dialect, 16);
113 return getIntNTy(dialect, 32);
116 return getIntNTy(dialect, 64);
124 return getFunctionTy(result,
llvm::None, isVarArg);
127 bool isPacked =
false);
129 return getStructTy(dialect,
llvm::None, isPacked);
131 template <
typename... Args>
132 static typename std::enable_if<llvm::are_base_of<
LLVMType, Args...>::value,
136 return getStructTy(&elt1.
getDialect(), fields);
138 static LLVMType getVectorTy(LLVMType elementType,
unsigned numElements);
154 #define GET_OP_CLASSES 155 #include "mlir/Dialect/LLVMIR/LLVMOps.h.inc" 163 llvm::LLVMContext &getLLVMContext();
164 llvm::Module &getLLVMModule();
181 std::unique_ptr<detail::LLVMDialectImpl> impl;
189 StringRef value, LLVM::Linkage linkage,
199 #endif // MLIR_DIALECT_LLVMIR_LLVMDIALECT_H_ Definition: InferTypeOpInterface.cpp:20
static LLVMType getFunctionTy(LLVMType result, bool isVarArg)
Definition: LLVMDialect.h:123
static LLVMType getInt1Ty(LLVMDialect *dialect)
Definition: LLVMDialect.h:100
LLVMDialect & getDialect()
Definition: LLVMDialect.cpp:1513
Definition: PassRegistry.cpp:413
static StringRef getDialectNamespace()
Definition: LLVMDialect.h:161
Definition: Operation.h:27
Definition: Attributes.h:139
bool isIntegerTy(unsigned bitwidth)
Definition: LLVMDialect.h:62
bool isDoubleTy()
Definition: LLVMDialect.h:60
static LLVMType getInt8PtrTy(LLVMDialect *dialect)
Definition: LLVMDialect.h:106
Definition: Location.h:52
std::pair< Identifier, Attribute > NamedAttribute
Definition: Attributes.h:264
Definition: LogicalResult.h:18
static std::enable_if< llvm::are_base_of< LLVMType, Args... >::value, LLVMType >::type getStructTy(LLVMType elt1, Args... elts)
Definition: LLVMDialect.h:134
bool isFloatTy()
Utilities to identify types.
Definition: LLVMDialect.h:59
static LLVMType getInt32Ty(LLVMDialect *dialect)
Definition: LLVMDialect.h:112
Value createGlobalString(Location loc, OpBuilder &builder, StringRef name, StringRef value, LLVM::Linkage linkage, LLVM::LLVMDialect *llvmDialect)
Definition: LLVMDialect.cpp:1658
static LLVMType getInt16Ty(LLVMDialect *dialect)
Definition: LLVMDialect.h:109
bool isIntegerTy()
Definition: LLVMDialect.h:61
bool satisfiesLLVMModule(Operation *op)
Definition: LLVMDialect.cpp:1687
LLVMType getPointerTo(unsigned addrSpace=0)
Pointer type utilities.
Definition: LLVMDialect.cpp:1551
Type parseType(llvm::StringRef typeStr, MLIRContext *context)
static bool kindof(unsigned kind)
Definition: LLVMDialect.h:53
Definition: DialectImplementation.h:33
Definition: StorageUniquerSupport.h:30
Definition: MLIRContext.h:34
Definition: StandardTypes.h:63
static LLVMType getInt64Ty(LLVMDialect *dialect)
Definition: LLVMDialect.h:115
Definition: Builders.h:158
Definition: LLVMDialect.h:157
static LLVMType getInt8Ty(LLVMDialect *dialect)
Definition: LLVMDialect.h:103
Definition: DialectImplementation.h:100
static LLVMType getStructTy(LLVMDialect *dialect, bool isPacked=false)
Definition: LLVMDialect.h:128
Kind
Definition: LLVMDialect.h:47
Definition: LLVMDialect.h:44