Skip to content
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
2 changes: 1 addition & 1 deletion integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ RUN(NAME test_statistics_01 LABELS cpython llvm llvm_jit NOFAST)
# RUN(NAME test_statistics_02 LABELS cpython llvm llvm_jit NOFAST REQ_PY_VER 3.10)
# RUN(NAME test_attributes LABELS cpython llvm llvm_jit)
# RUN(NAME test_str_attributes LABELS cpython llvm llvm_jit c)
# RUN(NAME kwargs_01 LABELS cpython llvm llvm_jit NOFAST) # renable c # post sync
RUN(NAME kwargs_01 LABELS cpython llvm llvm_jit NOFAST) # renable c # post sync
# RUN(NAME def_func_01 LABELS cpython llvm llvm_jit) # renable c # post sync

RUN(NAME func_inline_01 LABELS llvm llvm_jit c wasm)
Expand Down
2 changes: 1 addition & 1 deletion libasr
Submodule libasr updated 55 files
+8 −1 integration_tests/CMakeLists.txt
+28 −0 integration_tests/derived_type_with_default_init.f90
+16 −0 integration_tests/derived_type_with_default_init_01.f90
+31 −0 integration_tests/modules_61.f90
+11 −0 integration_tests/separate_compilation_16.f90
+10 −0 integration_tests/separate_compilation_16a.f90
+11 −0 integration_tests/separate_compilation_16b.f90
+17 −0 integration_tests/separate_compilation_17.f90
+16 −0 integration_tests/separate_compilation_17a.f90
+16 −0 integration_tests/separate_compilation_17b.f90
+8 −0 integration_tests/separate_compilation_18.f90
+9 −0 integration_tests/separate_compilation_18a.f90
+8 −0 integration_tests/separate_compilation_18b.f90
+12 −0 integration_tests/separate_compilation_19.f90
+19 −0 integration_tests/separate_compilation_19a.f90
+12 −0 integration_tests/separate_compilation_19b.f90
+7 −3 integration_tests/submodule_04.f90
+3 −3 src/lfortran/semantics/ast_body_visitor.cpp
+12 −12 src/lfortran/semantics/ast_common_visitor.h
+3 −3 src/lfortran/semantics/ast_symboltable_visitor.cpp
+9 −10 src/libasr/asr_utils.cpp
+7 −18 src/libasr/asr_utils.h
+78 −40 src/libasr/codegen/asr_to_llvm.cpp
+29 −0 src/libasr/codegen/llvm_utils.cpp
+5 −0 src/libasr/codegen/llvm_utils.h
+5 −6 src/libasr/pass/instantiate_template.cpp
+2 −2 src/libasr/pass/nested_vars.cpp
+9 −9 src/libasr/pass/openmp.cpp
+2 −2 src/libasr/pass/pass_utils.cpp
+1 −1 tests/reference/asr-continue_compilation_2-a6145a1.json
+3 −3 tests/reference/asr-continue_compilation_2-a6145a1.stderr
+2 −2 tests/reference/asr-submodule_04-987b68b.json
+55 −6 tests/reference/asr-submodule_04-987b68b.stdout
+1 −1 tests/reference/llvm-class_01-82031c0.json
+2 −2 tests/reference/llvm-class_01-82031c0.stdout
+1 −1 tests/reference/llvm-class_02-82c2f9c.json
+2 −2 tests/reference/llvm-class_02-82c2f9c.stdout
+1 −1 tests/reference/llvm-modules_11-a28ab77.json
+4 −4 tests/reference/llvm-modules_11-a28ab77.stdout
+1 −1 tests/reference/llvm-nested_03-2eacab7.json
+4 −4 tests/reference/llvm-nested_03-2eacab7.stdout
+1 −1 tests/reference/llvm-nested_04-39da8f9.json
+8 −8 tests/reference/llvm-nested_04-39da8f9.stdout
+1 −1 tests/reference/llvm-nested_05-0252368.json
+10 −10 tests/reference/llvm-nested_05-0252368.stdout
+1 −1 tests/reference/llvm-nested_06-fa1a99f.json
+4 −4 tests/reference/llvm-nested_06-fa1a99f.stdout
+1 −1 tests/reference/llvm-program_03-374e848.json
+6 −6 tests/reference/llvm-program_03-374e848.stdout
+1 −1 tests/reference/llvm-recursion_01-95eb32d.json
+17 −17 tests/reference/llvm-recursion_01-95eb32d.stdout
+1 −1 tests/reference/llvm-recursion_02-76da7b3.json
+7 −7 tests/reference/llvm-recursion_02-76da7b3.stdout
+1 −1 tests/reference/llvm-recursion_03-3285725.json
+7 −7 tests/reference/llvm-recursion_03-3285725.stdout
20 changes: 10 additions & 10 deletions src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
} else {
sym = es_s;
}
return ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, sym));
return ASRUtils::make_StructType_t_util(al, loc, sym);
}
default: {
return return_type;
Expand Down Expand Up @@ -841,7 +841,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
ASR::symbol_t *der_sym = ASRUtils::symbol_get_past_external(s);
if( der_sym ) {
if ( ASR::is_a<ASR::Struct_t>(*der_sym) ) {
type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, s));
type = ASRUtils::make_StructType_t_util(al, loc, s);
type = ASRUtils::make_Array_t_util(al, loc, type, dims.p, dims.size(), abi, is_argument);
} else if( ASR::is_a<ASR::Enum_t>(*der_sym) ) {
type = ASRUtils::TYPE(ASR::make_EnumType_t(al, loc, s));
Expand Down Expand Up @@ -1307,7 +1307,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
if ( n_kwargs>0 ) {
throw SemanticError("Keyword args are not supported", loc);
}
ASR::ttype_t* der_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, stemp));
ASR::ttype_t* der_type = ASRUtils::make_StructType_t_util(al, loc, stemp);
return ASR::make_StructConstructor_t(al, loc, stemp, args.p,
args.size(), der_type, nullptr);
}
Expand Down Expand Up @@ -1342,7 +1342,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
for (size_t i = args.size(); i < st->n_members; i++) {
args.push_back(al, st->m_initializers[i]);
}
ASR::ttype_t* der_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, stemp));
ASR::ttype_t* der_type = ASRUtils::make_StructType_t_util(al, loc, stemp);
return ASR::make_StructConstructor_t(al, loc, stemp, args.p, args.size(), der_type, nullptr);
} else if( ASR::is_a<ASR::Enum_t>(*s) ) {
Vec<ASR::expr_t*> args_new;
Expand Down Expand Up @@ -1955,7 +1955,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
" str annotation", loc);
}
//TODO: Change the returned type from Class to StructType
return ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, sym, false));
return ASRUtils::make_StructType_t_util(al, loc, sym, false);
}

