Made use of C_insertpart dependant on compile-time flag

This commit is contained in:
ceriel 1991-02-19 16:22:41 +00:00
parent c59e581ef2
commit c863c96023
4 changed files with 66 additions and 14 deletions

View file

@ -95,3 +95,7 @@
#define DBSYMTAB 1 /* ability to produce symbol table for debugger */ #define DBSYMTAB 1 /* ability to produce symbol table for debugger */
!File: use_insert.h
#define USE_INSERT 1 /* use C_insertpart mechanism */

View file

@ -76,7 +76,8 @@ OBJ = $(COBJ) $(LOBJ) Lpars.o $(EXTRA_O)
GENH = errout.h \ GENH = errout.h \
idfsize.h numsize.h strsize.h target_sizes.h bigparam.h bigresult.h \ idfsize.h numsize.h strsize.h target_sizes.h bigparam.h bigresult.h \
inputtype.h density.h squeeze.h nocross.h nostrict.h \ inputtype.h density.h squeeze.h nocross.h nostrict.h \
def.h debugcst.h type.h Lpars.h node.h desig.h strict3rd.h real.h def.h debugcst.h type.h Lpars.h node.h desig.h strict3rd.h real.h \
use_insert.h dbsymtab.h
HFILES =LLlex.h \ HFILES =LLlex.h \
chk_expr.h class.h const.h debug.h f_info.h idf.h \ chk_expr.h class.h const.h debug.h f_info.h idf.h \
input.h main.h misc.h scope.h standards.h tokenname.h \ input.h main.h misc.h scope.h standards.h tokenname.h \
@ -448,6 +449,7 @@ walk.o: squeeze.h
walk.o: strict3rd.h walk.o: strict3rd.h
walk.o: target_sizes.h walk.o: target_sizes.h
walk.o: type.h walk.o: type.h
walk.o: use_insert.h
walk.o: walk.h walk.o: walk.h
walk.o: warning.h walk.o: warning.h
desig.o: LLlex.h desig.o: LLlex.h

View file

@ -94,3 +94,7 @@
#undef DBSYMTAB 1 /* ability to produce symbol table for debugger */ #undef DBSYMTAB 1 /* ability to produce symbol table for debugger */
!File: use_insert.h
#undef USE_INSERT 1 /* use C_insertpart mechanism */

View file

@ -41,6 +41,7 @@
#include "misc.h" #include "misc.h"
#include "warning.h" #include "warning.h"
#include "bigresult.h" #include "bigresult.h"
#include "use_insert.h"
extern arith NewPtr(); extern arith NewPtr();
extern arith NewInt(); extern arith NewInt();
@ -261,9 +262,13 @@ WalkProcedure(procedure)
arith StackAdjustment = 0; /* space for conformant arrays */ arith StackAdjustment = 0; /* space for conformant arrays */
arith retsav = 0; /* temporary space for return value */ arith retsav = 0; /* temporary space for return value */
arith func_res_size = 0; arith func_res_size = 0;
#ifdef USE_INSERT
int partno = C_getid(); int partno = C_getid();
int partno2 = C_getid(); int partno2 = C_getid();
int end_reached; /* can fall through ... */ #else
label cd_init;
label cd_body;
#endif
proclevel++; proclevel++;
CurrVis = procedure->prc_vis; CurrVis = procedure->prc_vis;
@ -302,7 +307,21 @@ WalkProcedure(procedure)
/* Generate code for this procedure /* Generate code for this procedure
*/ */
TmpOpen(procscope); TmpOpen(procscope);
#ifdef USE_INSERT
C_insertpart(partno2); /* procedure header */ C_insertpart(partno2); /* procedure header */
#else
C_pro_narg(procscope->sc_name);
#ifdef DBSYMTAB
if (options['g']) {
C_ms_std((char *) 0, N_LBRAC, proclevel);
}
#endif /* DBSYMTAB */
C_ms_par(procedure->df_type->prc_nbpar
#ifdef BIG_RESULT_ON_STACK
+ (too_big ? func_res_size : 0)
#endif
);
#endif
/* generate code for filename only when the procedure can be /* generate code for filename only when the procedure can be
exported, either directly or by taking the address. exported, either directly or by taking the address.
This cannot be done if the level is bigger than one (because in This cannot be done if the level is bigger than one (because in
@ -311,13 +330,37 @@ WalkProcedure(procedure)
DoFilename(procscope->sc_level == 1); DoFilename(procscope->sc_level == 1);
DoPriority(); DoPriority();
C_insertpart(partno);
text_label = 1; /* label at end of procedure */ text_label = 1; /* label at end of procedure */
end_reached = WalkNode(procedure->prc_body, NO_EXIT_LABEL, REACH_FLAG); #ifdef USE_INSERT
C_insertpart(partno);
#else
cd_init = ++text_label;
cd_body = ++text_label;
C_bra(cd_init);
def_ilb(cd_body);
#endif
if ((WalkNode(procedure->prc_body, NO_EXIT_LABEL, REACH_FLAG) & REACH_FLAG)) {
if (func_res_size) {
node_warning(procscope->sc_end,
W_ORDINARY,
"function procedure \"%s\" does not always return a value",
procedure->df_idf->id_text);
c_loc(M2_NORESULT);
C_trp();
C_asp(-func_res_size);
}
#ifndef USE_INSERT
C_bra(RETURN_LABEL);
#endif
}
#ifdef USE_INSERT
C_beginpart(partno); C_beginpart(partno);
#else
def_ilb(cd_init);
#endif
/* Generate calls to initialization routines of modules defined within /* Generate calls to initialization routines of modules defined within
this procedure this procedure
@ -403,17 +446,12 @@ WalkProcedure(procedure)
} }
} }
} }
#ifdef USE_INSERT
C_endpart(partno); C_endpart(partno);
#else
C_bra(cd_body);
#endif
DO_DEBUG(options['X'], PrNode(procedure->prc_body, 0)); DO_DEBUG(options['X'], PrNode(procedure->prc_body, 0));
if ((end_reached & REACH_FLAG) && func_res_size) {
node_warning(procscope->sc_end,
W_ORDINARY,
"function procedure \"%s\" does not always return a value",
procedure->df_idf->id_text);
c_loc(M2_NORESULT);
C_trp();
C_asp(-func_res_size);
}
def_ilb(RETURN_LABEL); /* label at end */ def_ilb(RETURN_LABEL); /* label at end */
if (too_big) { if (too_big) {
/* Fill the data area reserved for the function result /* Fill the data area reserved for the function result
@ -454,6 +492,7 @@ WalkProcedure(procedure)
} }
EndPriority(); EndPriority();
C_ret(func_res_size); C_ret(func_res_size);
#ifdef USE_INSERT
C_beginpart(partno2); C_beginpart(partno2);
C_pro(procscope->sc_name, -procscope->sc_off); C_pro(procscope->sc_name, -procscope->sc_off);
#ifdef DBSYMTAB #ifdef DBSYMTAB
@ -466,8 +505,11 @@ WalkProcedure(procedure)
+ (too_big ? func_res_size : 0) + (too_big ? func_res_size : 0)
#endif #endif
); );
#endif
if (! options['n']) WalkDefList(procscope->sc_def, RegisterMessage); if (! options['n']) WalkDefList(procscope->sc_def, RegisterMessage);
#ifdef USE_INSERT
C_endpart(partno2); C_endpart(partno2);
#endif
#ifdef DBSYMTAB #ifdef DBSYMTAB
if (options['g']) { if (options['g']) {
C_ms_std((char *) 0, N_RBRAC, proclevel); C_ms_std((char *) 0, N_RBRAC, proclevel);