File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1676,6 +1676,10 @@ const thorin::Def* FnDecl::emit(Emitter& emitter) const {
16761676 } else if (auto import_attr = attrs->find (" import" )) {
16771677 if (auto name_attr = import_attr->find (" name" ))
16781678 cont->set_name (name_attr->as <LiteralAttr>()->lit .as_string ());
1679+ if (auto depends_attr = import_attr->find (" depends" )) {
1680+ auto depends = depends_attr->as <PathAttr>();
1681+ cont->attributes ().depends = depends->path .emit (emitter)->as <thorin::Continuation>();
1682+ }
16791683 if (auto cc_attr = import_attr->find (" cc" )) {
16801684 auto cc = cc_attr->as <LiteralAttr>()->lit .as_string ();
16811685 if (cc == " device" ) {
@@ -1687,14 +1691,11 @@ const thorin::Def* FnDecl::emit(Emitter& emitter) const {
16871691 } else if (cc == " thorin" )
16881692 cont->set_intrinsic ();
16891693 else if (cc == " plugin" )
1690- cont->attributes ().intrinsic = thorin::Intrinsic::Plugin;
1694+ // any depends are guaranteed to be emitted earlier
1695+ emitter.world .link_plugin_intrinsic (cont);
16911696 else if (cc == " builtin" )
16921697 emitter.builtin (*this , cont);
16931698 }
1694- if (auto depends_attr = import_attr->find (" depends" )) {
1695- auto depends = depends_attr->as <PathAttr>();
1696- cont->attributes ().depends = depends->path .emit (emitter)->as <thorin::Continuation>();
1697- }
16981699 }
16991700 }
17001701
Original file line number Diff line number Diff line change @@ -299,6 +299,10 @@ int main(int argc, char** argv) {
299299 world.set (opts.log_level );
300300 world.set (std::make_shared<thorin::Stream>(std::cerr));
301301
302+ for (auto plugin_to_load : opts.plugin_files ) {
303+ world.load_plugin (plugin_to_load.c_str ());
304+ }
305+
302306 ast::ModDecl program;
303307 bool success = compile (
304308 opts.files , file_data,
@@ -322,10 +326,6 @@ int main(int argc, char** argv) {
322326 if (!success)
323327 return EXIT_FAILURE;
324328
325- for (auto plugin_to_load : opts.plugin_files ) {
326- world.register_plugin (plugin_to_load.c_str ());
327- }
328-
329329 if (opts.opt_level == 1 )
330330 world.cleanup ();
331331 if (opts.emit_c_int ) {
You can’t perform that action at this time.
0 commit comments