throw SemanticError("Only Name, Subscript, and Call supported for now in annotation of annotated assignment.", loc);
Expand Down Expand Up @@ -3485,7 +3485,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
std::string self_name = x.m_args.m_args[0].m_arg;
ASR::symbol_t* sym = current_scope->get_symbol(self_name);
ASR::Variable_t* self_var = ASR::down_cast<ASR::Variable_t>(sym);
self_var->m_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al,loc, class_sym));
self_var->m_type = ASRUtils::make_StructType_t_util(al,loc, class_sym);
current_scope = parent_scope;
}

Expand Down Expand Up @@ -5361,7 +5361,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
first_arg.loc = loc;
ASR::symbol_t* self_sym = current_scope->get_symbol("self");
first_arg.m_value = ASRUtils::EXPR(ASR::make_Var_t(al,loc,self_sym));
ASR::ttype_t* target_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al,loc,parent_sym));
ASR::ttype_t* target_type = ASRUtils::make_StructType_t_util(al,loc,parent_sym);
cast_helper(target_type, first_arg.m_value, x.base.base.loc, true);
Vec<ASR::call_arg_t> args_w_first; args_w_first.reserve(al,1);
args_w_first.push_back(al, first_arg);
Expand Down Expand Up @@ -6354,7 +6354,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
s2c(al, struct_member_name), ASR::accessType::Public));
current_scope->add_symbol(import_name, import_struct_member);
}
member_var_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, import_struct_member));
member_var_type = ASRUtils::make_StructType_t_util(al, loc, import_struct_member);
}
}
}
Expand Down Expand Up @@ -6458,7 +6458,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
" found in " + std::string(der_type->m_name),
loc);
} else if ( !member_found && der_type->m_parent ) {
ASR::ttype_t* parent_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc,der_type->m_parent));
ASR::ttype_t* parent_type = ASRUtils::make_StructType_t_util(al, loc,der_type->m_parent);
visit_AttributeUtil(parent_type,attr_char,t,loc);
return;
}
Expand Down Expand Up @@ -6495,7 +6495,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
s2c(al, struct_member_name), ASR::accessType::Public));
current_scope->add_symbol(import_name, import_struct_member);
}
member_var_type = ASRUtils::TYPE(ASRUtils::make_StructType_t_util(al, loc, import_struct_member));
member_var_type = ASRUtils::make_StructType_t_util(al, loc, import_struct_member);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-bindc_01-c984f09.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "llvm-bindc_01-c984f09.stdout",
"stdout_hash": "b59c35903bc9fa613e1e9642c20891d7893465f569262418763cc367",
"stdout_hash": "8e6909147fa7483f9dbcc5139bb36d53bdb17252c55669e8d75bef66",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
10 changes: 5 additions & 5 deletions tests/reference/llvm-bindc_01-c984f09.stdout
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; ModuleID = 'LFortran'
source_filename = "LFortran"

