File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2374,6 +2374,27 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
23742374 }
23752375 }
23762376 llvm_symtab[h] = ptr;
2377+ } else if (x.m_type ->type == ASR::ttypeType::UnsignedInteger) {
2378+ int a_kind = down_cast<ASR::UnsignedInteger_t>(x.m_type )->m_kind ;
2379+ llvm::Type *type;
2380+ int init_value_bits = 8 *a_kind;
2381+ type = llvm_utils->getIntType (a_kind);
2382+ llvm::Constant *ptr = module ->getOrInsertGlobal (x.m_name ,
2383+ type);
2384+ if (!external) {
2385+ if (ASRUtils::is_array (x.m_type )) {
2386+ throw CodeGenError (" Arrays are not supported by visit_Variable" );
2387+ }
2388+ if (init_value) {
2389+ module ->getNamedGlobal (x.m_name )->setInitializer (
2390+ init_value);
2391+ } else {
2392+ module ->getNamedGlobal (x.m_name )->setInitializer (
2393+ llvm::ConstantInt::get (context,
2394+ llvm::APInt (init_value_bits, 0 )));
2395+ }
2396+ }
2397+ llvm_symtab[h] = ptr;
23772398 } else if (x.m_type ->type == ASR::ttypeType::Real) {
23782399 int a_kind = down_cast<ASR::Real_t>(x.m_type )->m_kind ;
23792400 llvm::Type *type;
You can’t perform that action at this time.
0 commit comments