-
Notifications
You must be signed in to change notification settings - Fork 3
compilation phases
target-main.lisp/
common-lisp:compile
sb-c:compile-in-lexenv
sb-c::actually-compile
main.lisp/
sb-c::%compile
sb-c::make-functional-from-toplevel-lambda --- returns a COMPONENT from a lambda expression
sb-c::ir1-convert-lambda
binds *current-component* here to an empty component
sb-c::make-lambda-vars
sb-c::process-decls
sb-c::ir1-convert-hairy-lambda
or sb-c::ir1-convert-lambda-body --- these things push blocks into *current-component*
sb-c::locall-analyze-clambdas-until-done *current-component*
sb-c::compile-component *current-component*
sb-c::ir1-phases
loop until *reoptimize-after-type-check-max*
sb-c::ir1-optimize-until-done
loop until *max-optimize-iterations*
sb-c::ir1-optimize component
loop for each block in the component:
sb-c::ir1-optimize-block block
loop for node in the block:
dispatch for each node type:
ref -> nil
combination -> ir1-optimize-combination
cif -> ir1-optimize-if
creturn -> ir1-optimize-return
mv-combination -> ir1-optimize-mv-combination
exit -> ??
set -> ir1-optimize-set
cast -> ir1-optimize-cast
eliminate-dead-code
dfo-as-needed -- DFO = Depth first order --- reachability analysis
%compile-component -- IR2
gtn-analyze -- Global TN
ltn-analyze -- Local TN
dfo-as-needed -- reachability analysis again
control-analyze
stack-analyze
dfo-as-needed -- reachability analysis again -- presumably marking the reachable TNs
ir2-convert
ir2-optimize
delete-unreferenced-tns
lifetime-analyze
delete-no-op-vops
ir2-optimize-jumps
optimize-constant-loads
generate-code
fasl-dump-component or make-core-component
(setf (component-info component) :dead) --- otherwise the component is :live
-
*loop-analyze*
bool --- loop analysis for register allocation. default T -
*max-optimize-iterations*
integer, default 3 -
*reoptimize-after-type-check-max*
integer, default 10
SB-C::CBLOCK: optimization is done on block-based. The CBLOCK structure represents a basic block.
SB-C:COMPONENT: single component has multiple blocks cf. (do-blocks (component) &body body)
each component has REOPTIMIZE flag
curious slots in sb-c:component
- lambdas
- new-functionals
- outer-loop
cblock
's info
slot can hold an instance of block-annotation
. Whilst the cblock doesnt set a type its seems from comments that the only annotation found in info
is the ir2-block
, these contain information about a block that is used during and after IR2 conversion.
BLOCK-INFO Holds the IR2-BLOCK structure. If there are overflow blocks, then this points to the first IR2-BLOCK. The BLOCK-INFO of the dummy component head and tail are dummy IR2 blocks that begin and end the emission order thread.
COMPONENT-INFO Holds the IR2-COMPONENT structure.
LVAR-INFO Holds the IR2-LVAR structure. LVARs whose values aren't used won't have any. XXX
CLEANUP-INFO If non-null, then a TN in which the affected dynamic environment pointer should be saved after the binding is instantiated.
PHYSENV-INFO Holds the IR2-PHYSENV structure.
TAIL-SET-INFO Holds the RETURN-INFO structure.
NLX-INFO-INFO Holds the IR2-NLX-INFO structure.
LEAF-INFO If a non-set lexical variable, the TN that holds the value in the home environment. If a constant, then the corresponding constant TN. If an XEP lambda, then the corresponding Entry-Info structure.
BASIC-COMBINATION-INFO The template chosen by LTN, or :FULL if this is definitely a full call. :FUNNY if this is an oddball thing with IR2-convert. :LOCAL if this is a local call.
NODE-TAIL-P After LTN analysis, this is true only in combination nodes that are truly tail recursive.
An IR2-BLOCK holds information about a block that is used during and after IR2 conversion. It is stored in the BLOCK-INFO slot for the associated block.