diff options
author | dos-reis <gdr@axiomatics.org> | 2008-12-12 20:11:58 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-12-12 20:11:58 +0000 |
commit | 58ad76c4d99b58ebda2f24ac0f88bbccedbc7135 (patch) | |
tree | 4e3b8bdd5b743e5d474fa90826c6ff61b50f1718 /src | |
parent | 1e4af96a0c4a3dbaf965cf4f69929dec1ae2395f (diff) | |
download | open-axiom-58ad76c4d99b58ebda2f24ac0f88bbccedbc7135.tar.gz |
r12454@gauss: gdr | 2008-12-12 14:07:23 -0600
Tidy Middle End IL.
Diffstat (limited to 'src')
-rw-r--r-- | src/interp/c-util.boot | 45 |
1 files changed, 31 insertions, 14 deletions
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 <e> <type>) -- XLAM form --% (%ilLAM <e> <type>) -- 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) |