summaryrefslogtreecommitdiff
path: root/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Target/LLVMIR/ModuleTranslation.cpp')
-rw-r--r--mlir/lib/Target/LLVMIR/ModuleTranslation.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 995544238e4a..669b95a9c6a5 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -274,16 +274,15 @@ translateDataLayout(DataLayoutSpecInterface attribute,
layoutStream << ":" << preferred;
return success();
})
- .Case([&](LLVMPointerType ptrType) {
- layoutStream << "p" << ptrType.getAddressSpace() << ":";
+ .Case([&](LLVMPointerType type) {
+ layoutStream << "p" << type.getAddressSpace() << ":";
uint64_t size = dataLayout.getTypeSizeInBits(type);
uint64_t abi = dataLayout.getTypeABIAlignment(type) * 8u;
uint64_t preferred =
dataLayout.getTypePreferredAlignment(type) * 8u;
- layoutStream << size << ":" << abi << ":" << preferred;
- if (std::optional<uint64_t> index = extractPointerSpecValue(
- entry.getValue(), PtrDLEntryPos::Index))
- layoutStream << ":" << *index;
+ uint64_t index = *dataLayout.getTypeIndexBitwidth(type);
+ layoutStream << size << ":" << abi << ":" << preferred << ":"
+ << index;
return success();
})
.Default([loc](Type type) {
@@ -1722,6 +1721,16 @@ llvm::Metadata *ModuleTranslation::translateDebugInfo(LLVM::DINodeAttr attr) {
return debugTranslation->translate(attr);
}
+llvm::RoundingMode
+ModuleTranslation::translateRoundingMode(LLVM::RoundingMode rounding) {
+ return convertRoundingModeToLLVM(rounding);
+}
+
+llvm::fp::ExceptionBehavior ModuleTranslation::translateFPExceptionBehavior(
+ LLVM::FPExceptionBehavior exceptionBehavior) {
+ return convertFPExceptionBehaviorToLLVM(exceptionBehavior);
+}
+
llvm::NamedMDNode *
ModuleTranslation::getOrInsertNamedModuleMetadata(StringRef name) {
return llvmModule->getOrInsertNamedMetadata(name);