Skip to content

Commit

Permalink
[TESTING DON'T MERGE] : Resolving issues with llvm 19 testing
Browse files Browse the repository at this point in the history
  • Loading branch information
assem2002 committed Oct 7, 2024
1 parent 5915ccc commit 3457583
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
llvm::FunctionType *function_type = llvm::FunctionType::get(
llvm::Type::getVoidTy(context),
{
llvm::Type::getInt8PtrTy(context)->getPointerTo(),
llvm::Type::getInt8PtrTy(context),
llvm::Type::getInt8Ty(context)->getPointerTo()->getPointerTo(),
llvm::Type::getInt8Ty(context)->getPointerTo(),
llvm::Type::getInt8Ty(context),
llvm::Type::getInt64Ty(context),
llvm::Type::getInt64Ty(context)
Expand Down Expand Up @@ -1018,14 +1018,14 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
llvm::Value* capacity_ptr = llvm_utils->create_gep2(string_descriptor, x_arr, 2); // fetch capacity
args = {char_ptr_ptr, alloc_size, size_ptr, capacity_ptr};
builder->CreateCall(fn, args);
ptr_to_init = llvm_utils->CreateLoad2(llvm::Type::getInt8PtrTy(context), char_ptr_ptr);
ptr_to_init = llvm_utils->CreateLoad2(llvm::Type::getInt8Ty(context)->getPointerTo(), char_ptr_ptr);
} else {
args = {x_arr,
alloc_size,
llvm::ConstantInt::getNullValue(llvm::Type::getInt64PtrTy(context)),
llvm::ConstantInt::getNullValue(llvm::Type::getInt64PtrTy(context))};
llvm::ConstantInt::getNullValue(llvm::Type::getInt64Ty(context)->getPointerTo()),
llvm::ConstantInt::getNullValue(llvm::Type::getInt64Ty(context)->getPointerTo())};
builder->CreateCall(fn, args);
ptr_to_init = llvm_utils->CreateLoad2(llvm::Type::getInt8PtrTy(context), x_arr);
ptr_to_init = llvm_utils->CreateLoad2(llvm::Type::getInt8Ty(context)->getPointerTo(), x_arr);
}
string_init(context, *module, *builder, alloc_size, ptr_to_init);
} else if(ASR::is_a<ASR::StructType_t>(*curr_arg_m_a_type) ||
Expand Down Expand Up @@ -1187,8 +1187,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
llvm::Type::getVoidTy(context), {
character_type->getPointerTo(),
llvm::Type::getInt32Ty(context),
llvm::Type::getInt64PtrTy(context),
llvm::Type::getInt64PtrTy(context)
llvm::Type::getInt64Ty(context)->getPointerTo(),
llvm::Type::getInt64Ty(context)->getPointerTo()
}, false);
alloc_fun = llvm::Function::Create(function_type,
llvm::Function::ExternalLinkage, func_name, *module);
Expand Down Expand Up @@ -1256,7 +1256,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
char_ptr = llvm_utils->create_gep2(string_descriptor, tmp, 0);
size = llvm_utils->create_gep2(string_descriptor, tmp, 1);
capacity = llvm_utils->create_gep2(string_descriptor, tmp, 2);
builder->CreateStore(llvm::ConstantPointerNull::getNullValue(llvm::Type::getInt8PtrTy(context)), char_ptr);
builder->CreateStore(llvm::ConstantPointerNull::getNullValue(llvm::Type::getInt8Ty(context)->getPointerTo()), char_ptr);
builder->CreateStore(llvm::ConstantInt::get(llvm::Type::getInt64Ty(context),0), size);
builder->CreateStore(llvm::ConstantInt::get(llvm::Type::getInt64Ty(context),0), capacity);
continue;
Expand Down Expand Up @@ -3361,7 +3361,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
*ASRUtils::type_get_past_allocatable( \
ASRUtils::type_get_past_pointer(v->m_type)))) { \
if(ASRUtils::is_allocatable_string(v->m_type)){ \
builder->CreateStore(llvm::ConstantPointerNull::getNullValue(llvm::Type::getInt8PtrTy(context)),\
builder->CreateStore(llvm::ConstantPointerNull::getNullValue(llvm::Type::getInt8Ty(context)->getPointerTo()),\
llvm_utils->create_gep2(string_descriptor, ptr, 0));\
builder->CreateStore(llvm::ConstantInt::get(llvm::Type::getInt64Ty(context),0),\
llvm_utils->create_gep2(string_descriptor, ptr, 1));\
Expand Down
4 changes: 2 additions & 2 deletions src/libasr/codegen/llvm_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace LCompilers {
llvm::Type::getDoubleTy(context)->getPointerTo(),
llvm::Type::getDoubleTy(context)->getPointerTo()};
std::vector<llvm::Type*> string_descriptor_members {
llvm::Type::getInt8PtrTy(context), // char_pointer
llvm::Type::getInt8Ty(context)->getPointerTo(), // char_pointer
llvm::Type::getInt64Ty(context), // size
llvm::Type::getInt64Ty(context) // capacity
};
Expand Down Expand Up @@ -2175,7 +2175,7 @@ namespace LCompilers {
llvm::Value* dest_member = create_gep2(name2dertype[der_type_name], dest, mem_idx);
if(ASRUtils::is_allocatable_string(member_type)){
src_member = LLVMUtils::create_gep2(string_descriptor, src_member, 0);
src_member = LLVMUtils::CreateLoad2(llvm::Type::getInt8PtrTy(context), src_member);
src_member = LLVMUtils::CreateLoad2(llvm::Type::getInt8Ty(context)->getPointerTo(), src_member);
}
deepcopy(src_member, dest_member,
ASRUtils::symbol_type(item.second),
Expand Down

0 comments on commit 3457583

Please sign in to comment.