@@ -482,8 +482,10 @@ ll_write_instruction(FILE *out, LL_Instruction *inst, LL_Module *module, int no_
482482 render_bitcast (out, inst);
483483 break ;
484484 case LL_RET:
485- if (no_return)
486- fprintf (out, " %scall void @llvm.nvvm.exit()" ,SPACES);
485+ if (no_return) {
486+ fprintf (out, " %scall void @llvm.nvvm.exit()\n " ,SPACES);
487+ fprintf (out, " %sunreachable" ,SPACES);
488+ }
487489 else
488490 fprintf (out, " %sret %s %s" , SPACES, inst->operands [0 ]->type_struct ->str ,
489491 inst->operands [0 ]->data );
@@ -726,16 +728,15 @@ ll_write_local_objects(FILE *out, LL_Function *function)
726728 }
727729}
728730void
729- ll_write_function (FILE *out, LL_Function *function, LL_Module *module , int no_return)
731+ ll_write_function (FILE *out, LL_Function *function, LL_Module *module , bool no_return, const char *prefix )
730732{
731733 int i;
732734 char attribute[256 ];
733735 LL_BasicBlock *block = function->first ;
734736
735737 fprintf (out, " define %s %s %s " , ll_get_linkage_string (function->linkage ),
736738 function->calling_convention , function->return_type ->str );
737- fprintf (out, " @%s%s(" , no_return?" __no_return_" :" " ,
738- function->name );
739+ fprintf (out, " @%s%s(" , prefix, function->name );
739740 for (i = 0 ; i < function->num_args ; i++) {
740741 fputs (function->arguments [i]->type_struct ->str , out);
741742
@@ -2159,7 +2160,7 @@ ll_write_global_objects(FILE *out, LLVMModuleRef module)
21592160}
21602161
21612162void
2162- ll_write_module (FILE *out, LL_Module *module , int generate_no_return_variants)
2163+ ll_write_module (FILE *out, LL_Module *module , int generate_no_return_variants, const char *no_return_prefix )
21632164{
21642165 int i, j, met_idx;
21652166 LL_Function *function = module ->first ;
@@ -2274,9 +2275,9 @@ ll_write_module(FILE *out, LL_Module *module, int generate_no_return_variants)
22742275 }
22752276 num_functions = 0 ;
22762277 while (function) {
2277- ll_write_function (out, function, module , 0 );
2278+ ll_write_function (out, function, module , false , " " );
22782279 if (generate_no_return_variants) {
2279- ll_write_function (out, function, module , 1 );
2280+ ll_write_function (out, function, module , true , no_return_prefix );
22802281 }
22812282 function = function->next ;
22822283 num_functions++;
0 commit comments