Made use of C_insertpart dependant on compile-time flag
This commit is contained in:
parent
c59e581ef2
commit
c863c96023
|
@ -95,3 +95,7 @@
|
|||
#define DBSYMTAB 1 /* ability to produce symbol table for debugger */
|
||||
|
||||
|
||||
!File: use_insert.h
|
||||
#define USE_INSERT 1 /* use C_insertpart mechanism */
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ OBJ = $(COBJ) $(LOBJ) Lpars.o $(EXTRA_O)
|
|||
GENH = errout.h \
|
||||
idfsize.h numsize.h strsize.h target_sizes.h bigparam.h bigresult.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 \
|
||||
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 \
|
||||
|
@ -448,6 +449,7 @@ walk.o: squeeze.h
|
|||
walk.o: strict3rd.h
|
||||
walk.o: target_sizes.h
|
||||
walk.o: type.h
|
||||
walk.o: use_insert.h
|
||||
walk.o: walk.h
|
||||
walk.o: warning.h
|
||||
desig.o: LLlex.h
|
||||
|
|
|
@ -94,3 +94,7 @@
|
|||
#undef DBSYMTAB 1 /* ability to produce symbol table for debugger */
|
||||
|
||||
|
||||
!File: use_insert.h
|
||||
#undef USE_INSERT 1 /* use C_insertpart mechanism */
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "misc.h"
|
||||
#include "warning.h"
|
||||
#include "bigresult.h"
|
||||
#include "use_insert.h"
|
||||
|
||||
extern arith NewPtr();
|
||||
extern arith NewInt();
|
||||
|
@ -261,9 +262,13 @@ WalkProcedure(procedure)
|
|||
arith StackAdjustment = 0; /* space for conformant arrays */
|
||||
arith retsav = 0; /* temporary space for return value */
|
||||
arith func_res_size = 0;
|
||||
#ifdef USE_INSERT
|
||||
int partno = C_getid();
|
||||
int partno2 = C_getid();
|
||||
int end_reached; /* can fall through ... */
|
||||
#else
|
||||
label cd_init;
|
||||
label cd_body;
|
||||
#endif
|
||||
|
||||
proclevel++;
|
||||
CurrVis = procedure->prc_vis;
|
||||
|
@ -302,7 +307,21 @@ WalkProcedure(procedure)
|
|||
/* Generate code for this procedure
|
||||
*/
|
||||
TmpOpen(procscope);
|
||||
#ifdef USE_INSERT
|
||||
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
|
||||
exported, either directly or by taking the address.
|
||||
This cannot be done if the level is bigger than one (because in
|
||||
|
@ -311,13 +330,37 @@ WalkProcedure(procedure)
|
|||
DoFilename(procscope->sc_level == 1);
|
||||
DoPriority();
|
||||
|
||||
C_insertpart(partno);
|
||||
|
||||
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);
|
||||
#else
|
||||
def_ilb(cd_init);
|
||||
#endif
|
||||
|
||||
/* Generate calls to initialization routines of modules defined within
|
||||
this procedure
|
||||
|
@ -403,17 +446,12 @@ WalkProcedure(procedure)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef USE_INSERT
|
||||
C_endpart(partno);
|
||||
#else
|
||||
C_bra(cd_body);
|
||||
#endif
|
||||
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 */
|
||||
if (too_big) {
|
||||
/* Fill the data area reserved for the function result
|
||||
|
@ -454,6 +492,7 @@ WalkProcedure(procedure)
|
|||
}
|
||||
EndPriority();
|
||||
C_ret(func_res_size);
|
||||
#ifdef USE_INSERT
|
||||
C_beginpart(partno2);
|
||||
C_pro(procscope->sc_name, -procscope->sc_off);
|
||||
#ifdef DBSYMTAB
|
||||
|
@ -466,8 +505,11 @@ WalkProcedure(procedure)
|
|||
+ (too_big ? func_res_size : 0)
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
if (! options['n']) WalkDefList(procscope->sc_def, RegisterMessage);
|
||||
#ifdef USE_INSERT
|
||||
C_endpart(partno2);
|
||||
#endif
|
||||
#ifdef DBSYMTAB
|
||||
if (options['g']) {
|
||||
C_ms_std((char *) 0, N_RBRAC, proclevel);
|
||||
|
|
Loading…
Reference in a new issue