From 58ad76c4d99b58ebda2f24ac0f88bbccedbc7135 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Fri, 12 Dec 2008 20:11:58 +0000 Subject: r12454@gauss: gdr | 2008-12-12 14:07:23 -0600 Tidy Middle End IL. --- src/interp/c-util.boot | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'src/interp') diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 17878a98..1c7dec58 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1260,16 +1260,24 @@ pushLocalVariable x == --% (%ilXLAM ) -- XLAM form --% (%ilLAM ) -- LAMBDA form -ilConstant(c,t) == ["%ilConst",c,t] -ilInert(e,t) == ["%ilInert",e,t] -ilVariable(n,t) == ["%ilVar",n,t] -ilContext(d,t) == ["%ilCtx",d,t] -ilLisp(e,t) == ["%ilLisp",e,t] -ilFun(e,t) == ["%ilFun",e,t] -ilModemap(e,t) == ["%ilMm",e,t] -ilLocal(n,t) == ["%ilLocal",n,t] -ilCall(op,args,t) == ["%ilCall",[op,:args],t] - +structure ILInsn == + %ilConst(c,t) -- constant + %ilInert(e,t) -- inert form + %ilContext(e,t) -- context + %ilVar(n,t) -- variable + %ilCtor(n,t) -- constructor + %ilLocal(op,t) -- local function + %ilLisp(e,t) -- Lisp form + %ilModemap(e,t) -- exported function modemap + %ilUnionTag e -- union object tag + %ilUnionValue(e,t) -- union object value + %ilDeref(e,t) -- deref function pointer + %ilCall(e,t) -- call + %ilType(d,t) -- type instantiation request + %ilReturn(n,T,t) -- `return' expression + %ilExit(n,T,t) -- `exit' expression + +++ Convert middle end IL forms to old back end forms. il2OldForm x == atom x => x -- ideally should not happen x is ["QUOTE",:.] => x -- idem. @@ -1277,13 +1285,22 @@ il2OldForm x == %ilConst(c,.) => c %ilInert(e,.) => e %ilVar(n,.) => n - %ilCtx(e,.) => e + %ilCtor(n,.) => n + %ilContext(e,.) => e %ilLisp(e,.) => e - %ilMm(e,.) => e - %ilTag(e,.) => ["CAR",il2OldForm e] - %ilVal(e,.) => ["CAR",il2OldForm e] + %ilModemap(e,.) => e + %ilUnionTag(e,.) => ["CAR",il2OldForm e] + %ilUnionValue(e,.) => ["CAR",il2OldForm e] + %ilDeref(e,.) => ["applyFun",il2OldForm e] + %ilCall(e,.) => + e is [["%ilLocal",op,:.],:.] => + rplac(first e,op) + ilTransformInsns rest e + e + ["call",:ilTransformInsns e] otherwise => ilTransformInsns x +++ Subroutines of il2OldForm to walk sequence of IL instructions. ilTransformInsns form == for insns in tails form repeat rplac(first insns, il2OldForm first insns) -- cgit v1.2.3