Skip to content

Minor improvements #2247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2453,27 +2453,6 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
}
}
llvm_symtab[h] = ptr;
} else if (x.m_type->type == ASR::ttypeType::UnsignedInteger) {
int a_kind = down_cast<ASR::UnsignedInteger_t>(x.m_type)->m_kind;
llvm::Type *type;
int init_value_bits = 8*a_kind;
type = llvm_utils->getIntType(a_kind);
llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name,
type);
if (!external) {
if (ASRUtils::is_array(x.m_type)) {
throw CodeGenError("Arrays are not supported by visit_Variable");
}
if (init_value) {
module->getNamedGlobal(x.m_name)->setInitializer(
init_value);
} else {
module->getNamedGlobal(x.m_name)->setInitializer(
llvm::ConstantInt::get(context,
llvm::APInt(init_value_bits, 0)));
}
}
llvm_symtab[h] = ptr;
} else if (x.m_type->type == ASR::ttypeType::Real) {
int a_kind = down_cast<ASR::Real_t>(x.m_type)->m_kind;
llvm::Type *type;
Expand Down
6 changes: 3 additions & 3 deletions src/libasr/pass/subroutine_from_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ namespace LCompilers {
using ASR::down_cast;
using ASR::is_a;

class CreateFunctionFromSubroutine: public PassUtils::PassVisitor<CreateFunctionFromSubroutine> {
class CreateSubroutineFromFunction: public PassUtils::PassVisitor<CreateSubroutineFromFunction> {

public:

CreateFunctionFromSubroutine(Allocator &al_) :
CreateSubroutineFromFunction(Allocator &al_) :
PassVisitor(al_, nullptr)
{
pass_result.reserve(al, 1);
Expand Down Expand Up @@ -228,7 +228,7 @@ class ReplaceFunctionCallWithSubroutineCallVisitor:

void pass_create_subroutine_from_function(Allocator &al, ASR::TranslationUnit_t &unit,
const LCompilers::PassOptions& /*pass_options*/) {
CreateFunctionFromSubroutine v(al);
CreateSubroutineFromFunction v(al);
v.visit_TranslationUnit(unit);
ReplaceFunctionCallWithSubroutineCallVisitor u(al);
u.visit_TranslationUnit(unit);
Expand Down