@queries = global void* null
@x = global i16* null
@__module___main___queries = global void* null
@__module___main___x = global i16* null
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [8 x i8] c"CPtr,I2\00", align 1
@1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
Expand All @@ -11,10 +11,10 @@ source_filename = "LFortran"

define void @__module___main_____main__global_stmts() {
.entry:
%0 = load void*, void** @queries, align 8
%0 = load void*, void** @__module___main___queries, align 8
%1 = bitcast void* %0 to i16*
store i16* %1, i16** @x, align 8
%2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, void** @queries, i16** @x)
store i16* %1, i16** @__module___main___x, align 8
%2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, void** @__module___main___queries, i16** @__module___main___x)
call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
call void @__module___main___test_issue_1781()
br label %return
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-print_04-443a8d8.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "llvm-print_04-443a8d8.stdout",
"stdout_hash": "a2870505fcc8307104191937696b63aca644e3513fa28d45a69648f0",
"stdout_hash": "6c1392ce3559ea53f3111fb9fb1686cdc78907114f6d2dae50e460fd",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
16 changes: 8 additions & 8 deletions tests/reference/llvm-print_04-443a8d8.stdout
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
; ModuleID = 'LFortran'
source_filename = "LFortran"

@u = global i64 -922337203685477580
@x = global i32 -2147483648
@y = global i16 -32768
@z = global i8 -128
@__module___main___u = global i64 -922337203685477580
@__module___main___x = global i32 -2147483648
@__module___main___y = global i16 -32768
@__module___main___z = global i8 -128
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [3 x i8] c"I8\00", align 1
@1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
Expand All @@ -20,13 +20,13 @@ source_filename = "LFortran"

define void @__module___main_____main__global_stmts() {
.entry:
%0 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, i64* @u)
%0 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info, i32 0, i32 0), i32 0, i32 0, i64* @__module___main___u)
call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
%1 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.1, i32 0, i32 0), i32 0, i32 0, i32* @x)
%1 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.1, i32 0, i32 0), i32 0, i32 0, i32* @__module___main___x)
call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0))
%2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.2, i32 0, i32 0), i32 0, i32 0, i16* @y)
%2 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.2, i32 0, i32 0), i32 0, i32 0, i16* @__module___main___y)
call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0))
%3 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.3, i32 0, i32 0), i32 0, i32 0, i8* @z)
%3 = call i8* (i8*, i8*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.3, i32 0, i32 0), i32 0, i32 0, i8* @__module___main___z)
call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @7, i32 0, i32 0), i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0))
br label %return

Expand Down
Loading