diff options
Diffstat (limited to 'source/slang/lower-to-ir.cpp')
| -rw-r--r-- | source/slang/lower-to-ir.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index 3a5e0cd2e..665904969 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -6113,25 +6113,31 @@ static void lowerEntryPointToIR( EntryPointRequest* entryPointRequest) { // First, lower the entry point like an ordinary function - auto entryPointFuncDecl = entryPointRequest->decl; - if (!entryPointFuncDecl) - { - // Something must have gone wrong earlier, if we - // weren't able to associate a declaration with - // the entry point request. - return; - } - auto loweredEntryPointFunc = ensureDecl(context, entryPointFuncDecl); + + auto session = context->getSession(); + auto entryPointFuncDeclRef = entryPointRequest->getFuncDeclRef(); + auto entryPointFuncType = lowerType(context, getFuncType(session, entryPointFuncDeclRef)); + + auto builder = context->irBuilder; + builder->setInsertInto(builder->getModule()->getModuleInst()); + + auto loweredEntryPointFunc = getSimpleVal(context, + emitDeclRef(context, entryPointFuncDeclRef, entryPointFuncType)); // Attach a marker decoration so that we recognize // this as an entry point. - auto builder = context->irBuilder; - builder->addEntryPointDecoration(getSimpleVal(context, loweredEntryPointFunc)); + // + builder->addEntryPointDecoration(loweredEntryPointFunc); + + // + if(!loweredEntryPointFunc->findDecoration<IRLinkageDecoration>()) + { + builder->addExportDecoration(loweredEntryPointFunc, getMangledName(entryPointFuncDeclRef).getUnownedSlice()); + } // Now lower all the arguments supplied for global generic // type parameters. // - builder->setInsertInto(builder->getModule()->getModuleInst()); for (RefPtr<Substitutions> subst = entryPointRequest->globalGenericSubst; subst; subst = subst->outer) { auto gSubst = subst.as<GlobalGenericParamSubstitution>(); |
