Skip to content

Commit

Permalink
Merge pull request #2650 from Shaikh-Ubaid/lfortran_crtlib_changes
Browse files Browse the repository at this point in the history
LLVM: Fix prototype declaration for _lpython_get_argc()
  • Loading branch information
Shaikh-Ubaid committed Apr 15, 2024
2 parents 34c012d + ef9f478 commit 7d0cfdb
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9316,17 +9316,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
llvm::Function *fn = module->getFunction("_lpython_get_argc");
if(!fn) {
llvm::FunctionType *function_type = llvm::FunctionType::get(
llvm::Type::getVoidTy(context), {
llvm::Type::getInt32Ty(context)->getPointerTo()
}, false);
llvm::Type::getInt32Ty(context), {}, false);
fn = llvm::Function::Create(function_type,
llvm::Function::ExternalLinkage, "_lpython_get_argc", *module);
}
llvm::AllocaInst *result = builder->CreateAlloca(
llvm::Type::getInt32Ty(context), nullptr);
std::vector<llvm::Value*> args = {result};
builder->CreateCall(fn, args);
tmp = CreateLoad(result);
tmp = builder->CreateCall(fn, {});
return;
} else if (func_name == "achar") {
// TODO: make achar just StringChr
Expand Down

0 comments on commit 7d0cfdb

Please sign in to comment.