diff options
author | dos-reis <gdr@axiomatics.org> | 2008-12-12 20:11:49 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-12-12 20:11:49 +0000 |
commit | 1e4af96a0c4a3dbaf965cf4f69929dec1ae2395f (patch) | |
tree | f603638e14b6267d040eea262bda5b537e76a7dc /src/interp | |
parent | ddcad96e9a200379a0f9120b7d10531945e6e234 (diff) | |
download | open-axiom-1e4af96a0c4a3dbaf965cf4f69929dec1ae2395f.tar.gz |
r12453@gauss: gdr | 2008-12-12 09:39:28 -0600
Introduce Middle IL.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/c-util.boot | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 32ef603c..17878a98 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1240,6 +1240,57 @@ pushLocalVariable x == PUSH(x,$LocalVars) +--% +--% Middle Env to Back End Transformations. +--% + +--% e ::= +--% (%ilConst <c> <type>) -- constant +--% (%ilInert <e> <type>) -- inert form +--% (%ilCtx <d> <type>) -- context +--% (%ilVar <n> <type>) -- variable +--% (%ilLisp <e> <type>) -- Lisp form +--% (%ilFun <e> <type>) -- function object +--% (%ilMm <e> <type>) -- modemap +--% (%ilLocal <n> <type>) -- local function +--% (%ilCtor <n> <type>) -- constructor +--% (%ilTag <e> <type>) -- tag of union object +--% (%ilVal <e> <type>) -- value of union object +--% (%ilCall <e...e> <type>) -- a call +--% (%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] + +il2OldForm x == + atom x => x -- ideally should not happen + x is ["QUOTE",:.] => x -- idem. + case x of + %ilConst(c,.) => c + %ilInert(e,.) => e + %ilVar(n,.) => n + %ilCtx(e,.) => e + %ilLisp(e,.) => e + %ilMm(e,.) => e + %ilTag(e,.) => ["CAR",il2OldForm e] + %ilVal(e,.) => ["CAR",il2OldForm e] + otherwise => ilTransformInsns x + +ilTransformInsns form == + for insns in tails form repeat + rplac(first insns, il2OldForm first insns) + form + + +--% ++ Replace every middle end sub-forms in `x' with Lisp code. mutateToBackendCode: %Form -> %Void |