File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,21 @@ class ASRToX86Visitor : public ASR::BaseVisitor<ASRToX86Visitor>
79
79
visit_symbol (*sym);
80
80
}
81
81
82
+ if (x.m_global_scope ->get_symbol (" _global_symbols" ) != nullptr ) {
83
+ SymbolTable *global_symbols = ASR::down_cast<ASR::Module_t>(
84
+ x.m_global_scope ->get_symbol (" _global_symbols" ))->m_symtab ;
85
+ std::vector<std::string> global_func_order
86
+ = ASRUtils::determine_function_definition_order (global_symbols);
87
+ for (size_t i = 0 ; i < global_func_order.size (); i++) {
88
+ ASR::symbol_t * sym = global_symbols->get_symbol (global_func_order[i]);
89
+ // Ignore external symbols because they are already defined by the loop above.
90
+ if ( !sym || ASR::is_a<ASR::ExternalSymbol_t>(*sym) ) {
91
+ continue ;
92
+ }
93
+ visit_symbol (*sym);
94
+ }
95
+ }
96
+
82
97
// Then the main program:
83
98
for (auto &item : x.m_global_scope ->get_scope ()) {
84
99
if (ASR::is_a<ASR::Program_t>(*item.second )) {
@@ -504,7 +519,8 @@ class ASRToX86Visitor : public ASR::BaseVisitor<ASRToX86Visitor>
504
519
}
505
520
506
521
void visit_SubroutineCall (const ASR::SubroutineCall_t &x) {
507
- ASR::Function_t *s = ASR::down_cast<ASR::Function_t>(x.m_name );
522
+ ASR::Function_t *s = ASR::down_cast<ASR::Function_t>(
523
+ ASRUtils::symbol_get_past_external (x.m_name ));
508
524
509
525
uint32_t h = get_hash ((ASR::asr_t *)s);
510
526
if (x86_symtab.find (h) == x86_symtab.end ()) {
You can’t perform that action at this time.
0 commit comments