Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
Show First 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | Type LLVMTypeConverter::convertIndexType(IndexType type) { | ||||
return getIndexType(); | return getIndexType(); | ||||
} | } | ||||
Type LLVMTypeConverter::convertIntegerType(IntegerType type) { | Type LLVMTypeConverter::convertIntegerType(IntegerType type) { | ||||
return LLVM::LLVMType::getIntNTy(&getContext(), type.getWidth()); | return LLVM::LLVMType::getIntNTy(&getContext(), type.getWidth()); | ||||
} | } | ||||
Type LLVMTypeConverter::convertFloatType(FloatType type) { | Type LLVMTypeConverter::convertFloatType(FloatType type) { | ||||
switch (type.getKind()) { | if (type.isa<Float32Type>()) | ||||
case mlir::StandardTypes::F32: | |||||
return LLVM::LLVMType::getFloatTy(&getContext()); | return LLVM::LLVMType::getFloatTy(&getContext()); | ||||
case mlir::StandardTypes::F64: | if (type.isa<Float64Type>()) | ||||
return LLVM::LLVMType::getDoubleTy(&getContext()); | return LLVM::LLVMType::getDoubleTy(&getContext()); | ||||
case mlir::StandardTypes::F16: | if (type.isa<Float16Type>()) | ||||
return LLVM::LLVMType::getHalfTy(&getContext()); | return LLVM::LLVMType::getHalfTy(&getContext()); | ||||
case mlir::StandardTypes::BF16: { | if (type.isa<BFloat16Type>()) | ||||
return LLVM::LLVMType::getBFloatTy(&getContext()); | return LLVM::LLVMType::getBFloatTy(&getContext()); | ||||
} | |||||
default: | |||||
llvm_unreachable("non-float type in convertFloatType"); | llvm_unreachable("non-float type in convertFloatType"); | ||||
} | } | ||||
} | |||||
// Convert a `ComplexType` to an LLVM type. The result is a complex number | // Convert a `ComplexType` to an LLVM type. The result is a complex number | ||||
// struct with entries for the | // struct with entries for the | ||||
// 1. real part and for the | // 1. real part and for the | ||||
// 2. imaginary part. | // 2. imaginary part. | ||||
static constexpr unsigned kRealPosInComplexNumberStruct = 0; | static constexpr unsigned kRealPosInComplexNumberStruct = 0; | ||||
static constexpr unsigned kImaginaryPosInComplexNumberStruct = 1; | static constexpr unsigned kImaginaryPosInComplexNumberStruct = 1; | ||||
Type LLVMTypeConverter::convertComplexType(ComplexType type) { | Type LLVMTypeConverter::convertComplexType(ComplexType type) { | ||||
▲ Show 20 Lines • Show All 3,245 Lines • Show Last 20 Lines |