@@ -888,7 +888,9 @@ static llvm::Type *RecontextualizeType(llvm::Type *type,
888888 case llvm::Type::PPC_FP128TyID: return llvm::Type::getPPC_FP128Ty (context);
889889 case llvm::Type::LabelTyID: return llvm::Type::getLabelTy (context);
890890 case llvm::Type::MetadataTyID: return llvm::Type::getMetadataTy (context);
891+ #if LLVM_VERSION_MAJOR <= 19
891892 case llvm::Type::X86_MMXTyID: return llvm::Type::getX86_MMXTy (context);
893+ #endif // LLVM_VERSION_MAJOR
892894 case llvm::Type::TokenTyID: return llvm::Type::getTokenTy (context);
893895 case llvm::Type::IntegerTyID: {
894896 auto int_type = llvm::dyn_cast<llvm::IntegerType>(type);
@@ -1185,7 +1187,7 @@ MoveConstantIntoModule(llvm::Constant *c, llvm::Module *dest_module,
11851187 return ret;
11861188 }
11871189#endif // LLVM_VERSION_MAJOR
1188- #if LLVM_VERSION_MAJOR <= 18
1190+ #if LLVM_VERSION_MAJOR <= 17
11891191 case llvm::Instruction::ZExt: {
11901192 auto ret = llvm::ConstantExpr::getZExt (
11911193 MoveConstantIntoModule (ce->getOperand (0 ), dest_module, value_map,
@@ -1250,6 +1252,7 @@ MoveConstantIntoModule(llvm::Constant *c, llvm::Module *dest_module,
12501252 return ret;
12511253 }
12521254#endif // LLVM_VERSION_MAJOR
1255+ #if LLVM_VERSION_MAJOR <= 20
12531256 case llvm::Instruction::Mul: {
12541257 const auto b = llvm::dyn_cast<llvm::MulOperator>(ce);
12551258 auto ret = llvm::ConstantExpr::getMul (
@@ -1261,6 +1264,7 @@ MoveConstantIntoModule(llvm::Constant *c, llvm::Module *dest_module,
12611264 moved_c = ret;
12621265 return ret;
12631266 }
1267+ #endif // LLVM_VERSION_MAJOR
12641268 case llvm::Instruction::IntToPtr: {
12651269 auto ret = llvm::ConstantExpr::getIntToPtr (
12661270 MoveConstantIntoModule (ce->getOperand (0 ), dest_module, value_map,
@@ -1920,7 +1924,7 @@ llvm::Value *LoadFromMemory(const IntrinsicTable &intrinsics,
19201924 const auto initial_addr = addr;
19211925 auto module = intrinsics.error ->getParent ();
19221926 auto &context = module ->getContext ();
1923- llvm::DataLayout dl (module );
1927+ llvm::DataLayout dl (module -> getDataLayout () );
19241928 llvm::Value *args_2[2 ] = {mem_ptr, addr};
19251929 auto index_type = llvm::Type::getIntNTy (context, dl.getPointerSizeInBits (0 ));
19261930
@@ -1947,9 +1951,11 @@ llvm::Value *LoadFromMemory(const IntrinsicTable &intrinsics,
19471951 return ir.CreateLoad (type, res);
19481952 }
19491953
1954+ #if LLVM_VERSION_MAJOR <= 19
19501955 case llvm::Type::X86_MMXTyID:
19511956 return ir.CreateBitCast (ir.CreateCall (intrinsics.read_memory_64 , args_2),
19521957 type);
1958+ #endif // LLVM_VERSION_MAJOR
19531959
19541960 case llvm::Type::IntegerTyID:
19551961 switch (dl.getTypeAllocSize (type)) {
@@ -2094,7 +2100,7 @@ llvm::Value *StoreToMemory(const IntrinsicTable &intrinsics,
20942100 const auto initial_addr = addr;
20952101 auto module = intrinsics.error ->getParent ();
20962102 auto &context = module ->getContext ();
2097- llvm::DataLayout dl (module );
2103+ llvm::DataLayout dl (module -> getDataLayout () );
20982104 llvm::Value *args_3[3 ] = {mem_ptr, addr, val_to_store};
20992105 auto index_type = llvm::Type::getInt32Ty (context);
21002106
@@ -2126,11 +2132,13 @@ llvm::Value *StoreToMemory(const IntrinsicTable &intrinsics,
21262132 return ir.CreateCall (intrinsics.write_memory_f80 , args_3);
21272133 }
21282134
2135+ #if LLVM_VERSION_MAJOR <= 19
21292136 case llvm::Type::X86_MMXTyID: {
21302137 auto i64_type = llvm::Type::getInt64Ty (context);
21312138 args_3[2 ] = ir.CreateBitCast (val_to_store, i64_type);
21322139 return ir.CreateCall (intrinsics.write_memory_64 , args_3);
21332140 }
2141+ #endif // LLVM_VERSION_MAJOR
21342142
21352143 case llvm::Type::IntegerTyID:
21362144 switch (dl.getTypeAllocSize (type)) {
0 commit comments