From 65c2a8a0aefca014278b0dd8c3ff6ec9d66ccfa8 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Fri, 7 Oct 2016 20:52:13 -0400 Subject: [PATCH] Remove stackadjust and stackoffset() from ncg. This feature has never been used since its introduction, more than 3 years ago, in David Given's commit c93cb69 of May 8, 2013. The commit was for "PowerPC and M68K work". I am not undoing the entire commit. I am only removing the stackadjust and stackoffset() feature. This commit removes the feature from my branch kernigh-linuxppc. This removal includes the mach/proto/ncg parts. The default branch already removed most of the feature, but kept the mach/proto/ncg parts. That removal happened in commit 81778b6 of May 13, 2013 (which was a merge; git diff af0dede 81778b6). The branch dtrg-experimental-powerpc merged the default branch but without the removal. That merge was commit 4703db0f of Sep 15, 2016 (git diff 8c94b13 4703db0). My branch kernigh-linuxppc is off branch dtrg-experimental-powerpc, so I can no longer get the removal by merging default. David Given described the stackadjust feature in https://sourceforge.net/p/tack/mailman/message/30814691/ The instruction stackadjust would add a value to the offset, and the function stackoffset() would return this offset. One would use this to track sp - fp, then omit the frame pointer by not keeping fp in a register. --- h/cgg_cg.h | 2 -- mach/proto/ncg/codegen.c | 17 ----------------- mach/proto/ncg/extern.h | 3 --- util/ncgg/cgg.y | 10 +++------- util/ncgg/coerc.c | 9 --------- util/ncgg/extern.h | 1 - util/ncgg/keywords | 2 -- util/ncgg/output.c | 9 --------- util/ncgg/pseudo.h | 1 - 9 files changed, 3 insertions(+), 51 deletions(-) diff --git a/h/cgg_cg.h b/h/cgg_cg.h index a7802ad33..6cc04b007 100644 --- a/h/cgg_cg.h +++ b/h/cgg_cg.h @@ -39,7 +39,6 @@ #define DO_TOSTACK 23 #define DO_KILLREG 24 #define DO_LABDEF 25 -#define DO_STACKADJUST 26 #ifndef MAXATT #define MAXATT TOKENSIZE @@ -134,7 +133,6 @@ typedef struct exprnode *node_p; #define EX_ISROM 44 #define EX_TOPELTSIZE 45 #define EX_FALLTHROUGH 46 -#define EX_STACKOFFSET 47 typedef struct { /* to stack coercions */ diff --git a/mach/proto/ncg/codegen.c b/mach/proto/ncg/codegen.c index cf7379ccf..15d99d393 100644 --- a/mach/proto/ncg/codegen.c +++ b/mach/proto/ncg/codegen.c @@ -909,23 +909,6 @@ normalfailed: if (stackpad!=tokpatlen) { break; } -#endif -#ifdef USE_NOFRAMEPOINTER - case DO_STACKADJUST: { - result_t result; - int nodeno; - - DEBUG("STACKADJUST"); - /* The offset is an expression, which we need to evaluate. */ - - getint(nodeno,codep); - compute(&enodes[nodeno], &result); - assert(result.e_typ==EV_INT); - - if (toplevel) - stackoffset += result.e_v.e_con; - break; - } #endif } } diff --git a/mach/proto/ncg/extern.h b/mach/proto/ncg/extern.h index aa5e42489..3f376d4d1 100644 --- a/mach/proto/ncg/extern.h +++ b/mach/proto/ncg/extern.h @@ -20,9 +20,6 @@ extern rl_p curreglist; /* side effect of findcoerc() */ #ifndef NDEBUG extern int Debug; /* on/off debug printout */ #endif -#ifdef USE_NOFRAMEPOINTER -extern int stackoffset; /* offset from localbase to sp */ -#endif /* * Next descriptions are external declarations for tables created diff --git a/util/ncgg/cgg.y b/util/ncgg/cgg.y index 17a6cf966..4f9cbb00c 100644 --- a/util/ncgg/cgg.y +++ b/util/ncgg/cgg.y @@ -38,7 +38,7 @@ int Xstackflag=0; /* set in coercions, moves, and tests. %1 means something */ struct varinfo *gen_inst(),*gen_move(),*gen_test(),*gen_preturn(),*gen_tlab(); -struct varinfo *gen_label(), *gen_stackadjust(), *make_erase(); +struct varinfo *gen_label(), *make_erase(); expr_t make_expr(),ident_expr(),subreg_expr(),tokm_expr(),all_expr(); expr_t perc_ident_expr(),sum_expr(),regvar_expr(); @@ -74,9 +74,9 @@ iocc_t iops[20]; %token TOPELTSIZE FALLTHROUGH LABELDEF %token PROC CALL EXAMPLE %token FROM TO -%token TEST MOVE STACK RETURN STACKADJUST +%token TEST MOVE STACK RETURN %token PATTERNS PAT WITH EXACT KILLS USES REUSING GEN YIELDS LEAVING -%token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM STACKOFFSET +%token DEFINED SAMESIGN SFIT UFIT ROM LOWW HIGHW ISROM %token CMPEQ CMPNE CMPLT CMPGT CMPLE CMPGE OR2 AND2 LSHIFT RSHIFT NOT COMP %token INREG REGVAR REG_ANY REG_FLOAT REG_LOOP REG_POINTER %token ADORNACCESS @@ -849,8 +849,6 @@ gen_instruction { $$ = gen_label($2-1); use_tes++; } | RETURN { $$ = gen_preturn(); } - | STACKADJUST expr - { $$ = gen_stackadjust($2.ex_index); use_noframepointer++; } ; optstar : /* empty */ @@ -1030,8 +1028,6 @@ expr { $$ = make_expr(TYPINT,EX_LOWW,$3-1,0); } | HIGHW '(' emarg ')' { $$ = make_expr(TYPINT,EX_HIGHW,$3-1,0); } - | STACKOFFSET '(' ')' - { $$ = make_expr(TYPINT,EX_STACKOFFSET, 0, 0); } /* Excluded, because it causes a shift-reduce conflict (problems with a tokenset_no followed by an optexpr) | '-' expr %prec UMINUS diff --git a/util/ncgg/coerc.c b/util/ncgg/coerc.c index eb5f6ee7a..893f81be3 100644 --- a/util/ncgg/coerc.c +++ b/util/ncgg/coerc.c @@ -127,15 +127,6 @@ struct varinfo *gen_preturn() { return(vp); } -struct varinfo *gen_stackadjust(int expr) { - register struct varinfo *vp; - - NEW(vp,struct varinfo); - vp->vi_int[0] = INSSTACKADJUST; - vp->vi_int[1] = expr; - return(vp); -} - struct varinfo *gen_tlab(n) { register struct varinfo *vp; diff --git a/util/ncgg/extern.h b/util/ncgg/extern.h index 909e04774..561591627 100644 --- a/util/ncgg/extern.h +++ b/util/ncgg/extern.h @@ -37,7 +37,6 @@ extern int regclass; extern int maxtokensize; extern int nprocargs, maxprocargs; extern int use_tes; -extern int use_noframepointer; extern char *mystrcpy(); extern char *myalloc(); diff --git a/util/ncgg/keywords b/util/ncgg/keywords index 641fd45b9..606f7c839 100644 --- a/util/ncgg/keywords +++ b/util/ncgg/keywords @@ -43,8 +43,6 @@ reusing REUSING rom ROM samesign SAMESIGN sfit SFIT -stackadjust STACKADJUST -stackoffset STACKOFFSET topeltsize TOPELTSIZE test TEST to TO diff --git a/util/ncgg/output.c b/util/ncgg/output.c index 2a905c339..50458e369 100644 --- a/util/ncgg/output.c +++ b/util/ncgg/output.c @@ -12,8 +12,6 @@ int tabledebug=0; /* do not generate code for table debugging */ #endif int verbose=0; /* print all statistics */ int use_tes; /* use top element size information */ -int use_noframepointer; /* use stackadjust mechanism to remove requirement - for frame pointer */ char *c_file= "tables.c"; char *h_file= "tables.H"; char *cd_file= "code"; @@ -614,8 +612,6 @@ outdefs() { cdef("TABLEDEBUG",1); if (use_tes) cdef("USE_TES",1); - if (use_noframepointer) - cdef("USE_NOFRAMEPOINTER",1); } outars() { @@ -856,11 +852,6 @@ varinfo *kills,*allocates,*generates,*yields,*leaving; codeint(vp->vi_int[1]); codenl(); break; - case INSSTACKADJUST: - code8(DO_STACKADJUST); - codeint(vp->vi_int[1]); - codenl(); - break; } } codecoco(cocono); diff --git a/util/ncgg/pseudo.h b/util/ncgg/pseudo.h index 91013354a..24b335c50 100644 --- a/util/ncgg/pseudo.h +++ b/util/ncgg/pseudo.h @@ -12,4 +12,3 @@ #define INSERASE (-6) #define INSREMOVE (-7) #define INSLABDEF (-8) -#define INSSTACKADJUST (-9)